> ## 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.

# Workflow Context • Rust AI Agent SDK

> WorkflowContext: Workflow context passed between agents

# WorkflowContext

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

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

Workflow context passed between agents

## Fields

| Name        | Type                                  | Description                       |
| ----------- | ------------------------------------- | --------------------------------- |
| `variables` | `std::collections::HashMap&lt;String` | Variables available to all agents |
| `results`   | `Vec&lt;StepResult&gt;`               | Results from previous steps       |

## Methods

### `new`

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

Create a new empty context

### `set`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn set(&mut self, key: impl Into<String>, value: impl Into<String>) -> ()
```

Set a variable

**Parameters:**

| Name    | Type                      |
| ------- | ------------------------- |
| `key`   | `impl Into&lt;String&gt;` |
| `value` | `impl Into&lt;String&gt;` |

### `get`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn get(&self, key: &str) -> Option<&String>
```

Get a variable

**Parameters:**

| Name  | Type   |
| ----- | ------ |
| `key` | `&str` |

### `add_result`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn add_result(&mut self, result: StepResult) -> ()
```

Add a step result

**Parameters:**

| Name     | Type         |
| -------- | ------------ |
| `result` | `StepResult` |

### `last_result`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn last_result(&self) -> Option<&StepResult>
```

Get the last result

## Source

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

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Rust Workflows" icon="diagram-project" href="/docs/rust/workflows" />

  <Card title="Rust Agent Flow" icon="route" href="/docs/rust/agent-flow" />

  <Card title="Rust Agent Team" icon="users" href="/docs/rust/agent-team" />

  <Card title="Rust Process" icon="gears" href="/docs/rust/process" />

  <Card title="Rust Flow" icon="route" href="/docs/rust/flow" />
</CardGroup>
