Get Agent Session Token Usage
get_agent_session_token_usageRetrieve per-session token usage for a specific agent, sorted chronologically. Optional time filters and inclusion of failed sessions provide detailed usage tracking.
Instructions
List per-session token usage for a single agent, sorted chronologically.
Fetches agent sessions filtered to the given agent name and returns one row per matching session (no aggregation), useful for time-series inspection of an agent's usage. Only COMPLETE sessions are included by default — see include_failed to also include FAILED sessions.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| agent_name | Yes | Filter to agent names containing this substring (case-insensitive) | |
| started_after | No | ISO 8601 timestamp — only include sessions started at or after this time | |
| include_failed | No | By default only COMPLETE sessions count toward usage (finished, billable work). Set true to also include FAILED sessions, which can still have consumed real tokens. Non-terminal statuses (PENDING, RUNNING, PAUSED, ...) are always excluded either way, since their totals aren't final. | |
| started_before | No | ISO 8601 timestamp — only include sessions started at or before this time |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes | Response model for the per-session agent token usage endpoint. Wraps a list of AgentSessionTokenUsageElement objects for a single agent, sorted by started_at ascending. Attributes: root: List of AgentSessionTokenUsageElement objects with per-session token usage and timing metadata. |