Catalog / Orchestration
Routing
A router classifies the request once and sends it to one specialised handler. The router does no other work, and the handler cannot pass the request on.
Reference task used across all patterns: "My order arrived damaged. Can I get a refund?"
Topology
Run
06 steps
Ready to run
Play runs the whole scenario. Step advances one event at a time so you can read what happens.
Metrics
| Wall-clock time | 0.0 s |
|---|---|
| Tokens processed | 0 |
| Estimated cost | $0.000 |
| Router confidence | 0% |
All steps
Normal run
- Request arrives. Every request enters through the router. It is a small, fast model with one job.
- Classify. The router makes a single decision: which handler fits. It reads “damaged” and “refund” and picks Refunds with high confidence.
- Route. The request goes to exactly one handler. The other two never run, so they cost nothing.
- Handle. Refunds has the prompt, tools and policy for exactly this case. Order 4417, damage confirmed, inside the 30-day window.
- Reply. The handler's answer goes back through the entry point. Unlike a handoff, it could not have sent the case anywhere else.
- Respond. Refund approved. One cheap classification let a focused prompt do the real work.
Outcome: correct answer. Separating “which kind of request is this” from “handle it” keeps every prompt short and specialised. The whole pattern is only as good as that first decision.
Failure mode
- Request arrives. Identical start to the normal run.
- Confidently wrong. The router keys on “arrived” and picks Shipping, at 91 percent confidence. A confidence threshold would not have caught this.
- Misroute. The decision is made once and nothing reviews it.
- The wrong specialist. Shipping answers the only question it knows. Was the parcel delivered? Yes, on 12 Sep. It has no refund tools and no way to say “not mine”.
- Reply. A correct answer to a question nobody asked.
- Incorrect response. The customer asked for a refund and is told the parcel arrived. Nothing failed technically; the request went to the wrong place, with no way back.
Failure: a confident misroute. One wrong classification decides the whole run. Mitigation: let handlers reject what is not theirs, keep a general fallback handler, and measure the router on real traffic rather than trusting its confidence.
Execution trace
Reference
- Problem
- Requests fall into distinct kinds, and one prompt that handles all of them is long, slow and mediocre at each.
- Analogy
- A switchboard operator connects each caller to one department and then leaves the line.
- Use when
- Request kinds are distinct and classification is reliable, so each kind can get its own prompt, tools and even model size.
- Avoid when
- Requests regularly span several kinds, or the categories blur into each other. A misroute has no recovery path.
- Typical failure
- Misrouting: one wrong classification sends the request to a handler that answers confidently within its own narrow scope.
- Also known as
- Routing (Anthropic)Conditional edges (LangGraph, related)
- Related patterns
- Handoff (alternative)
- Orchestrator–workers (alternative)
Space play or pause → next step ← previous step R reset F failure mode