Skip to main content
ClassUsed OnPurpose
RunMetricsRunOutput.metrics, TeamRunOutput.metricsRun-level totals with per-model breakdown
MessageMetricsMessage.metricsPer-API-call tokens and timing
SessionMetricsagent.get_session_metrics()Aggregated across all runs in a session
ModelMetricsInside RunMetrics.detailsPer-model aggregate by (provider, id)
ToolCallMetricsToolExecution.metricsTool execution timing
All metric classes except ToolCallMetrics inherit from BaseMetrics, which provides the shared token and cost fields.

BaseMetrics

Shared token fields inherited by RunMetrics, MessageMetrics, SessionMetrics, and ModelMetrics.
ParameterTypeDefaultDescription
input_tokensint0Tokens in the prompt/input.
output_tokensint0Tokens generated by the model.
total_tokensint0Total tokens used (input + output).
audio_input_tokensint0Audio tokens in the input.
audio_output_tokensint0Audio tokens in the output.
audio_total_tokensint0Total audio tokens.
cache_read_tokensint0Tokens served from cache.
cache_write_tokensint0Tokens written to cache.
reasoning_tokensint0Tokens used for reasoning steps.
costOptional[float]NoneCost of the API call(s).

RunMetrics

Used on RunOutput.metrics and TeamRunOutput.metrics. Includes all BaseMetrics fields plus:
ParameterTypeDefaultDescription
time_to_first_tokenOptional[float]NoneTime from run start to first token (seconds). Set once per run.
durationOptional[float]NoneTotal run time (seconds).
detailsOptional[Dict[str, List[ModelMetrics]]]NonePer-model breakdown keyed by model type (e.g., "model", "output_model", "memory_model").
additional_metricsOptional[Dict[str, Any]]NoneExtra metrics (e.g., eval_duration).

details keys

The details dictionary uses model type strings as keys. Each key maps to a list of ModelMetrics objects (one per unique model (provider, id) pair).
KeyDescription
"model"Primary agent model
"output_model"Output model for structured output
"parser_model"Parser model
"memory_model"Memory model
"reasoning_model"Reasoning model
"session_summary_model"Session summary model
"culture_model"Culture model
"learning_model"Learning model
"compression_model"Compression model
"followup_model"Followup model
Eval agent metrics are prefixed with eval_. If an eval agent uses model types "model" and "output_model", the details keys become "eval_model" and "eval_output_model".
Metrics is preserved as a backward-compatible alias for RunMetrics. Both from agno.metrics import Metrics and from agno.models.metrics import Metrics still work.

MessageMetrics

Used on Message.metrics. Per-API-call metrics. Includes all BaseMetrics fields plus:
ParameterTypeDefaultDescription
durationOptional[float]NoneDuration of this API call (seconds).
time_to_first_tokenOptional[float]NoneTime to first token for this API call (seconds).
provider_metricsOptional[Dict[str, Any]]NoneProvider-specific metrics (e.g., Ollama timing, Cerebras timing).

SessionMetrics

Returned by agent.get_session_metrics(). Aggregated across all runs in a session. Includes all BaseMetrics fields plus:
ParameterTypeDefaultDescription
detailsOptional[Dict[str, List[ModelMetrics]]]NonePer-model breakdown, same structure as RunMetrics.details. Tokens summed across runs.
additional_metricsOptional[Dict[str, Any]]NoneAggregated additional metrics from all runs.

ModelMetrics

Per-model aggregate stored inside RunMetrics.details[model_type]. Includes all BaseMetrics fields plus:
ParameterTypeDefaultDescription
idstr""Model ID (e.g., "gpt-4o").
providerstr""Provider name (e.g., "OpenAI Chat", "OpenAI Responses", "Anthropic").
provider_metricsOptional[Dict[str, Any]]NoneProvider-specific data for this model.

ToolCallMetrics

Used on ToolExecution.metrics. Standalone class (does not inherit BaseMetrics).
ParameterTypeDefaultDescription
start_timeOptional[float]NoneUnix timestamp when the tool call started.
end_timeOptional[float]NoneUnix timestamp when the tool call ended.
durationOptional[float]NoneTool execution time (seconds).

Provider field availability

Not all providers populate all fields. This table shows which BaseMetrics fields each provider sets on MessageMetrics.
ProviderStandard tokenscache_readcache_writereasoningAudio tokenscostprovider_metrics
OpenAI Chat
OpenAI Responses
Anthropic Claudeserver_tool_use, service_tier
Google Geminitraffic_type
Groqcompletion_time, prompt_time, queue_time, total_time
Mistral
AWS Bedrock
LiteLLM
Perplexity
Azure AI Foundry
Cerebrastime_system, time_prompt
Ollamatotal_duration, load_duration, prompt_eval_duration, eval_duration
Cohere
Meta Llama
Meta Llama (OpenAI)
HuggingFace
IBM WatsonX
“Standard tokens” = input_tokens, output_tokens, total_tokens. “Audio tokens” = audio_input_tokens, audio_output_tokens.