Skip to main content
All Python modules · Import and compatibility guidance

Policy settings

Strategy callbacks

Exports

TokenBudgetExceeded

A model call was stopped before dispatch by an enabled budget.

TokenCount

A count with explicit provenance; estimates are never provider usage.
Fields (— means no declared default):

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.
Fields (— means no declared default):

TokenPolicyError

A configured token strategy cannot be applied to a model request.

TokenReport

Content-free observations for one model call or rejected attempt.
Fields (— means no declared default):

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.
Fields (— means no declared default):

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.