fable5-tier-based-routing

Route LLM inference requests through a seven-tier cost hierarchy with hard timeouts and budget gates.

Updated Mar 22, 2026
One-click install
npx skills add https://github.com/diazMelgarejo/orama-system --skill fable5-tier-based-routing-diazmelgarejo
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: fable5-tier-based-routing
Source: https://github.com/diazMelgarejo/orama-system/tree/main/bin/orama-system/skills/fable5-tier-based-routing
Command: npx skills add https://github.com/diazMelgarejo/orama-system --skill fable5-tier-based-routing-diazmelgarejo

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Choosing which model or backend should handle an inference request is error-prone: teams either overpay for premium models on trivial tasks, silently blow past cost budgets, or hang indefinitely on unresponsive endpoints. This Skill operationalizes a deterministic tier-based routing policy so requests always try the cheapest viable backend first and escalate only with explicit, auditable reasons. ## Core Features & Use Cases - Seven-Tier Routing Hierarchy: Routes requests from in-context and local Ollama/gbrain tiers (free) up through HuggingFace free, proprietary free, OpenRouter paid, and a Grok last-resort tier, matching the production frugality_router.py implementation. - Hard Timeout Enforcement: Mandates 10-second killable background-job timeouts per tier and explicitly forbids the timeout N && cmd pattern that breaks SIGTERM delivery. - Fail-Closed Cost Guard: Integrates CostGuard with a $25/day budget, 80% alert threshold, and raise-on-deny semantics so cost overruns surface as exceptions rather than silent reroutes. - Escalation Audit Trail: Requires an escalation_reason for every tier >= 3 elevation and enforces privacy_critical and offline-mode policies. - Use Case: An orchestrator receives a 3000-token reasoning request; it probes local tiers first, and on timeout escalates to a paid tier only after CostGuard.can_spend() approves, logging the escalation reason for compliance. ## Quick Start Ask the agent to route a reasoning request through the tier hierarchy with cost guard checks and 10-second timeouts, escalating only with a recorded escalation reason.

Frequently Asked Questions about fable5-tier-based-routing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I route LLM requests to the cheapest available model?

Call resolve_route() with a ToolCallSpec and no escalation_tier parameter so the router probes free local tiers first. It tries in-context, local Ollama, and local index backends before any paid tier, returning the cheapest match with estimated cost.

How do I enforce a daily cost budget on LLM API calls?

Use CostGuard with a default $25 daily budget and call can_spend(estimated_cost) before escalating to any paid tier. If the budget is insufficient it raises an exception rather than silently rerouting, and record_spend() tracks actual usage after each call.

Can I force routing to a local Ollama tier directly?

No, tiers 0 through 2 are probe-only and cannot be forced via the escalation_tier parameter. Passing escalation_tier=1 raises FrugalityPolicyError; local tiers are reached only by internal probe logic against an online BackendRegistry.

Why should I avoid timeout N && cmd for endpoint timeouts?

The shell timeout command breaks SIGTERM delivery, so a stuck process may be SIGKILLed without cleanup. Use a killable background job or a Python monitor until-loop that polls the process and kills it after the 10-second limit instead.

What happens when all routing tiers fail?

Tier 6 is the last resort with no fallback beyond it, so its failure is fatal. The caller must raise SystemExit or equivalent, surfacing the outage rather than retry-storming or silently degrading.

Does privacy-critical mode block cloud LLM tiers?

Yes, setting privacy_critical=True on the ToolCallSpec forbids escalation to tier 4 and above, and ORAMASYS_OFFLINE=1 blocks all cloud egress tiers. The policy enforcement raises FrugalityPolicyError when violated.