Intent Routing at Scale: The Production Architecture That Replaces a Naive Prompt
Agent systems that route user requests to dozens or hundreds of backend skills are becoming the default architecture for enterprise copilots. The naive prompt approach burns budget and silently routes errors; the layered routing pattern described here is the difference between a hackathon demo and a system that survives contact with real users.
The demo approach to agent intent recognition — stuffing all intent descriptions into a single prompt — collapses under real-world loads. Token costs explode linearly with intent count, accuracy degrades as similar intents blur together, and a single misclassification gets routed straight into the wrong agent with no safety net.
A production-grade design replaces that flat prompt with a three-layer pipeline. Deterministic rules catch obvious requests for free. Embedding-based semantic recall narrows hundreds of intents to a top-5 candidate set, slashing the prompt size the LLM must process. The LLM then fine-ranks only those candidates and returns a confidence score. When confidence is low, the system does not guess — it asks the user to clarify, preventing silent misroutes.
Beyond the routing logic itself, a maintainable system needs full traceability of every decision, an observability dashboard tracking latency, token burn, and clarify rates, an offline evaluation loop built from sampled production traces, and a golden benchmark dataset that gates every prompt or model change with a regression test.
Most agent intent-recognition advice stops at the prompt, but the real engineering is in the routing architecture that sits in front of the LLM — rule matching and embedding recall do the heavy lifting so the model only sees a handful of candidates.
The clarify step is under-discussed. Refusing to guess on low-confidence classifications and instead asking the user turns a silent failure mode into a recoverable interaction, which is essential for any agent that triggers side effects.
Observability for LLM pipelines is still immature. The metrics proposed here — clarify rate, token burn per request, embedding vs. LLM latency split — are a practical starting point that most agent frameworks do not yet expose natively.
Treating intent routing as a continuous-evaluation problem rather than a one-time prompt-engineering task is the dividing line between a prototype and a system that can be safely iterated on by a team.
Originally the main agent is meant for intent recognition, which essentially vectorizes the user's input, and the prompt is also vectorized for semantic similarity. So if I add another intent-recognition agent on top of the main agent and then filter the top-k, isn't that essentially doing the same thing as your recognition? I have an idea that true governance should be layered, not just filtering top-k. The abstraction level of agents at each layer is different. For example: The boss agent wants to build a shopping website → will find a project manager agent (whose capabilities are exposed within the boss agent) → the project manager will find the product agent, dev lead agent, and QA agent. The dev lead will then find the frontend agent and backend agent. The boss is unaware of the existence of the frontend and backend agents.