MaxTokens
A class to be used on spawning an agent or decorating an agentic function to control the maximum number of output tokens generated by the underlying model.
MaxTokens.from()
A static factory method that creates a MaxTokens instance from a configuration object with named parameters.
int | null
The maximum number of output tokens generated over all rounds of inference in a single invocation.Defaults to
null meaning unlimited.int | null
The maximum number of output tokens generated in a single round of inference in a single invocation.Defaults to
null meaning unlimited.int | null
The maximum number of rounds of inference in a single invocation.Defaults to
null meaning unlimited.Usage
A class outlining the token usage of the underlying model of an agent or agentic function.
number
The number of input tokens consumed by the model.
number
The number of output tokens generated by the model.
number
The total number of tokens processed, not double-counting generated then re-consumed tokens.
number
The number of input tokens that were served from cache. Defaults to
0.number
The number of tokens used for internal reasoning / chain-of-thought. Defaults to
0.