Skip to main content
Swarm Type: SequentialWorkflow

Overview

The SequentialWorkflow swarm type executes tasks in a strict, predefined order where each step depends on the completion of the previous one. This architecture is perfect for workflows that require a linear progression of tasks, ensuring that each agent builds upon the work of the previous agent. Key features:
  • Ordered Execution: Agents execute in a specific, predefined sequence
  • Step Dependencies: Each step builds upon previous results
  • Predictable Flow: Clear, linear progression through the workflow
  • Quality Control: Each agent can validate and enhance previous work

Architecture

Each agent runs only after the previous one finishes, and receives its output.

Use Cases

  • Document processing pipelines
  • Multi-stage analysis workflows
  • Content creation and editing processes
  • Data transformation and validation pipelines

API Usage

Basic SequentialWorkflow Example

Example Response:

Output Shape

Every swarm run is executed through a SwarmRouter with output_type forced to "dict" server-side (see api/swarm_completions.py), so output is a list of {"role": ..., "content": ...} conversation turns rather than a single string. For SequentialWorkflow specifically, there is exactly one turn per agent, in the same order as the agents array in the request — each agent’s content is generated after receiving the previous agent’s output as its input, so the list doubles as an execution trace of the pipeline.

Best Practices

  • Design workflows with clear dependencies between steps
  • Use for tasks that require sequential processing
  • Ensure each agent builds upon previous results effectively
  • Ideal for quality control and validation workflows