Animation9 min

Routing

Classify first, then send to a specialized handler.

Routing puts a classifier in front of specialized handlers: one LLM call inspects each input, decides its category, and dispatches it down the matching branch. The payoff is separation of concerns — each branch's prompt is optimized for exactly one kind of request, without compromising the others.

The animation shows incoming support requests hitting a classifier diamond that stamps each one — refund, tech support, or general — and slides it down a colored branch to a prompt node specialized for that category. Notice that the branch nodes differ in size: routing is also the canonical cost pattern, sending easy queries to a small fast model and hard ones to a large model.

The critical moment is the misroute: a refund request stamped "tech support" lands in a handler with the wrong instructions, wrong knowledge, wrong tone — and produces visibly worse output. The whole pattern is only as good as its classifier, which is why routing fits when categories are genuinely distinct and classification is accurate enough to trust. The upside of that dependency: the classifier is a single, separately testable step — you can measure its accuracy on labeled examples before trusting it in production.