B2 · Routing
Family: Workflows
A classifier sorts each request into a category and sends it to the specialised handler.
Principle
A classifier, an LLM or not, categorises the input and routes it to a specialised handler: a prompt, a tool, a model or an agent. Each handler stays simple and can be optimised on its own.
The problem it solves
A one-size-fits-all prompt handles very different requests poorly, and costs a lot if every request goes to the largest model.
When to use it
- Requests fall into distinct categories that can be spotted on arrival (customer support by intent).
- You want to send simple cases to a cheaper model and keep the large model for hard cases.
When to avoid it
- The right category only emerges mid-conversation: use a handoff between agents instead (E4).
Common pitfalls
The anti-patterns that misuse this pattern, best established first. Each sheet describes the symptoms, the public incidents and the remedies.
Framing and choice of level
- AP03 · LLM for a deterministic decision — The model decides what a rule, a parser or a linter would get exactly right, almost for free.
Synonyms by vendor
- Routing (Anthropic, AWS, A. Gulli)
- Router (LangChain, Hugging Face)
- Coordinator/Dispatcher (Google ADK)
- Dispatcher (Microsoft)
- Structured output routing (OpenAI Agents SDK)
Neighbouring patterns
Sources
- Building effective agents — Anthropic (E. Schluntz, B. Zhang), 2024-12-19
- RouteLLM: An Open-Source Framework for Cost-Effective LLM Routing — LMSYS, 2024-07-01
Content reviewed on 2026-10-02