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

# Handoff Result • Rust AI Agent SDK

> HandoffResult: Result of a handoff operation.

# HandoffResult

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

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

Result of a handoff operation.

## Fields

| Name               | Type                   | Description                        |
| ------------------ | ---------------------- | ---------------------------------- |
| `success`          | `bool`                 | Whether the handoff succeeded      |
| `response`         | `Option&lt;String&gt;` | Response from target agent         |
| `target_agent`     | `Option&lt;String&gt;` | Name of the target agent           |
| `source_agent`     | `Option&lt;String&gt;` | Name of the source agent           |
| `duration_seconds` | `f64`                  | Duration of the handoff in seconds |
| `error`            | `Option&lt;String&gt;` | Error message if failed            |
| `handoff_depth`    | `usize`                | Handoff depth at completion        |

## Methods

### `success`

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

Create a successful result

**Parameters:**

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

### `failure`

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

Create a failed result

**Parameters:**

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

### `with_target`

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

Set target agent

**Parameters:**

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

### `with_source`

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

Set source agent

**Parameters:**

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

### `with_duration`

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

Set duration

**Parameters:**

| Name      | Type  |
| --------- | ----- |
| `seconds` | `f64` |

### `with_depth`

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

Set handoff depth

**Parameters:**

| Name    | Type    |
| ------- | ------- |
| `depth` | `usize` |

## Source

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

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Rust Handoffs" icon="arrow-right-arrow-left" href="/docs/rust/handoffs" />

  <Card title="Rust A2A" icon="arrows-left-right" href="/docs/rust/a2a" />
</CardGroup>
