A calibration-robust router for multi-model AI.
You have several models, cheap to expensive. Tropos sends each task to the cheapest one that is actually reliable, using what it has learned rather than what the model claims about itself. Here is the whole loop, in real code, with the real output.
It does not call your models or grade results for you. You wire those up; Tropos makes the calibrated decision and remembers what happened.
Cheapest-first, each model on a price tier.
$ pip install tropos
from tropos import Fleet, Model
fleet = Fleet(models=[
Model("haiku", "economy"),
Model("sonnet", "standard"),
Model("opus", "premium"),
])
You pass each model's confidence bid. On a cold start there is no track record yet, so Tropos plays safe and escalates to the strongest model.
from tropos import route
bids = {"haiku": 0.9, "sonnet": 0.9, "opus": 0.95}
route("parse", bids, fleet).model
routed to : opus
reason : no model cleared the barrier; escalated to the highest corrected bid
After each run, tell Tropos what actually happened. This is the whole point: the routing sharpens from real outcomes, with no privileged information.
# haiku got 'parse' wrong; sonnet got it right, twice
fleet.record("haiku", "parse", passed=False)
fleet.record("sonnet", "parse", passed=True)
fleet.record("sonnet", "parse", passed=True)
haiku 'parse' reliability : 0.42
sonnet 'parse' reliability : 0.80
Same bids as before. But now Tropos knows haiku is unreliable on parse, so it routes to the cheaper reliable model instead of the frontier.
route("parse", bids, fleet).model
routed to : sonnet
reason : cheapest model clearing the barrier (0.70)
Two commands. The output below is exactly what you will see.
$ pip install tropos
$ python -m examples.walkthrough
=== 1. Fleet defined: haiku (economy) < sonnet (standard) < opus (premium) ===
=== 2. Route 'parse' at cold start (no track record yet) ===
bids : {'haiku': 0.9, 'sonnet': 0.9, 'opus': 0.95}
routed to : opus
reason : no model cleared the barrier; escalated to the highest corrected bid
=== 3. Report real outcomes ===
haiku 'parse' reliability : 0.42
sonnet 'parse' reliability : 0.80
=== 4. Route 'parse' again, routing has improved ===
routed to : sonnet
reason : cheapest model clearing the barrier (0.70)
honest caveatTropos helps most on a fleet of cheap, often overconfident models, where a confidently-wrong cheap answer is expensive (rework, failed tests, lost trust). Where the cheap model is already reliable, it is a no-op with no regression, a safety net rather than a generic booster.