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

ActorLead agentWorker

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 time0.0 s
Tokens processed0
Estimated cost$0.000
Router confidence
0%
Illustrative values. They show proportions between patterns, not benchmarks.

All steps

Normal run

  1. Request arrives. Every request enters through the router. It is a small, fast model with one job.
  2. Classify. The router makes a single decision: which handler fits. It reads “damaged” and “refund” and picks Refunds with high confidence.
  3. Route. The request goes to exactly one handler. The other two never run, so they cost nothing.
  4. Handle. Refunds has the prompt, tools and policy for exactly this case. Order 4417, damage confirmed, inside the 30-day window.
  5. Reply. The handler's answer goes back through the entry point. Unlike a handoff, it could not have sent the case anywhere else.
  6. 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

  1. Request arrives. Identical start to the normal run.
  2. Confidently wrong. The router keys on “arrived” and picks Shipping, at 91 percent confidence. A confidence threshold would not have caught this.
  3. Misroute. The decision is made once and nothing reviews it.
  4. 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”.
  5. Reply. A correct answer to a question nobody asked.
  6. 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

Model workingSending a message

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

Space play or pause   next step   previous step  R reset   F failure mode