Skip to main content
A SequentialWorkflow executes tasks in a strict order, forming a pipeline where each agent builds upon the work of the previous one. This architecture is ideal for processes that have clear, ordered steps and ensures that tasks with dependencies are handled correctly.

How Sequential Workflow Works

In a sequential workflow:
  1. Linear Execution: Agents execute tasks one after another in a defined order
  2. Output Chaining: The output of one agent becomes the input for the next agent
  3. Dependency Management: Ensures tasks with dependencies are handled correctly
  4. Sequential Processing: Each agent must complete before the next one starts

Basic Example: Researcher to Writer Pipeline

This example demonstrates a two-agent workflow for researching and writing a blog post:

How This Example Works

  1. Task Assignment: The initial task “The history and future of artificial intelligence” is sent to the first agent (Researcher)
  2. Research Phase: The Researcher agent processes the task and produces a detailed summary
  3. Handoff: The Researcher’s output automatically becomes the input for the Writer agent
  4. Writing Phase: The Writer agent takes the research summary and creates an engaging blog post
  5. Final Output: The workflow returns the final blog post from the Writer agent

Common Use Cases

SequentialWorkflow is ideal for:
  • Content Creation Pipelines: Research → Writing → Editing → Publishing
  • Data Processing: Collection → Cleaning → Analysis → Reporting
  • Software Development: Design → Implementation → Testing → Deployment
  • Document Processing: Extraction → Transformation → Validation → Storage
  • Report Generation: Data gathering → Analysis → Visualization → Summary

Variations

Three-Stage Content Pipeline

Add an editor to review and polish the content:

Multi-Step Data Processing

Process data through multiple transformation stages:

Code Development Pipeline

Build a complete software development workflow:

Best Practices

  1. Clear Agent Roles: Define specific, focused responsibilities for each agent
  2. Appropriate Ordering: Arrange agents in logical sequence based on task dependencies
  3. Detailed System Prompts: Provide clear instructions about input expectations and output format
  4. Error Handling: Consider what happens if an intermediate agent fails
  5. Pipeline Length: Keep workflows manageable; very long pipelines may benefit from breaking into sub-workflows

Key Benefits

  • Maintainability: Easy to understand and modify the workflow sequence
  • Reliability: Deterministic execution order ensures consistent results
  • Debugging: Simple to identify and fix issues at specific stages
  • Reusability: Individual agents can be reused in different workflows
  • Scalability: Easy to add or remove stages from the pipeline

Learn More