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

# On Tool Call • AI Agent SDK

> on_tool_call: Called when a tool is invoked.

# on\_tool\_call

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

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

Called when a tool is invoked.

```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: on_tool_call"]
    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 on_tool_call(span_id: str, tool_name: str, args: Dict[str, Any], result: Any, latency_ms: Optional[float]) -> None
```

## Parameters

<ParamField query="span_id" type="str" required={true}>
  No description available.
</ParamField>

<ParamField query="tool_name" type="str" required={true}>
  No description available.
</ParamField>

<ParamField query="args" type="Dict" required={true}>
  No description available.
</ParamField>

<ParamField query="result" type="Any" required={true}>
  No description available.
</ParamField>

<ParamField query="latency_ms" type="Optional" required={false}>
  No description available.
</ParamField>

## Source

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