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

> handoff_to: Programmatically hand off a task to another agent.

# handoff\_to

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

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

Programmatically hand off a task to another agent.

This is the unified programmatic handoff API that replaces delegate().
It uses the same Handoff mechanism as LLM-driven handoffs but can be
called directly from code.

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def handoff_to(target_agent: 'Agent', prompt: str, context: Optional[Dict[str, Any]], config: Optional['HandoffConfig']) -> 'HandoffResult'
```

## Parameters

<ParamField query="target_agent" type="Agent" required={true}>
  The agent to hand off to
</ParamField>

<ParamField query="prompt" type="str" required={true}>
  The task/prompt to pass to target agent
</ParamField>

<ParamField query="context" type="Optional" required={false}>
  Optional additional context dictionary
</ParamField>

<ParamField query="config" type="Optional" required={false}>
  Optional HandoffConfig for advanced settings
</ParamField>

### Returns

<ResponseField name="Returns" type="'HandoffResult'">
  HandoffResult with response or error
</ResponseField>

## Usage

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
result = agent_a.handoff_to(agent_b, "Complete this analysis")
    if result.success:
        print(result.response)
```

## Uses

* `Handoff`
* `HandoffConfig`
* `handoff_obj.execute_programmatic`

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/agent/agent.py#L2333">
  `praisonaiagents/agent/agent.py` at line 2333
</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>
