MaxTokens
Control the maximum number of tokens an agent or agentic function can generate.
int | None
The maximum number of output tokens generated over all rounds of inference in a single invocation.
Defaults to None meaning unlimited.
int | None
The maximum number of output tokens generated in a single round of inference in a single invocation.
Defaults to None meaning unlimited.
int | None
The maximum number of rounds of inference in a single invocation.
Defaults to None meaning unlimited.
ResponseUsage
Token usage statistics returned by all usage-reporting methods. This is ResponseUsage from openai.types.responses, which provides richer detail including cached and reasoning token breakdowns.
int
The number of input tokens consumed by the model.
int
The number of output tokens generated by the model.
int
The number of input tokens that were served from cache.
int
The number of tokens used for internal reasoning / chain-of-thought.
total_usage
Get the total token usage of an agent or agentic function across all invocations.
AgenticFunction | Agent | Callable[..., Any]
The agent, agentic function, or decorated callable to query.
ResponseUsage
The token usage across all invocations of the agent or agentic function.
last_usage
Get the token usage of an agent or agentic function for the last invocation.
AgenticFunction | Agent | Callable[..., Any]
The agent, agentic function, or decorated callable to query.
ResponseUsage
The token usage of the last invocation of the agent or agentic function.