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

# Workflows

> Workflows define how agents collaborate to accomplish complex, multi-step tasks. Learn how to design and optimize agent workflows.

## What is a Workflow?

A **Workflow** is a structured sequence of agent tasks connected by data flow and control logic. Workflows allow you to:

* Chain multiple agents together for complex tasks
* Define conditional branching based on agent outputs
* Run agents in parallel for faster execution
* Handle errors and retries automatically

***

## Workflow Structure

```mermaid theme={null}
graph LR
    A[Trigger] --> B[Research Agent]
    B --> C{Decision}
    C -->|Data Found| D[Data Agent]
    C -->|No Data| E[Web Search Agent]
    E --> D
    D --> F[Report Generator]
    F --> G[Output]

    style A fill:#9300FF,color:#fff
    style G fill:#00C853,color:#fff
```

### Components

> **Triggers**
>
> Events that start a workflow — API calls, schedules, webhooks, or manual activation.

> **Steps**
>
> Individual agent tasks within the workflow. Each step has an input, agent, and output.

> **Conditions**
>
> Branching logic based on step outputs. Route workflow execution based on results.

> **Outputs**
>
> The final deliverable — reports, notifications, API responses, or data updates.

***

## Defining a Workflow

```yaml theme={null}
name: Market Research Pipeline
trigger:
  type: api
  endpoint: /workflows/market-research

steps:
  - id: research
    agent: research-agent
    input:
      query: "{{ trigger.body.topic }}"
    config:
      max_sources: 10

  - id: analyze
    agent: data-agent
    depends_on: [research]
    input:
      data: "{{ steps.research.output }}"

  - id: report
    agent: report-generator
    depends_on: [analyze]
    input:
      analysis: "{{ steps.analyze.output }}"
      format: "pdf"

output:
  report: "{{ steps.report.output.url }}"
  summary: "{{ steps.analyze.output.summary }}"
```

***

## Execution Modes

**Sequential**

Steps execute one after another. Best for workflows where each step depends on the previous one.

```
Step 1 → Step 2 → Step 3 → Output
```

**Parallel**

Independent steps execute simultaneously. Reduces total execution time.

```
Step 1 ─┐
        ├→ Step 3 → Output
Step 2 ─┘
```

**Conditional**

Steps execute based on conditions evaluated from previous step outputs.

```
Step 1 → Condition ─┬→ Step 2a → Output A
                    └→ Step 2b → Output B
```

***

## Error Handling

Workflows include built-in error handling:

```yaml theme={null}
steps:
  - id: risky_step
    agent: external-api-agent
    retry:
      max_attempts: 3
      delay: 5s
      backoff: exponential
    on_failure:
      action: fallback
      fallback_step: manual_review
```

> [!TIP]
>
> Always define `on_failure` actions for steps that interact with external services. This ensures your workflow degrades gracefully instead of failing entirely.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.