> ## 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 Chain • Rust AI Agent SDK

> HandoffChain: Thread-safe handoff chain tracker.

# HandoffChain

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

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

Thread-safe handoff chain tracker.

## Fields

| Name    | Type                                         | Description |
| ------- | -------------------------------------------- | ----------- |
| `chain` | `std::sync::RwLock&lt;Vec&lt;String&gt;&gt;` | -           |

## Methods

### `new`

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

Create a new handoff chain

### `get`

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

Get current chain

### `depth`

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

Get current depth

### `push`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn push(&self, agent_name: impl Into<String>) -> ()
```

Push agent to chain

**Parameters:**

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

### `pop`

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

Pop agent from chain

### `contains`

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

Check if agent is in chain (cycle detection)

**Parameters:**

| Name         | Type   |
| ------------ | ------ |
| `agent_name` | `&str` |

### `clear`

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

Clear the chain

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-rust/praisonai/src/handoff/mod.rs#L442">
  `praisonai/src/handoff/mod.rs` at line 442
</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>
