Quick Start
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.
| Pattern | Use when |
|---|---|
| Sequential agents | Fixed pipeline (research → write → edit) |
route() | Branch on classifier output |
should_run | Skip steps based on context |
Configuration Options
| Option | Type | Default | Description |
|---|---|---|---|
steps | list | [] | Agents, Task, or handler functions |
process | str | "sequential" | "sequential" or "hierarchical" |
output | OutputConfig | None | Verbose, stream, and trace settings |
hooks | WorkflowHooksConfig | None | on_step_complete and lifecycle callbacks |
memory | MemoryConfig | None | Shared memory across steps |
Best Practices
Keep each step focused
Keep each step focused
One role per agent — research, analyse, write, edit. Narrow instructions produce cleaner hand-offs.
Use route for decisions
Use route for decisions
Put a classifier step before
route() rather than asking one agent to do everything.Enable hooks for visibility
Enable hooks for visibility
WorkflowHooksConfig(on_step_complete=...) logs progress without changing agent logic.Start with two steps
Start with two steps
Prove the pipeline with two agents, then add steps once data flow is clear.
Related
AgentFlow
Full workflow API and step types
Workflow Patterns
Parallel, loop, and conditional patterns

