Skip to main content
Run agents in sequence — each step receives the previous step’s output.
The user submits one goal; each agent step passes its output to the next.

Quick Start

1

Simple Usage

Chain two agents with AgentFlow:
2

With Configuration

Add branching with route and step hooks:

How It Works

AgentFlow runs steps in order. Each agent’s reply becomes the next step’s input. Use route() for conditional paths, Task(should_run=...) to skip steps, or StepResult(stop_workflow=True) to exit early.

Configuration Options


Best Practices

One role per agent — research, analyse, write, edit. Narrow instructions produce cleaner hand-offs.
Put a classifier step before route() rather than asking one agent to do everything.
WorkflowHooksConfig(on_step_complete=...) logs progress without changing agent logic.
Prove the pipeline with two agents, then add steps once data flow is clear.

AgentFlow

Full workflow API and step types

Workflow Patterns

Parallel, loop, and conditional patterns