UsagePolicy
UsagePolicy defines limits and behavior when limits are reached.
Common fields:
max_stepsmax_llm_callsmax_tool_callstimeout_seconds- Optional
max_tokens,max_cost_dollars on_limit:"raise"or"return"
UsageTracker
UsageTracker holds counters and enforces limits:
check(operation)validates budgetrecord_step(step_kind)increments countersrecord_usage(tokens, cost)accumulates usage metadata
Context helpers
Coevolved exposes context helpers for using a tracker without threading it through every function:get_usage_tracker(),set_usage_tracker(...),clear_usage_tracker()check_budget(operation="step")record_step(step_kind=None)record_usage(tokens=0, cost=0.0)