Loading preview…
Loading preview…
Route user queries to specialized AI agents based on context and intent. Includes dynamic agent selection, load balancing, and fallback handling.
Loading preview…
Requirements, wiring steps, and what this pattern adds to your project.
Pick how you want to pull this pattern in — then wire env vars and routes the same way.
Install from the preview toolbar
Copy the install command above and run it in your project — Pro patterns include a short-lived token.
Add environment variables to .env.local
OPENAI_API_KEY, PERPLEXITY_API_KEY, DEEPSEEK_API_KEY
Point client fetches at your API routes
Replace preview `/view/.../api/...` paths with `/api/...` in the installed files.
Customize the agent and tool files
Adapt prompts, tools, and stop conditions for your product — Copy for AI in the toolbar helps seed that work.
Run your dev server and open the pattern route
Install dependencies if needed, then start the app and verify responses.
AI SDK APIs
generateObjectstreamTextconvertToModelMessagesAgenttoolstepCountIsProviders
app/ai-agents-routing/page.tsxapp/ai-agents-routing/layout.tsxapp/api/routing-agent/route.tslib/ai-routing-types.tsnpm packages
6
Registry components
routing-agent/route.tsCore routing agent API route. Implements a 3-stage AI pipeline: (1) classifies user input via generateObject into support categories, (2) routes to specialized agent config with tailored system prompts, (3) selects model based on complexity. Uses createUIMessageStream with custom data parts for streaming classification metadata and agent info to the client.
lib/ai-routing-types.tsDefines the routing agent's type system: RoutingDataParts, RoutingMetadata, RoutingUIMessage, and agentConfigs map that maps 7 classification categories to agent configurations (task, icon, color, systemPrompt). Contains getAgentConfig() which resolves classification type to agent config.
Loading preview…
Early-bird pricing — limited time

Open on desktop for the interactive preview.
Route user queries to specialized AI agents based on context and intent. Includes dynamic agent selection, load balancing, and fallback handling.