> ## Documentation Index
> Fetch the complete documentation index at: https://docs.definable.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# What are Workflows?

> Workflows orchestrate agents through sequential, parallel, conditional, and iterative steps.

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.

```python theme={null}
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

| Type          | Behavior                                      | Use case                    |
| ------------- | --------------------------------------------- | --------------------------- |
| **Step**      | Executes a single agent, team, or callable    | Basic building block        |
| **Steps**     | Executes steps sequentially, chaining context | Linear pipelines            |
| **Parallel**  | Executes steps concurrently                   | Independent analyses        |
| **Loop**      | Repeats until end condition or max iterations | Iterative refinement        |
| **Condition** | If/else branching                             | Quality gates               |
| **Router**    | N-way dynamic routing                         | Classification and dispatch |

## Guides

<CardGroup cols={3}>
  <Card title="Build Workflows" icon="wrench" iconType="duotone" href="/workflows/building-workflows">
    Create workflows with composable step types.
  </Card>

  <Card title="Run Workflows" icon="play" iconType="duotone" href="/workflows/running-workflows">
    Execute workflows and access step results.
  </Card>
</CardGroup>

## Workflow Patterns

<CardGroup cols={3}>
  <Card title="Sequential" icon="arrow-right" href="/workflows/patterns/sequential">
    Linear step chains with context passing.
  </Card>

  <Card title="Parallel" icon="arrows-split-up-and-left" href="/workflows/patterns/parallel">
    Concurrent execution with result combination.
  </Card>

  <Card title="Conditional" icon="code-branch" href="/workflows/patterns/conditional">
    If/else branching based on step output.
  </Card>

  <Card title="Loop" icon="rotate" href="/workflows/patterns/loop">
    Iterative refinement with end conditions.
  </Card>

  <Card title="Router" icon="route" href="/workflows/patterns/router">
    Dynamic N-way routing by selector function.
  </Card>
</CardGroup>

## Resources

* [Workflow reference](/reference/workflows/workflow)
* [Workflow examples](/examples/workflows)
* [Teams](/teams/overview) for agent coordination without step structure
* [Agent overview](/agents/overview)
