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

# To Tool Function • AI Agent SDK

> to_tool_function: Convert this handoff to a tool function that can be called by the LLM.

# to\_tool\_function

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

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

Convert this handoff to a tool function that can be called by the LLM.

```mermaid theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#8B0000', 'primaryTextColor': '#fff', 'primaryBorderColor': '#710101', 'lineColor': '#189AB4', 'secondaryColor': '#189AB4', 'tertiaryColor': '#fff' }}}%%

graph LR
    agent["Agent"] -- "uses" --> tool["Tool: to_tool_function"]
    tool -- "returns" --> result["Result"]
    style tool fill:#189AB4,color:#fff
    style agent fill:#8B0000,color:#fff
    style result fill:#8B0000,color:#fff
```

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def to_tool_function(source_agent: 'Agent') -> Callable
```

## Parameters

<ParamField query="source_agent" type="Agent" required={true}>
  The agent that will be using this handoff
</ParamField>

### Returns

<ResponseField name="Returns" type="Callable">
  A callable function that performs the handoff
</ResponseField>

## Uses

* `time.time`
* `logger.info`
* `chat`
* `HandoffResult`
* `logger.error`
* `inspect.Parameter`
* `inspect.Signature`

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/agent/handoff.py#L563">
  `praisonaiagents/agent/handoff.py` at line 563
</Card>

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Tools Concept" icon="wrench" href="/docs/concepts/tools" />

  <Card title="Create Custom Tools" icon="plus" href="/docs/guides/tools/create-custom-tools" />

  <Card title="Tool Development" icon="code" href="/docs/tutorials/advanced-tool-development" />
</CardGroup>
