Sequential Workflows

Pattern

Research Agent Chain

Sequential three-agent chain demonstrating structured outputs flowing between agents. Research Agent 1 gathers research, Expand Agent 2 expands research, Synthesis Agent 3 synthesizes final answer. Uses Exa tools and AI SDK 6's stabilized structured output support.

IntermediateNov 2025View the full pattern on desktop
Research Agent Chain preview

Problems solved

  • Chain research, expand, and synthesis agents in sequence
  • Pass structured previousOutput between agent stages
  • Use Exa tools during multi-phase research
  • Keep each phase focused instead of one monolithic agent

Use cases

  • Multi-phase research reports
  • Competitive research expansion pipelines
  • Synthesis briefs from staged agents
  • Teaching sequential agent workflows

AI SDK APIs

ToolLoopAgentcreateAgentUIStreamResponsetool(Output.objectstepCountIsprepareStepgatewayInferAgentUIMessage

Tags

aiagentschainai-sdkstructured-outputagent-chainexasequential-agentsresearchsynthesis

Requirements

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

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