Skip to main content
computer-science engineering-and-technology library-and-museum-studies medicine-and-health

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

Internal structure of routing: a table of its component slots and the concepts that fill them. The classifier is the front-door decision-maker — the maître d’ looking at the party, the triage nurse reading the chief complaint, the BGP router consulting its forwarding table, the LLM classifying user intent into “billing question” vs “technical issue” vs “feature request.” The classifier’s fidelity sets the upper bound on the router’s quality: a perfectly-tuned handler-set is wasted behind a noisy classifier that routes requests to the wrong specialists. The classifier may be a lookup table, a learned model, an explicit rule cascade, a human dispatcher, or any combination — the structural role is “inspect the input and name a handler.” The handler-set is the collection of specialized destinations. Each handler is tuned for a particular slice of the input space — a request-type, an intent class, a complexity level, a geographic region, a customer tier. The set must be exhaustive enough to cover the input distribution (or admit a default handler for the residue) and disjoint enough that each request has a single clear best handler. When the handler-set is poorly disjointed, the classifier is forced into close calls that increase misroute rates; when it’s poorly exhaustive, requests fall off the end with no defined behavior. The dispatch is the forwarding mechanism — structurally simple, but carrying the transparency commitment that defines the routing pattern: callers see a single endpoint and remain unaware of which handler answered. The shared output contract is the structural feature that makes transparency possible. Without it, the router devolves into a fork in the API (different handlers produce different result types; callers must track which one ran). With it, the router consolidates a heterogeneous handler-set behind a single interface, and the architecture can swap handlers, add specializations, or retire underused branches without disturbing callers.

Relationships

Relationship neighborhood of routing: a graph of the concepts it connects to and the concepts it is a part of.
  • 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

Melvil Dewey’s 1876 Decimal Classification (DDC) is a routing system disguised as a numbering scheme. Each book entering a library is classified into one of ten top-level classes (000 Computer science and information; 100 Philosophy; 200 Religion; 300 Social sciences; 400 Language; 500 Pure science; 600 Technology; 700 Arts; 800 Literature; 900 History and geography), then progressively into a hundred divisions and a thousand sections, with decimal extensions for further specificity. The resulting call number determines where the book is physically shelved — the dispatch step — and the shelf neighborhood becomes the “handler” that hosts the book alongside structurally similar peers. Patrons browsing the 510s find mathematics; staff retrieving a request find the right shelf because the call number named it directly; a new acquisition takes its place in the routing without disturbing what’s already shelved.The structural commitments are routing’s commitments. The classifier (a cataloger applying DDC rules, increasingly with computational assist) inspects the book — subject, intended audience, primary discipline — and emits a single call number. The handler-set is the shelf neighborhoods; each is specialized for a slice of subject-space and optimized for browsing within that slice (related works clustered, complementary references at hand). The shared output contract is the consistent shelving discipline: every neighborhood arranges books in call-number order, signed identically, retrievable by the same lookup process — so the patron’s interface is uniform regardless of which neighborhood they’re browsing. The cataloger may revisit a classification when conventions shift (the 1965 expansion of computing from 510 into 001/004; the ongoing re-shelving of LGBTQ+ subjects out of 306.7 pathologizing-adjacent categories), but the routing primitive itself remains stable.Inference: DDC demonstrates routing’s classifier-is-a-worldview failure mode. The classification scheme is not a neutral algorithm — it encodes the cataloger’s (and the era’s) judgment about which subjects are central, which are peripheral, and how they relate. The DDC’s well-documented Western and Christian bias in the religion (200) and language (400) classes (Christianity gets 230-280 — eight of ten divisions; everything else compressed into 290) is a routing decision baked into the classifier that determines what’s findable, what’s neighborhood-adjacent, and what’s structurally hidden. Any routing system whose classifier reflects a worldview (HTTP routing tables encoding network topology, ML classifiers encoding training-distribution biases, support-ticket routers encoding category schemas that lag the product) inherits this risk: the routing decisions persist past the worldview that produced them, and re-classifying at scale is expensive enough that the legacy routing often outlives its rationale.

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

