Why we stopped letting agents pick their own model mid-task
A few months ago we thought we were being clever: we gave our orchestrator a switch_to_heavy_model tool and told it in the system prompt to use the small model for easy steps and only escalate when a task looked hard.
In practice, models are terrible judges of their own confusion.
Sometimes the small model would fail a JSON schema check, apologize, and keep retrying the exact same broken tool call six times without ever calling switch_to_heavy_model. Other times it would panic on a completely normal customer email and escalate straight to our most expensive reasoning tier.
Boring Python heuristics beat self-routing
We ripped out the self-escalation tool and replaced it with a plain deterministic check in the runner loop:
pythondef pick_model(turn_index: int, consecutive_tool_errors: int, diff_lines: int) -> str: # If the cheap model stumbled twice in a row, stop letting it spin if consecutive_tool_errors >= 2: return "reasoning-large" # Multi-file edits or big diffs go straight to the heavy model if diff_lines > 120: return "reasoning-large" # Otherwise stay on the fast tier if turn_index == 0: return "fast-small" return "fast-small"
Our average cost per resolved ticket dropped by roughly half the week we deployed that, mostly because we stopped paying for 8-turn error loops on the small model. Keep routing logic in code where you can actually unit-test it.