Agent routing

In multi-agent systems, incoming requests need to reach the right agent. Routing is the classifier that picks which agent to invoke based on the request. Get routing wrong and users talk to the wrong specialist.

Routing approaches

Rule-based

Hard-coded logic. If message contains "password" → auth agent. If contains "billing" → billing agent. Simple, fast, brittle.

LLM classifier

A lightweight LLM reads the request and emits a category. Flexible, handles novel phrasings. Costs one LLM call per route.

Embedding-based

Embed the request, find nearest agent by similarity to their capability description. Fast, doesn't require LLM call per route.

Hybrid

Rules for obvious cases, LLM fallback for ambiguous. Best balance of speed and accuracy.

Routing to multiple agents

Sometimes a request needs multiple specialists. Router can:

The "general" agent

Always have a fallback generalist agent for requests that don't match any specialist. Without one, unusual queries fall through the cracks.

Measuring routing quality