Agent Metrics
Overview
Your Agent keeps a single usage object that accumulates metrics over every run (do, print_do, stream, etc.). Use it to monitor total tokens, requests, tool calls, cost, and duration for that agent.
When printing is enabled, an Agent Metrics panel is shown after each task so you can see the updated totals.
What You Can Access
On anyAgent instance, use agent.usage. It is a RunUsage object (or None before the first run). After runs, you get:
| Metric | Meaning |
|---|---|
input_tokens | Total prompt tokens across all runs |
output_tokens | Total completion tokens across all runs |
requests | Number of LLM requests |
tool_calls | Number of tool calls executed |
cost | Estimated total cost (when available) |
duration | Total execution time (seconds) |
cache_read_tokens, reasoning_tokens, time_to_first_token) are available on the same object when the provider reports them.

