Policy settings
Strategy callbacks
Exports
TokenBudgetExceeded
A model call was stopped before dispatch by an enabled budget.Example
Example
TokenCount
A count with explicit provenance; estimates are never provider usage.— means no declared default):
Parameters and example
Parameters and example
TokenPolicy
Independently enable observation, enforcement, and authored reductions. Merely constructing a policy observes; limits require enforce=True. Reductions run only when explicitly configured. Callbacks may be sync or async, but synchronous model execution requires synchronous callbacks.— means no declared default):
Parameters and example
Parameters and example
TokenPolicyError
A configured token strategy cannot be applied to a model request.Example
Example
TokenReport
Content-free observations for one model call or rejected attempt.— means no declared default):
Parameters and example
Parameters and example
TokenRequest
Detached model input for strategies; message shapes follow framework. ADK messages are Content dictionaries; LangGraph messages use LangChain’s messages_to_dict representation. Settings are native generation options. Tool descriptors are informational; select existing tools by name instead of manufacturing new callable capabilities.— means no declared default):
Parameters and example
Parameters and example
token_policy_scope
Replace or disable policy for trusted code in this scope and child tasks. None disables policy. An agent-specific override takes precedence over a scope-wide override. HTTP metadata never activates this trusted control. Native agents need a configured adapter (TokenPolicy(enabled=False) is sufficient) before a scope can enable policy for them.Parameters and example
Parameters and example