Emergency department triage is the medical canonical instance of routing. When a patient arrives at the ED, a triage nurse performs a brief structured assessment — chief complaint, vital signs, mental status, and a small set of acuity-discriminating questions — then assigns the patient to one of five ESI levels (1 = immediate resuscitation; 5 = nonurgent). The ESI level is the classifier’s output; the dispatch sends Level 1 patients straight to the trauma bay, Level 2 to a high-acuity bed within ten minutes, Level 3 to standard ED workup, Level 4 to fast-track urgent care, and Level 5 to a discharge-or-redirect pathway. Every downstream destination operates on the same patient-record contract — different teams, different bed types, different time targets, but a single integrated record that the downstream handlers all read and write against.The structural commitments are exactly the routing primitive’s commitments. The classifier (triage nurse + ESI protocol) is cheap relative to the handlers (full ED workup, trauma resuscitation, urgent-care visit) — a few minutes of structured assessment routes the patient toward hours of correctly-specialized care. The handlers are genuinely specialized: a trauma bay’s staffing, equipment, and protocols would be wasted on a Level 5 patient, and a fast-track urgent-care visit would be catastrophic for a Level 1. The shared output contract (the unified patient record, the consistent disposition-and-discharge process) keeps the system transparent to its downstream consumers: the discharge planner, the billing system, the quality-review process all see “ED patient with disposition X” regardless of which pathway the patient traveled.Inference: triage demonstrates the failure modes routing is sensitive to. Under-triage (classifying a critically ill patient as low-acuity) is the misroute that kills people; the ESI literature documents both the rate and the mechanisms, and the protocol’s structure (mandatory vital-signs check at certain decision points, explicit “high-risk situation” flags) is designed to make under-triage harder to do. Over-triage (classifying a low-acuity patient as high-acuity) is the misroute that wastes scarce resources; protocols deliberately accept some over-triage to drive under-triage toward zero, trading classifier specificity for sensitivity. The asymmetric cost of routing errors — which routing-pattern designers in any domain (telephone exchanges, load balancers, LLM intent classifiers) face in some form — is a load-bearing design consideration the medical literature has worked out in unusual detail.
Anthropic’s “Building effective agents” essay names routing as one of five canonical workflow patterns for LLM-built systems. The essay’s description: a classification step inspects an incoming request and dispatches it to a specialized downstream prompt or tool — different inputs are handled by different specialists rather than being squeezed through a single generalist prompt. The essay’s worked example is a customer-support system whose intake LLM classifies tickets as general questions, refund requests, or technical issues, then routes each class to a tuned downstream agent (different prompt, different tools, different model where useful). The same pattern recurs across the essay’s other use-cases: routing easy questions to a cheap small model and hard ones to a capable expensive model is the cost-cascade specialization; routing different intents to different toolsets is the handler-specialization specialization.The essay’s framing makes the value proposition explicit: routing is the right pattern when the input distribution has distinct categories that benefit from specialized handling AND when classification is cheap enough that doing it up front beats running every handler on every input. When categories are blurry, when classification is expensive relative to handlers, or when the gains from specialization are small, routing’s overhead exceeds its benefit and a single generalist handler is preferable. The essay positions routing as a primitive that composes with the other four workflows — a chain may start with a router; an orchestrator’s first step is often routing-shaped; an evaluator-optimizer’s evaluator may route based on its judgment.Inference: the Anthropic essay is the load-bearing citation for routing as a named agentic-workflow primitive in the post-LLM era. The structural shape it describes is identical to the half-century-older instances catalogued elsewhere here (telephone exchanges, hospital triage, library cataloging) — what the essay contributes is bringing the pattern into the agentic-design vocabulary so that LLM-system architects can reach for it by name rather than reinventing it ad hoc. The catalog’s role is to make the cross-domain reuse explicit: when you reach for routing in an agentic system, you’re inheriting design lessons from every other domain where the pattern has been worked out.
Almon Strowger’s 1891 patent on the automatic telephone exchange ended the era of human-operator routing. Before Strowger, every call passed through a manual switchboard: a subscriber lifted the receiver, an operator answered, the subscriber named the wanted party, and the operator physically connected the two lines with a patch cord. Strowger’s electromechanical “step-by-step” switch — motivated, by his own account, by suspicion that the local Kansas City operators were favoring a competing undertaker — replaced the operator with a stepping mechanism that climbed and rotated through a 10×10 contact matrix in response to dial pulses. Each digit dialed advanced the switch to a row or column position; the final position bound the calling line to one specific destination line in the bank.The exchange is a textbook routing primitive. The dialed digits are the classifier’s input; the stepping mechanism is the classifier (decoding the digit sequence into a position on the contact matrix); the 10×10 bank of destination lines is the handler-set; the patch made at the final position is the dispatch. The shared output contract is the consistent telephone-circuit interface — every destination line in the bank presents the same audio-electrical contract back to the caller, so the calling subscriber’s experience is uniform whether the call lands at a doctor, a corner grocer, or a rival undertaker. The exchange scales by hierarchical composition: local exchanges route within their prefix; long-distance toll switches route between exchanges; international gateways route between country codes. The hierarchy is the multi-hop-routing specialization of the single-exchange routing primitive — each hop is one local routing decision, the full path emerges from composing many.Inference: Strowger demonstrates routing’s classifier-is-the-bottleneck failure mode and its mechanical solution. The manual-operator era’s vulnerability was that the classifier (the human operator) could be slow, biased, or saboteur — Strowger’s specific grievance was the third. The electromechanical classifier removed the human bias channel (every dialed sequence routed identically regardless of who called whom) while also massively scaling throughput. The pattern recurs: when a routing system’s classifier is a single human, it becomes the system’s reliability, performance, and integrity bottleneck; automating the classifier (lookup table, learned model, deterministic protocol) decouples the classifier’s quality from the operator’s mood. The flip side is the cost: an automatic classifier can only route on the signals encoded in its input, so any nuance the human caught implicitly (panicked voice → emergency operator) must be re-encoded explicitly (911, then later E911 location data).