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

> Handoff: Represents a handoff configuration for delegating tasks to another agent. Handoffs are represented as tools to the LLM, allowing agents to transfer...

# Handoff

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

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

Represents a handoff configuration for delegating tasks to another agent. Handoffs are represented as tools to the LLM, allowing agents to transfer control to specialized agents for specific tasks.

## Fields

| Name                        | Type                   | Description                      |
| --------------------------- | ---------------------- | -------------------------------- |
| `target_agent_name`         | `String`               | Target agent name                |
| `tool_name_override`        | `Option&lt;String&gt;` | Custom tool name override        |
| `tool_description_override` | `Option&lt;String&gt;` | Custom tool description override |
| `config`                    | `HandoffConfig`        | Handoff configuration            |

## Methods

### `new`

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

Create a new handoff to a target agent

**Parameters:**

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

### `tool_name`

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

Set custom tool name

**Parameters:**

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

### `tool_description`

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

Set custom tool description

**Parameters:**

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

### `config`

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

Set handoff configuration

**Parameters:**

| Name     | Type            |
| -------- | --------------- |
| `config` | `HandoffConfig` |

### `get_tool_name`

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

Get the tool name for this handoff

### `get_tool_description`

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

Get the tool description for this handoff

### `check_safety`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn check_safety(
        &self,
        _source_agent_name: &str,
        chain: &HandoffChain,
    ) -> Result<()>
```

Check safety constraints before handoff

**Parameters:**

| Name                 | Type            |
| -------------------- | --------------- |
| `_source_agent_name` | `&str`          |
| `chain`              | `&HandoffChain` |

### `prepare_context`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn prepare_context(
        &self,
        messages: Vec<serde_json::Value>,
        source_agent: &str,
        chain: &HandoffChain,
        extra_context: HashMap<String, serde_json::Value>,
    ) -> HandoffInputData
```

Prepare context data for handoff based on context policy

**Parameters:**

| Name            | Type                           |
| --------------- | ------------------------------ |
| `messages`      | `Vec&lt;serde_json::Value&gt;` |
| `source_agent`  | `&str`                         |
| `chain`         | `&HandoffChain`                |
| `extra_context` | `HashMap&lt;String`            |
| `serde_json`    | `:Value&gt;`                   |

## Source

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