> ## Documentation Index
> Fetch the complete documentation index at: https://agno-v2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Tool Call Metrics

> Demonstrates tool execution timing metrics.

Demonstrates tool execution timing metrics. Each tool call records start\_time, end\_time, and duration.

```python tool_call_metrics.py theme={null}
"""
Tool Call Metrics
=============================

Demonstrates tool execution timing metrics.
Each tool call records start_time, end_time, and duration.
"""

from agno.agent import Agent
from agno.models.openai import OpenAIChat
from agno.tools.yfinance import YFinanceTools
from rich.pretty import pprint

# ---------------------------------------------------------------------------
# Create Agent
# ---------------------------------------------------------------------------
agent = Agent(
    model=OpenAIChat(id="gpt-5.6-luna"),
    tools=[YFinanceTools()],
    markdown=True,
)

# ---------------------------------------------------------------------------
# Run Agent
# ---------------------------------------------------------------------------
if __name__ == "__main__":
    run_output = agent.run("What is the stock price of AAPL and NVDA?")

    # Run-level metrics show total tokens across all model calls
    print("=" * 50)
    print("RUN METRICS")
    print("=" * 50)
    pprint(run_output.metrics)

    # Each tool call in the run carries its own timing metrics
    print("=" * 50)
    print("TOOL CALL METRICS")
    print("=" * 50)
    if run_output.tools:
        for tool_call in run_output.tools:
            print(f"Tool: {tool_call.tool_name}")
            if tool_call.metrics:
                pprint(tool_call.metrics)
            print("-" * 40)

    # Per-model breakdown from details
    print("=" * 50)
    print("MODEL DETAILS")
    print("=" * 50)
    if run_output.metrics and run_output.metrics.details:
        for model_type, model_metrics_list in run_output.metrics.details.items():
            print(f"\n{model_type}:")
            for model_metric in model_metrics_list:
                pprint(model_metric)
```

## Run the Example

<Snippet file="create-venv-step.mdx" />

**1. Install dependencies**

```bash theme={null}
uv pip install -U agno openai yfinance
```

**2. Export your OpenAI API key**

```bash Mac/Linux theme={null}
export OPENAI_API_KEY="your_openai_api_key_here"
```

```bash Windows theme={null}
$Env:OPENAI_API_KEY="your_openai_api_key_here"
```

**3. Run the example**

Save the code above as `tool_call_metrics.py`, then run:

```bash theme={null}
python tool_call_metrics.py
```

Full source: [cookbook/02\_agents/14\_advanced/tool\_call\_metrics.py](https://github.com/agno-agi/agno/blob/v3.0.4/cookbook/02_agents/14_advanced/tool_call_metrics.py)


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