Skip to main content
Sequential patterns in workflow architecture allow you to build multi-agent pipelines where agents execute in a predefined order. Each agent processes data and passes its output to the next agent in the chain.

Sequential Execution

In sequential patterns, agents execute one after another in a fixed order. You define explicit edges to control the flow:
Sequential patterns are ideal when you have a clear, linear workflow and want each agent to build on the previous agent’s output.

Core Concepts

Special Nodes

  • __start__ (or START): Entry point — first agent receives user input
  • __end__ (or END): Exit point — final agent’s output is returned to user
Both forms are accepted and normalized internally. You can use either __start__/__end__ or START/END in your YAML. Every workflow must have a path from __start__ to __end__.

Entry Point

The entry_point field specifies which agent runs first:
  • Agent name (e.g., "assistant"): An edge from __start__ to this agent is added automatically. You can still define an explicit __start__ → agent edge, but it’s not required.
  • "START": No automatic edge is created. You must define your own edge from __start__ (useful for conditional routing from start).

Passing Data Between Agents

Each agent in the sequence receives the previous agent’s output. You can access it in two ways: 1. Direct access (free-form text): The previous agent’s output is automatically available in the agent’s context. 2. Structured output (typed data): Define schemas for agent outputs and reference specific fields in subsequent agents.
Learn more about structured output: Structured Output →

Basic Sequential Chain

Single Agent Flow

Flow:

Sequential Chain with Structured Output

Using structured output for reliable data passing:
Flow:
The responder agent accesses the analyzer’s structured output using template variables: {{ analyzer.output.sentiment }}, {{ analyzer.output.confidence }}, etc.

Research → Analysis Pipeline

Multi-agent workflow where a ReAct agent uses tools to gather data with structured output, then an LLM agent analyzes the findings:
Flow:
The researcher agent uses tavily_search to gather data and outputs structured findings. The analyst agent then references {{ researcher.output.key_findings }} and other fields to generate insights.

When to Use Sequential Patterns

Use sequential patterns when:
  • You have a clear, linear workflow
  • Each step depends on the previous step’s output
  • You want type-safe data passing between agents
  • The execution order is predictable
For dynamic routing, see Supervisor Pattern → or Conditional Edges →

Best Practices

Use structured output for data dependencies: When an agent needs specific fields from a previous agent, define a schema to ensure type safety and validation.
Reference outputs explicitly: Use {{ agent_name.output.field }} in prompts to access structured data from previous agents.
Stream intermediate results: Set show_output_to_user: true on agents you want users to see during execution.
Every workflow must have a path from __start__ to __end__. Ensure all agents are reachable.
Set recursion_limit: For workflows with conditional edges that loop back, increase recursion_limit (default: 5) to allow enough iterations. Example: recursion_limit: 20.
Keep schemas simple: Start with basic types (str, int, float, bool) before using complex nested structures.

Advanced Patterns

For more complex routing logic:

Conditional Edges

Add dynamic routing based on agent output

Supervisor Pattern

Use intelligent task delegation instead of fixed edges

Common Use Cases

Pattern: Sequential chainResearch → Draft → Edit → PublishEach agent specializes in one stage of content creation.
Pattern: Sequential chain with toolsCollector (web search) → Analyzer (calculator) → Reporter (synthesis)Each agent uses specific tools for its task.
Pattern: Sequential with structured outputAnalyzer (structured output) → Responder (uses analyzer data)First agent produces typed data, second agent consumes it via template variables.
Pattern: Sequential with conditional edgesWriter → Reviewer → [Approve → Publish | Reject → Writer]Add conditional edges for dynamic routing based on quality checks.

Next Steps

Conditional Edges

Add dynamic routing to workflows

Supervisor Pattern

Learn about supervisor-based coordination

Agent Types

Understand different agent types for workflows

YAML Configuration

Complete reference for workflow configuration