Skip to main content

strale-fallback

When your agent's primary API fails, Strale picks up the call.

strale-fallback wraps any function in your agent pipeline. When the primary call fails (timeout, 429, 503, malformed response), it automatically finds a matching Strale capability and executes it — returning structured JSON with a quality score.

Install

pip install strale-fallback

Usage

import os
from strale_fallback import with_fallback

@with_fallback(
    task_description="validate IBAN number",
    strale_api_key=os.environ["STRALE_API_KEY"]
)
async def validate_iban(iban: str):
    # Your primary API call — if this fails, Strale takes over
    return await my_primary_api.validate_iban(iban)

result = await validate_iban("SE3550000000054910000003")
print(result.source)           # "primary" or "strale_fallback"
print(result.data)             # structured JSON either way
print(result.capability_used)  # e.g. "iban-validate" (if fallback used)

Sync functions work too:

@with_fallback(task_description="check company sanctions")
def check_sanctions(company_name: str):
    return requests.get(f"https://my-api.com/sanctions/{company_name}").json()

How it works

  1. Your primary function is called normally
  2. If it throws (any HTTP error, timeout, or exception), strale-fallback calls POST /v1/suggest with your taskDescription to find the best matching Strale capability
  3. It executes that capability with your function's arguments as inputs
  4. Returns a FallbackResult with source: "strale_fallback" so you know which path was taken

FallbackResult

Field Type Description
success bool Whether a result was obtained
data any The result data
source string "primary" or "strale_fallback"
capability_used string? Strale capability slug if fallback used
strale_sqs float? Quality score (0-100) if fallback used
error string? Error message if both paths failed

Quality threshold

# Only use Strale as fallback if SQS quality score >= 80
@with_fallback(
    task_description="check company sanctions",
    min_sqs=80
)
async def check_sanctions(company: str): ...

Environment

Set STRALE_API_KEY — or pass it directly to the decorator. Get a free key with trial credits: https://strale.dev/signup

Free capabilities (no key needed)

iban-validate, email-validate, dns-lookup, json-repair, url-to-markdown — these work even without an API key.

Full capability catalog: https://strale.dev/capabilities

License

MIT

Metadata

Release files for strale-fallback 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for strale-fallback 0.1.0
File Size Uploaded Provenance Actions
strale_fallback-0.1.0.tar.gz 3.9 kB Without provenance Details for strale_fallback-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for strale-fallback 0.1.0
File Interpreter ABI Platform Actions
strale_fallback-0.1.0-py3-none-any.whl Python 3 none any Details for strale_fallback-0.1.0-py3-none-any.whl

Total release size: 9.4 kB

Release files / strale_fallback-0.1.0.tar.gz

Download URL strale_fallback-0.1.0.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
f6d387f3fa11c01ae2daab34d2c32c08e3960f925fc1fff6d646a762f19494e5
BLAKE2b-256 checksum
How to use checksums
17ecfa691493c786b6ff14c74e18cb2bf57b7cc1610c38995787395a3d374ede
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release files / strale_fallback-0.1.0-py3-none-any.whl

Download URL strale_fallback-0.1.0-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
009cf7a527b132315e024301270ed4ee25cb5685edf4f6d8eac8f54f82432b3a
BLAKE2b-256 checksum
How to use checksums
e36f8b5d9ce89bb357220d718d3703b57834b13d97e6e926030980d44733c4fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Security for strale-fallback 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page