Routing (Classification-Dispatch)
Classify the input first, then dispatch to a specialist prompt or agent — rather than asking one generalist to handle every case.
This page is the complete instruction page for one pattern called "Routing (Classification-Dispatch)." It explains the problem this pattern solves, the idea behind the solution, when you should (and should not) use it, and what happens afterward — both the good effects and the costs.
This matters because building AI agents is not just about making them clever. It is also about making them safe and predictable. Following a well-tested pattern like this one helps avoid common mistakes, and shows you exactly which safety rules and regulations it connects to, listed under "Standards Mesh" on this page.
Context
Queries arrive in mixed forms: refund request, product question, complaint, escalation. A single prompt tuned for all cases is worse than several prompts tuned for one each.
Problem
Generalist prompts regress to the mean across all cases.
Forces
- Coverage of cases vs specialisation
- Routing accuracy vs cascade errors
Solution
Classify the input by a cheap model or deterministic rules. Route to a specialist chain, agent, or prompt. Include a default lane for unclassified cases and a human-escalation lane for low-confidence classifications.
Applicability
- Customer support
- Inbox triage
- Multi-intent assistants
Anti-Patterns
- Classifier hidden in the generalist prompt
- No default or escalation lane
Consequences
- +Specialist quality per lane
- +Easier to improve one lane at a time
- −Classifier errors cascade
- −Lane proliferation