Routing & Classification





Pattern
Agent Routing Pattern
Route user queries to specialized AI agents based on context and intent. Includes dynamic agent selection, load balancing, and fallback handling.
IntermediateOct 2025View the full pattern on desktop


Problems solved
- Classify support queries into specialized agent categories
- Route each query to a tailored agent system prompt
- Select models by query complexity before streaming a reply
- Stream classification metadata to the client as custom data parts
- Fall back across OpenAI, Perplexity, and Deepseek providers
Use cases
- Customer support desks that route by intent
- Multi-department help centers
- Sales and billing inquiry triage
- Technical support chat with specialist agents
- Intent-based agent orchestration demos
AI SDK APIs
generateObjectstreamTextconvertToModelMessagesnew Agenttool(stepCountIs
Tags
aiagentsroutingai-sdk
Requirements
- Node.js
- 24+
- Memory
- 512MB
- Other
- OpenAI API key
- Perplexity API key (optional)
- Deepseek API key (optional)
External services
openaiperplexitydeepseek
Ready to use?
View the full interactive pattern with live preview and copy the source code.
View the pattern on desktopRelated patterns


Multi-Step Tool Pattern
Execute multi-step workflows with typed tools. Includes streaming, tool chaining, and decision-making for automated tasks.
aiagents+8
View pattern β


HIL Inquire Text Input
Gather detailed information through AI-driven text input questions. Includes approval workflows and real-time rendering.
aihuman-in-the-loop+9
View pattern β



