Router Based Agents
A router system lets your AI handle complex user queries by splitting work across multiple sub-agents.
Instead of a single, overloaded model doing everything, the router decides who should do what — like a manager assigning tasks to specialists.
Think of it as a brain with a team:
the brain understands intent, then delegates to the right experts.
Why Routers Matter
Routers make AI systems feel instant, structured, and reliable — even when queries are messy or multi-part.
For example:
"Show me sales this month and our best-selling products."
Here's what happens behind the scenes:
- Router detects intents → "sales" and "analytics"
- Two sub-agents spin up: one for Orders, one for Analytics
- Both work in parallel
- Results stream in as a sales table and a top-products chart
The user just sees an instant, visual answer.
But under the hood, multiple agents cooperated in perfect sync.
How It's Structured
A router-based system typically has four layers:
- 🧭 Router Layer – understands intent and assigns work
- 🤖 Sub-Agent Layer – each agent handles one domain (Orders, Inventory, etc.)
- 🧠 Data & Cache Layer – validates, caches, and returns clean data
- ⚡ Streaming Output – combines text and visuals for real-time answers
Design Principles
This architecture is simple but powerful because:
- Each agent has a small, static toolset (3–7 tools) → predictable behavior
- The router is a light LLM call → fast, cheap, low latency
- Agents can run in parallel or sequence → handles multi-intent queries smoothly
- Everything streams live → text + charts + KPIs appear instantly
The result is a system that feels conversational, but is actually deeply structured and deterministic inside.
Example: Ecommerce Assistant
Let's say you're building an AI for an ecommerce platform.
When a user asks:
"What's our average order value this month, and how's our stock for top sellers?"
Your router detects two domains:
- Orders → for sales metrics
- Inventory → for stock levels
Two sub-agents run side-by-side.
They pull data, compute KPIs, and stream the answer as a summary + charts — all within seconds.
That's the power of a router system.
Getting Started
Ready to build your own router system? Start with these guides:
- Router Layer - How to build the routing logic
- Sub-Agent Layer - Creating specialized agents
- Data Cache Layer - Optimizing data access
- Scaling - Growing your system
- Streaming Output - Real-time user experience
Next Steps
- Router Layer → - Build the routing logic
- AI Elements - UI components for agent interfaces
- Building Agents - Core agent development