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

# Prepare Handoff • AI Agent SDK

> prepare_handoff: Prepare context for handoff between agents.

# prepare\_handoff

<div className="flex items-center gap-2">
  <Badge color="purple">Method</Badge>
</div>

> This is a method of the [**MultiAgentContextManager**](../classes/MultiAgentContextManager) class in the [**manager**](../modules/manager) module.

Prepare context for handoff between agents.

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def prepare_handoff(from_agent: str, to_agent: str, messages: List[Dict[str, Any]], policy: Optional[ContextPolicy]) -> List[Dict[str, Any]]
```

## Parameters

<ParamField query="from_agent" type="str" required={true}>
  Source agent ID
</ParamField>

<ParamField query="to_agent" type="str" required={true}>
  Target agent ID
</ParamField>

<ParamField query="messages" type="List" required={true}>
  Current messages
</ParamField>

<ParamField query="policy" type="Optional" required={false}>
  Override policy for this handoff
</ParamField>

### Returns

<ResponseField name="Returns" type="List[Dict[str, Any]]">
  Messages to pass to target agent
</ResponseField>

## Uses

* `get_agent_policy`
* `estimate_messages_tokens`

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/context/manager.py#L1043">
  `praisonaiagents/context/manager.py` at line 1043
</Card>

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Handoffs Concept" icon="hand-holding" href="/docs/concepts/handoffs" />

  <Card title="Handoffs Feature" icon="arrow-right-arrow-left" href="/docs/features/handoffs" />
</CardGroup>
