Routing
Description
Routing is the pattern of classifying an incoming request and dispatching it to one of several specialized handlers, each optimized for a different region of the input space. The structural shape is classifier + handler-set + dispatch + shared output contract. The classifier inspects the request and chooses; the dispatch forwards; the chosen handler does the work; the caller sees a single endpoint and never learns which handler answered. The router earns its keep when classification is cheap relative to running every handler, when the handlers are genuinely specialized (so a generic single-handler would underperform), and when the shared output contract lets the router stay transparent. Routing is one of the five canonical agentic-workflow patterns named in Anthropic’s Building Effective Agents essay (Schluntz & Zhang 2024). It sits at a different fork than the catalog’s other Anthropic-essay siblings:prompt-chaining answers what order (sequential), parallel-vs-serial and orchestrator-workers answer how many at once (concurrency), evaluator-optimizer answers with what self-correction loop. Routing answers which one. The choice is between a small set of specialized branches, each tuned for its subset of inputs, with a classifier acting as the dispatching front door.
A useful reframe surfaces when routing is read against the catalog’s rivals-into-router specialization: routing is the parallelization mechanism for keeping rival options available. Without a router, choice between rival approaches is serial in a deeper sense than concurrency — you pick one and discard the other, foreclosing the alternative across all future requests. With a router, both rivals stay live in the system and dispatch picks which fires per request. The router converts a once-and-for-all “which approach?” decision into a per-request “which approach for this input?” decision — preserving optionality at the cost of carrying both implementations. This is structurally why routing scales as a design move: the cost of optionality is paid once (implement both), the benefit (match-the-handler-to-the-input) accrues per request.
Routing is the parent shape under which several existing catalog concepts specialize. rivals-into-router specializes routing to the proactive-rivals case where the handler-set is two genuinely-complementary approaches and the routing dimension is a gradient (cost, complexity, confidence). chain-of-responsibility specializes routing by deferring and distributing the classifier — instead of a central classifier naming the handler up front, the request walks an ordered chain and the first willing handler accepts. multi-hop-routing specializes routing by iterating it across a transit topology where each hop performs a local single-hop dispatch and no hop knows the full path. Each specialization preserves the classify-then-dispatch primitive and adds a domain-specific twist (rival-preservation, willingness-as-criterion, iterated-locality). Naming routing as a primitive lets these specializations participate explicitly in catalog structure-mapping, and gives other instances (HTTP request routing, IP forwarding, telephone-exchange dispatch, hospital triage, library call-number assignment) a parent to attach to without being forced into a more specific frame.
Triggers
User-initiated: User describes a system that classifies inputs and sends them to different specialists, asks “which handler should this go to?”, or frames a design as a dispatch problem. Vocabulary cues: “route,” “dispatch,” “classifier,” “triage,” “assign to,” “direct to,” “send to the right,” “handler selection,” “specialist,” “which one handles,” “maître d’,” “traffic director.” Agent-initiated: Agent observes a workload split across multiple specialized handlers with a classification step in front. Candidate inference: “what’s the classifier here — is it explicit and cheap, or is it expensive and hidden; do the handlers share an output contract; what fraction of misroutes is the system absorbing silently?” When the system has a more specific named specialization (rivals-into-router for proactive-rival dispatch; chain-of-responsibility for sequential-willingness dispatch; multi-hop-routing for iterated-transit dispatch), prefer the more specific concept; routing is the right fit when the structure is the single classify-then-dispatch shape itself without the specialization’s added semantics. Situation-shape signals: Front-door dispatching architectures (load balancers, API gateways, message brokers). Multi-tier support systems where intake classifies before assigning. Hospital triage and other priority/specialty-based intake. Telephone exchange / IVR menus. Cataloging or filing systems where incoming items are classified and routed to a section. Agentic systems where an LLM classifies user intent and dispatches to specialized sub-agents or tools.Exclusions
- One handler handles everything — when a single handler serves every request uniformly, there is no classification to perform and no dispatch decision to make. Routing requires ≥2 specialized handlers along with a discriminating signal in the input that picks among them. A “router” with one route is just a function call.
- Sequential propagation through every handler — when a request flows through every handler in turn (each transforming or augmenting it), the structure is pipeline / prompt-chaining, not routing. Routing’s defining property is the single classify-once-then-dispatch-once shape; if every handler runs, the classifier didn’t actually choose.
- Fan-out to all handlers in parallel — when the request is dispatched to every handler concurrently and results are aggregated, the structure is parallelization / orchestrator-workers, not routing. Routing picks one destination; parallelization picks all of them and merges.
- Classification cost dominates handler cost — when correctly classifying the input costs more than running every handler would, the router eliminates its own value proposition. The “if classify(x) is cheap and handlers are expensive, route; otherwise fan out or pick a default” tradeoff is what makes the routing pattern earn its keep in practice.
Structure
Relationships
- rivals-into-router — specialization of routing where the handler-set is two genuinely-rival approaches and the routing dimension is the gradient on which each is right. Adds the proactive keep-both-options-available framing; routing is the polarity-neutral parent.
- chain-of-responsibility — specialization of routing where the classifier is deferred and distributed across an ordered chain of handlers, each deciding “is this mine?” The willingness-as-routing-criterion semantics and the first-match-wins early termination distinguish it from front-door classified routing.
- multi-hop-routing — specialization of routing iterated across a transit topology. Each hop is a single routing decision; the routing decision is local (each hop knows only its neighbor); the full path emerges from composing many single-hop routings.
- parallel-vs-serial — sibling agentic-pattern naming the scheduling-axis choice (concurrency); routing names the destination-axis choice (which handler). They compose orthogonally in real systems.
- prompt-chaining — sibling agentic-workflow pattern from Anthropic’s “Building Effective Agents” essay. The pair compose at adjacent layers: a router may pick which chain to run; each chain step may itself be a router.
- orchestrator-workers — sibling agentic-pattern. Orchestrators often begin with a routing decision (which workers does this task need?), then make a parallelization decision (run them how?).
- shape — routing requires the handlers share an output contract; shape-alignment is what makes the router transparent to its caller.
Examples
Dewey, M. (1876). A Classification and Subject Index for Cataloguing and Arranging the Books and Pamphlets of a Library. Amherst, MA. Subsequent editions through DDC 23 (OCLC, 2011) maintained by OCLC's Dewey editorial team. · library-and-museum-studies
Dewey, M. (1876). A Classification and Subject Index for Cataloguing and Arranging the Books and Pamphlets of a Library. Amherst, MA. Subsequent editions through DDC 23 (OCLC, 2011) maintained by OCLC's Dewey editorial team. · library-and-museum-studies
Iversen, K. R. et al. (1990). "Major change in emergency department use." Annals of Emergency Medicine, 19(6): 666-670; institutional history of the Emergency Severity Index (ESI) developed by Eitel, Wuerz & colleagues at MCP-Hahnemann in the late 1990s. Modern protocol: Gilboy, N., Tanabe, P., Travers, D., & Rosenau, A. M. (2020). Emergency Severity Index (ESI): A triage tool for emergency department care, Version 4. AHRQ Publication No. 20-0046-2-EF. · medicine-and-health
Iversen, K. R. et al. (1990). "Major change in emergency department use." Annals of Emergency Medicine, 19(6): 666-670; institutional history of the Emergency Severity Index (ESI) developed by Eitel, Wuerz & colleagues at MCP-Hahnemann in the late 1990s. Modern protocol: Gilboy, N., Tanabe, P., Travers, D., & Rosenau, A. M. (2020). Emergency Severity Index (ESI): A triage tool for emergency department care, Version 4. AHRQ Publication No. 20-0046-2-EF. · medicine-and-health
Schluntz, E. & Zhang, B. (2024, December 19). "Building effective agents." Anthropic Engineering. https://www.anthropic.com/research/building-effective-agents · computer-science
Schluntz, E. & Zhang, B. (2024, December 19). "Building effective agents." Anthropic Engineering. https://www.anthropic.com/research/building-effective-agents · computer-science
Strowger, A. B. (1891). U.S. Patent No. 447,918, "Automatic Telephone Exchange." Filed March 12, 1889; issued March 10, 1891. Historical context: Brooks, J. (1976). Telephone: The First Hundred Years (Harper & Row). · engineering-and-technology
Strowger, A. B. (1891). U.S. Patent No. 447,918, "Automatic Telephone Exchange." Filed March 12, 1889; issued March 10, 1891. Historical context: Brooks, J. (1976). Telephone: The First Hundred Years (Harper & Row). · engineering-and-technology