Overview
Every task exposes a single read-onlytask.usage property. It returns an AggregatedUsage view derived from the centralized usage registry on each access, scoped to this task’s task_usage_id.
For wall-clock task length, compute task.end_time - task.start_time. The figure on task.usage.duration is the sum of per-call model durations, not wall-clock.
When printing is enabled (print_do / print_do_async), a Task Metrics panel is displayed after each execution.
Accessing Task Metrics
Readtask.usage on any Task instance after execution. It always returns an AggregatedUsage — zero-valued before any model call, populated thereafter.
Token Metrics
Request & Tool Metrics
Timing Metrics
Cost Metrics
Aggregation Metadata
Task Identity & Wall-Clock Timing
Example
Printed Panel
When you useprint_do or print_do_async, the Task Metrics panel displays after the task:
Scope & Propagation
- Per-task isolation — Each task has its own
task_usage_id. Two tasks executed by the same agent never mix theirtask.usagefigures. - Agent rollup — The same entries that contribute to
task.usagealso contribute toagent.usage(andchat.usage/team.usageif applicable) because every entry carries multiple scope tags. - Sub-pipeline rollup — Reliability validator/editor, culture, policy, and sub-agent calls dispatched during this task inherit
task_usage_idand roll intotask.usageautomatically. - Retry idempotency — The registry is keyed by
entry_id. Retried requests replace their prior entry instead of double-counting. - JSON snapshot — Call
task.usage.to_dict()for a flat dict suitable for logs and dashboards.
Legacy Migration
Legacy task-level properties have been removed in favour of
task.usage:Related Documentation
- Usage Registry — Architecture, scope tags, persistence
- Agent Metrics — Accumulated agent-level view
- Chat Metrics — Per-session scoped view
- Team Metrics — Per-team scoped view
- Task Caching — Reduce costs with caching

