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

# Tool Call End • AI Agent SDK

> tool_call_end: Emit tool call end event.

# tool\_call\_end

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

> This is a method of the [**ContextTraceEmitter**](../classes/ContextTraceEmitter) class in the [**context\_events**](../modules/context_events) module.

Emit tool call end event.

```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: tool_call_end"]
    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 tool_call_end(agent_name: str, tool_name: str, result: Optional[str], duration_ms: float, error: Optional[str], cost_usd: float) -> None
```

## Parameters

<ParamField query="agent_name" type="str" required={true}>
  Name of the agent
</ParamField>

<ParamField query="tool_name" type="str" required={true}>
  Name of the tool called
</ParamField>

<ParamField query="result" type="Optional[str]" required={false}>
  Tool result (will be smart-truncated to preserve key info)
</ParamField>

<ParamField query="duration_ms" type="float" required={false} default="0.0">
  Duration in milliseconds
</ParamField>

<ParamField query="error" type="Optional[str]" required={false}>
  Error message if any
</ParamField>

<ParamField query="cost_usd" type="float" required={false} default="0.0">
  Cost in USD (e.g., 0.001 for internet search = 1 credit)
</ParamField>

## Uses

* `ContextEvent`
* `time.time`

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/trace/context_events.py#L545">
  `praisonaiagents/trace/context_events.py` at line 545
</Card>

***

## Related Documentation

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

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

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