Sub-Agent Model Routing
Goal
Route sub-agents to the cheapest model that can do the job, saving 10-40x on costs without sacrificing quality.What the User Gets
Without this: every sub-agent runs on Opus (3-5/day. Research tasks cost $10+ each. With this: entity detection runs on Sonnet (0.50/MTok, 30x cheaper). Main session stays on Opus for quality. Total cost drops 70-80%.Implementation
Routing Table
The Signal Detector Pattern
Spawn a lightweight sub-agent on EVERY inbound message. This is mandatory.Research Pipeline Pattern
For research-heavy tasks, use a multi-model pipeline:When to Spawn Sub-Agents
Cost Optimization
The main session runs on your best model. Everything else runs on the cheapest model that can do the job. In practice, 60-70% of sub-agent work is entity detection (Sonnet) and research execution (DeepSeek), which are 10-40x cheaper than the main session model.Tricky Spots
- Sonnet, not Opus, for detection. The most common mistake is running entity detection on Opus. Detection is pattern matching, not deep reasoning. Sonnet is 5-10x cheaper and fast enough. Reserve Opus for the main session where reasoning quality matters.
- Don’t block the main thread. Sub-agents must run asynchronously. If the signal detector runs synchronously, the user waits 30-120 seconds for every message while entity detection completes. Spawn and forget. The user sees a response immediately.
- Cost optimization is multiplicative. Entity detection runs on every single message. If you use Opus at 3-5/day just for detection. Sonnet at 0.60-1.00/day. Over a month, the wrong model choice costs $100+ more than necessary.
How to Verify
- Spawn a signal detector and check the model. Send a message and verify the sub-agent was spawned on Sonnet-class, not Opus. Check the model field in the sub-agent config or logs.
- Check cost per day. After running for a day with sub-agent routing, compare total API costs against the previous day without routing. You should see a 50-80% reduction in total cost.
- Verify async execution. Send a message and measure response time. The response should arrive in under 5 seconds. If it takes 30+ seconds, the signal detector is running synchronously and blocking the main thread.
Part of the ModusBrain Skillpack.