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

# Plan • Rust AI Agent SDK

> Plan: A plan consisting of multiple steps.

# Plan

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

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

A plan consisting of multiple steps.

## Fields

| Name          | Type                                  | Description       |
| ------------- | ------------------------------------- | ----------------- |
| `id`          | `String`                              | Plan ID           |
| `name`        | `String`                              | Plan name/goal    |
| `description` | `Option&lt;String&gt;`                | Plan description  |
| `steps`       | `Vec&lt;PlanStep&gt;`                 | Steps in the plan |
| `created_at`  | `chrono::DateTime&lt;chrono::Utc&gt;` | Created timestamp |
| `updated_at`  | `chrono::DateTime&lt;chrono::Utc&gt;` | Updated timestamp |
| `metadata`    | `HashMap&lt;String`                   | Plan metadata     |

## Methods

### `new`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn new(name: impl Into<String>) -> Self
```

Create a new plan.

**Parameters:**

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

### `description`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn description(mut self, desc: impl Into<String>) -> Self
```

Set description.

**Parameters:**

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

### `add_step`

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

Add a step.

**Parameters:**

| Name   | Type       |
| ------ | ---------- |
| `step` | `PlanStep` |

### `get_step`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn get_step(&self, id: &str) -> Option<&PlanStep>
```

Get step by ID.

**Parameters:**

| Name | Type   |
| ---- | ------ |
| `id` | `&str` |

### `get_step_mut`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn get_step_mut(&mut self, id: &str) -> Option<&mut PlanStep>
```

Get mutable step by ID.

**Parameters:**

| Name | Type   |
| ---- | ------ |
| `id` | `&str` |

### `completed_steps`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn completed_steps(&self) -> Vec<String>
```

Get completed step IDs.

### `next_step`

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

Get next ready step.

### `progress`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn progress(&self) -> f64
```

Get progress percentage.

### `is_complete`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn is_complete(&self) -> bool
```

Check if plan is complete.

### `has_failed`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn has_failed(&self) -> bool
```

Check if plan has failed.

### `step_count`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn step_count(&self) -> usize
```

Get step count.

## Source

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