Loading preview…
Loading preview…
Custom Agent implementation demonstrating the Agent interface abstraction with an orchestrator that routes queries to specialized sub-agents (research, analysis, support). Shows options passing and structured outputs.
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, EXA_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
ToolLoopAgentcreateAgentUIStreamResponsetoolOutput.objectstepCountIsgatewayInferAgentUIMessageProviders
External services
app/sub-agent-orchestrator/page.tsxapp/sub-agent-orchestrator/layout.tsxapp/api/orchestrator/route.tscomponents/orchestrator-demo.tsxlib/orchestrator-agent.tslib/sub-agents.tslib/types.tsREADME.mdnpm packages
7
Registry components
lib/orchestrator-agent.tsThe orchestrator agent is the core of this pattern: it implements the Agent interface, routes queries to specialized sub-agents, and handles options and structured outputs. The UI and API route are repeatable; this file is what users need to recreate the block's functionality.
lib/sub-agents.tsThe sub-agents define the specialized agent implementations (research, analysis, support) that the orchestrator delegates to. Critical for recreating the multi-agent routing behavior.
Loading preview…
Early-bird pricing — limited time

Open on desktop for the interactive preview.
Custom Agent implementation demonstrating the Agent interface abstraction with an orchestrator that routes queries to specialized sub-agents (research, analysis, support). Shows options passing and structured outputs.