Skip to main content
Workflows compose agents, teams, and callables into multi-step pipelines. Six composable step types let you build everything from linear chains to complex branching logic.
from definable.agent import Agent
from definable.agent.workflow import Workflow, Step

researcher = Agent(model="gpt-4o", instructions="You are a research specialist.")
writer = Agent(model="gpt-4o", instructions="You are a technical writer.")

workflow = Workflow(
    name="research-pipeline",
    steps=[
        Step(name="researcher", agent=researcher),
        Step(name="writer", agent=writer),
    ],
)

result = await workflow.arun("Write about quantum computing")
print(result.content)
Each step receives the previous step’s output as context automatically.

Step Types

TypeBehaviorUse case
StepExecutes a single agent, team, or callableBasic building block
StepsExecutes steps sequentially, chaining contextLinear pipelines
ParallelExecutes steps concurrentlyIndependent analyses
LoopRepeats until end condition or max iterationsIterative refinement
ConditionIf/else branchingQuality gates
RouterN-way dynamic routingClassification and dispatch

Guides

Build Workflows

Create workflows with composable step types.

Run Workflows

Execute workflows and access step results.

Workflow Patterns

Sequential

Linear step chains with context passing.

Parallel

Concurrent execution with result combination.

Conditional

If/else branching based on step output.

Loop

Iterative refinement with end conditions.

Router

Dynamic N-way routing by selector function.

Resources