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

# Agent Flow • Rust AI Agent SDK

> AgentFlow: AgentFlow - Workflow definition with patterns Defines complex workflow patterns like Route, Parallel, Loop.

# AgentFlow

> Defined in the [**workflows**](../modules/workflows) module.

<Badge color="orange">Rust AI Agent SDK</Badge>

AgentFlow - Workflow definition with patterns Defines complex workflow patterns like Route, Parallel, Loop.

```mermaid theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#8B0000', 'primaryTextColor': '#fff', 'primaryBorderColor': '#710101', 'lineColor': '#189AB4', 'secondaryColor': '#189AB4', 'tertiaryColor': '#fff' }}}%%

graph LR
    input["Input Data"] --> agent["Agent: AgentFlow"]
    agent --> output["Output Result"]
    style agent fill:#8B0000,color:#fff
    style input fill:#8B0000,color:#fff
    style output fill:#8B0000,color:#fff
```

## Fields

| Name    | Type                  | Description |
| ------- | --------------------- | ----------- |
| `steps` | `Vec&lt;FlowStep&gt;` | -           |

## Methods

### `new`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn new() -> Self
```

Create a new workflow

### `step`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn step(mut self, step: FlowStep) -> Self
```

Add a step

**Parameters:**

| Name   | Type       |
| ------ | ---------- |
| `step` | `FlowStep` |

### `agent`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn agent(self, agent: Agent) -> Self
```

Add an agent step

**Parameters:**

| Name    | Type    |
| ------- | ------- |
| `agent` | `Agent` |

### `run`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
async fn run(&self, input: &str) -> Result<String>
```

Execute the workflow

**Parameters:**

| Name    | Type   |
| ------- | ------ |
| `input` | `&str` |

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-rust/praisonai/src/workflows/mod.rs#L313">
  `praisonai/src/workflows/mod.rs` at line 313
</Card>

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Rust Agent" icon="robot" href="/docs/rust/agent" />

  <Card title="Rust Overview" icon="book-open" href="/docs/rust/overview" />

  <Card title="Rust Quickstart" icon="rocket" href="/docs/rust/quickstart" />

  <Card title="Rust Installation" icon="download" href="/docs/rust/installation" />

  <Card title="Rust Autonomy" icon="wand-magic-sparkles" href="/docs/rust/autonomy" />
</CardGroup>
