> ## Documentation Index
> Fetch the complete documentation index at: https://agno-v2-docs-scavio-google-v2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# What are Workflows?

> Workflows orchestrate agents, teams, and functions through defined steps for repeatable tasks.

A Workflow orchestrates agents, teams, and functions through a defined control flow. Steps can run sequentially, in parallel, in loops, or conditionally based on results. Function steps can access all prior outputs through `StepInput`. Agent, team, and nested-workflow steps receive the most recent output as their input.

<img className="block dark:hidden" src="https://mintcdn.com/agno-v2-docs-scavio-google-v2/zonyHMB9lAdtp5bI/images/workflows-flow-light.png?fit=max&auto=format&n=zonyHMB9lAdtp5bI&q=85&s=25e2975e4ce0304b942ae89afe648471" alt="Workflows flow diagram" width="2994" height="756" data-path="images/workflows-flow-light.png" />

<img className="hidden dark:block" src="https://mintcdn.com/agno-v2-docs-scavio-google-v2/zonyHMB9lAdtp5bI/images/workflows-flow.png?fit=max&auto=format&n=zonyHMB9lAdtp5bI&q=85&s=49201756876d64beca07425714a90376" alt="Workflows flow diagram" width="2994" height="756" data-path="images/workflows-flow.png" />

## Your First Workflow

This workflow takes a topic, collects relevant HackerNews stories, and writes an article:

```python theme={null}
from agno.agent import Agent
from agno.workflow import Workflow
from agno.tools.hackernews import HackerNewsTools

researcher = Agent(
    name="Researcher",
    instructions="Find relevant information about the topic",
    tools=[HackerNewsTools()]
)

writer = Agent(
    name="Writer",
    instructions="Write a clear, engaging article based on the research"
)

content_workflow = Workflow(
    name="Content Creation",
    steps=[researcher, writer]
)

content_workflow.print_response("Write an article about AI trends", stream=True)
```

The agents use Agno's default OpenAI model. Install the dependencies and export your API key before running the example:

<Steps>
  <Step title="Install dependencies">
    ```bash theme={null}
    uv pip install -U agno openai
    ```
  </Step>

  <Step title="Export your OpenAI API key">
    <CodeGroup>
      ```bash Mac/Linux theme={null}
      export OPENAI_API_KEY="your_openai_api_key_here"
      ```

      ```powershell Windows theme={null}
      $Env:OPENAI_API_KEY="your_openai_api_key_here"
      ```
    </CodeGroup>
  </Step>
</Steps>

## When to Use Workflows

| Requirement                                         | Use                     |
| --------------------------------------------------- | ----------------------- |
| Fixed ordering, branches, loops, or parallel groups | Workflow                |
| Dynamic delegation among model-driven members       | [Team](/teams/overview) |

Workflow control flow is repeatable. Agent and team outputs can still vary between runs. Configure a database when you need persisted run records.

## Step Executors

A `Step` wraps exactly one executor:

| Executor     | Description                                                 |
| ------------ | ----------------------------------------------------------- |
| **Agent**    | Individual AI executor with specific tools and instructions |
| **Team**     | Coordinated group of agents for complex sub-tasks           |
| **Function** | Custom Python function for specialized logic                |
| **Workflow** | Nested workflow for composable, reusable sub-pipelines      |

The workflow's `steps` list also accepts `Steps`, `Parallel`, `Loop`, `Condition`, and `Router` containers. Agents, teams, functions, and nested workflows are auto-wrapped when passed directly.

## Controlling Workflows

Workflows support conditional logic, parallel execution, loops, and conversational interactions. See [Workflow patterns](/workflows/workflow-patterns/overview) and the guides below.

## Guides

<CardGroup cols={3}>
  <Card title="Build Workflows" icon="wrench" iconType="duotone" href="/workflows/building-workflows">
    Define steps, inputs, and outputs.
  </Card>

  <Card title="Run Workflows" icon="user-robot" iconType="duotone" href="/workflows/running-workflows">
    Execute workflows and handle responses.
  </Card>

  <Card title="Conversational Workflows" icon="comments" iconType="duotone" href="/workflows/conversational-workflows">
    Enable chat interactions on your workflows.
  </Card>
</CardGroup>

## Developer Resources

* [Workflow patterns](/workflows/workflow-patterns/overview)
* [Workflow examples](/examples/workflows/overview)
* [Workflow reference](/reference/workflows/workflow)
