Minimal reference for multi-provider LLM routing with fallback, budget, latency targets, and decision logging.
Motivation: today's Opus-502 incident on a major provider is a normal production shape. A request should pick the best eligible model, fall through when the primary is down, and leave an audit trail of what happened.
route-mini is part of the Delegate & Orchestrate public substrate family:
small, inspectable references for the parts an agent fleet needs before it can
be trusted with repeated work.
- Provider fallback is policy, not a rescue branch hidden in application code.
- Budget and latency targets can participate in routing before a request runs.
- Every selection leaves a decision record: eligible models, attempted providers, fallback source, cost estimate, latency, and final reason.
- Tests use deterministic providers, so routing behavior is auditable without making live network calls.
pip install route-miniFor local development:
pip install -e ".[dev]"python examples/opus_down_demo.pyOutput:
selected=major-provider-backup:sonnet
reason=fallback-selected
fallback_from=['major-provider:opus']
attempts=2
text=fallback response
Core code makes no network calls. Providers are abstract, and tests use deterministic in-memory scripts.
- JustAi — orchestration control plane.
- safe-mini — safe local execution substrate.
- memory-mini — durable agent memory reference.