Orchestration & Sub-Agents

Pattern

Sub-Agent Orchestrator

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.

IntermediateNov 2025View the full pattern on desktop
Sub-Agent Orchestrator preview

Problems solved

  • Implement a custom Agent that routes to specialized sub-agents
  • Pass typed options into research, analysis, and support agents
  • Return structured outputs from the orchestrator layer
  • Delegate queries without collapsing specialists into one prompt

Use cases

  • Multi-agent support systems
  • Research versus analysis routing
  • Custom Agent interface tutorials
  • Specialist delegation architectures

AI SDK APIs

ToolLoopAgentcreateAgentUIStreamResponsetool(Output.objectstepCountIsgatewayInferAgentUIMessage

Tags

aiagentsorchestratorai-sdkcustom-agentsub-agentsroutingoptionsstructured-output

Requirements

Node.js
24+
Memory
512MB
Other
  • OpenAI API key
  • Exa API key

Environment variables

External services

openaiexa

Ready to use?

View the full interactive pattern with live preview and copy the source code.

View the pattern on desktop

Related patterns