Agent Systems: Router Pattern

Figure

Router pattern

Figure: an abstract routing decision selects one interchangeable handler while preserving a common result contract.

In one sentence. Send each request to the handler suited to it while preserving one result contract, so that specialization does not fragment the interface.

Problem

One general agent is rarely the best implementation for every task class. A retrieval question, a code execution request, and a proof critique need different tools, prompts, or levels of reasoning.

Intent and structure

request → classify → specialized path → common output

The router may be a deterministic rule, a small classifier, or a model-based decision. The downstream paths should converge on a common result schema.

Stable interface

Make the routing label, confidence or rationale, selected capability, and fallback behavior explicit. The router must not silently discard a request it cannot classify.

Mathematical example

A research assistant can route a request to definition lookup, theorem search, example construction, proof checking, or exposition. The output should state which route was used and what evidence supports it.

Those are application examples, not elements of the abstract pattern. The pattern itself only assumes a request, a routing decision, interchangeable handlers, and a shared result contract.

Forces and failure modes

Routing reduces prompt complexity and allows specialization, but misclassification can be worse than using a general path. Use an abstain or human-escalation path, monitor route distributions, and test boundary cases.

Real-world application

Customer support is a direct use: billing, technical, and account requests have different tools and owners, while the caller still expects one response contract. Low-confidence or high-risk cases should route to a human queue.

Reference basis

The pattern is Gulli, Agentic Design Patterns, Chapter 2. It is also treated as a routing workflow in Anthropic’s engineering guide and as model routing, tiered orchestration, and intent routing in Mitra, System Design for the LLM Era, Chapters 2 and 6.