AI Routing
Directing user requests or subtasks to the most appropriate AI model or agent based on task requirements.
Also known as: Model Routing, AI Agent Routing
Category: AI
Tags: ai, ai-agents, architectures, optimization
Explanation
AI Routing is the practice of directing different tasks to different AI models or agents based on the task's requirements. Instead of using one model for everything, a routing layer selects the most appropriate destination considering capability, cost, speed, and context needs.
## Model routing
Model routing directs tasks to the right model. A simple classification (or even a smaller, faster model) decides whether a task needs a powerful reasoning model or can be handled by a faster, cheaper one. Subagents naturally implement this: the parent agent uses a premium model while subagents can run on lighter models for routine tasks like code review or file exploration.
**Routing criteria:**
- **Task complexity**: simple lookups vs. multi-step reasoning
- **Latency requirements**: real-time responses vs. background processing
- **Cost sensitivity**: high-volume tasks benefit from cheaper models
- **Context length**: some tasks need large context windows, others don't
- **Specialization**: some models excel at code, others at creative writing or analysis
## Agent routing
Agent routing maps user intent to the appropriate agent or team. It determines which agent handles a given request, ensuring the right expertise is applied to the right problem.
Effective routing uses two tiers:
- **Tier 1: Lightweight hints** - A routing table maps common domains to agents. Covers obvious cases without loading additional context. Costs almost zero tokens.
- **Tier 2: Dynamic receptionist** - For ambiguous requests, a full receptionist skill loads, reads the agent registry, classifies intent, and routes dynamically. More expensive but more accurate.
## Trade-offs
The key trade-off is routing accuracy. Misrouting a complex task to a cheap model produces bad output. Misrouting a simple task to an expensive model wastes money. Getting this right requires observability to track quality per model per task type.
Routing is the first major context engineering decision in any multi-agent session. The choice of which agent to activate determines which context gets loaded. Good routing keeps context lean and relevant.
Related Concepts
← Back to all concepts