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

Method

> This is a method of the [**ContextTraceEmitter**](https://praison.ai/docs/sdk/reference/praisonaiagents/classes/ContextTraceEmitter.md) class in the [**context\_events**](https://praison.ai/docs/sdk/reference/praisonaiagents/modules/context_events.md) 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

**agent\_name** `str` *required*

Name of the agent

**tool\_name** `str` *required*

Name of the tool called

**result** `Optional[str]`

Tool result (will be smart-truncated to preserve key info)

**duration\_ms** `float` (default: 0.0)

Duration in milliseconds

**error** `Optional[str]`

Error message if any

**cost\_usd** `float` (default: 0.0)

Cost in USD (e.g., 0.001 for internet search = 1 credit)

## Uses

* `ContextEvent`
* `time.time`

## Source

> [card] [View on GitHub](https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/trace/context_events.py#L869)
>
> `praisonaiagents/trace/context_events.py` at line 869

***

## Related Documentation

> [card] [Tools Concept](https://praison.ai/docs/docs/concepts/tools)

> [card] [Create Custom Tools](https://praison.ai/docs/docs/guides/tools/create-custom-tools)

> [card] [Tool Development](https://praison.ai/docs/docs/tutorials/advanced-tool-development)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.