Skip to main content

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 (15/MTok).Entitydetectiononeverymessagecosts15/MTok). Entity detection on every message costs 3-5/day. Research tasks cost $10+ each. With this: entity detection runs on Sonnet (3/MTok,5xcheaper).ResearchrunsonDeepSeek(3/MTok, 5x cheaper). Research runs on DeepSeek (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.
Why Sonnet-class for detection: Entity detection is pattern matching, not deep reasoning. Sonnet is 5-10x cheaper than Opus and fast enough for async detection. The main session continues on Opus while detection runs in parallel.

Research Pipeline Pattern

For research-heavy tasks, use a multi-model pipeline:
Why this works: The planning and synthesis steps need taste and judgment (Opus). The execution step is mechanical data gathering (DeepSeek at 25-40x lower cost). You get Opus-quality output at DeepSeek-level cost for 80% of the work.

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

  1. 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.
  2. 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.
  3. Cost optimization is multiplicative. Entity detection runs on every single message. If you use Opus at 15/MTokfordetectionacross50messages/day,thats15/MTok for detection across 50 messages/day, that's 3-5/day just for detection. Sonnet at 3/MTokbringsthatto3/MTok brings that to 0.60-1.00/day. Over a month, the wrong model choice costs $100+ more than necessary.

How to Verify

  1. 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.
  2. 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.
  3. 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.