A single Sonnet-class agent answers everything. Many queries are simple lookups a Haiku-class model handles for a fraction of the cost. The expensive model spends most of its budget on questions it never needed to see.
Apps with a wide query distribution where many requests are simple and a few are complex. Customer support, knowledge base assistants, internal helpdesks.
Apps where every query touches the same tool surface and the cost of misrouting (a small model failing) is high.
Drop this into an app.yaml. Adjust the credential refs and module names to fit your existing setup.
1schema_version: 223app:4 app_id: semantic-router5 name: "Semantic router"6 version: "1.0.0"78modules:9 web: {}10 rag: {}11 agent_spawn: {}1213runtime:14 mode: conversation15 entry_agent: router1617agents:18 - id: router19 role: coordinator20 modules: [{agent_spawn: [agent]}]21 brain:22 provider: anthropic23 model: claude-haiku-4-524 credential: { ref: anthropic_main, scope: per_user, provider: anthropic }25 system_prompt: |26 Classify the user message in one word:27 SIMPLE -> single fact or definition, dispatch fast_helper28 RESEARCH -> needs the web, dispatch researcher29 EXPERT -> multi-step or ambiguous, dispatch expert30 Then call agent(agent=<picked>, task=<original message>)31 and return the result verbatim.3233 - id: fast_helper34 role: specialist35 modules: [{rag: [query]}]36 brain: { provider: anthropic, model: claude-haiku-4-5, credential: { ref: anthropic_main, scope: per_user, provider: anthropic } }37 system_prompt: "Answer in one paragraph using rag.query results."3839 - id: researcher40 role: specialist41 modules: [{web: [search, fetch]}, {rag: [query]}]42 brain: { provider: anthropic, model: claude-sonnet-5, credential: { ref: anthropic_main, scope: per_user, provider: anthropic } }43 system_prompt: "Research, cite sources, write a concise answer."4445 - id: expert46 role: specialist47 modules: [{web: [search, fetch]}, {rag: [query]}]48 brain: { provider: anthropic, model: claude-opus-5, credential: { ref: anthropic_main, scope: per_user, provider: anthropic } }49 system_prompt: "Reason carefully, ask clarifying questions if needed."Walking through the YAML one block at a time so the design is clear, not memorised.
The router runs Haiku-class. Its only job is one-word classification of incoming messages, almost free per call.
Three specialists: Haiku for trivial lookups, Sonnet for research, Opus for hard reasoning. Each only sees the queries that need it.
Returning the specialist's output as-is keeps the response identical to what a single big model would have produced. No double summarisation.
Most workloads skew heavily toward simple queries. With a large cost ratio between the cheapest and most expensive model, the average query cost drops sharply.
The pattern above is not the only answer. Here is when something else is the right call.
Simpler config, predictable quality. You pay the expert price on every query.
Replace the LLM router with a local embedding classifier trained on past queries. Near-zero cost, lower flexibility.
Engineering notes from the Digitorn team. No marketing, no launch announcements, no "10 prompts that will change your life". Just the things we write that we'd want to read.