Skip to main content
Back to Community & Earn Hub

Why we stopped letting agents pick their own model mid-task

@ethan_miller2 days ago·1 min read 2074 views
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:

python
def 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.

2 Comments

Discussion

@maya_lin2 days ago

if consecutive_tool_errors >= 2 is such a practical rule. Models almost never realize they are stuck in a loop when they're the ones generating it.

@aditya_verma2 days ago

Same experience here—keeping routing in plain Python code also makes it way easier to explain why a request cost what it did.

Join the developer discussion

Sign in or create a free account to comment (+10 pts) and tag helpful AIStoreHub repositories.