Budgets
Budgets are set ingovernance_config["budgets"], one list of limits per
scope. Each limit caps one meter over one window.
Scopes
Scopes:
request, session, agent, application.
Meters
A model call’s price is held before the call: the input it counts, and the output at
model_config["max_tokens"], or 4096 tokens (sent to the provider as the call’s ceiling) when none is set.
Windows
A limit
What one meter may reach in one scope, and what happens at the wall.
When a budget runs out
A run that would go over apause limit stops before the call and returns
status: "awaiting_budget" with budget_request: the budget, what is spent, what
the call needs, and the shortfall. Then:
await agent.grant_budget(run_id, approver=..., amount=...)adds to that budget (withoutamount, just the shortfall of the call that stopped), recorded with the approver’s name; thenawait agent.resume(run_id).await agent.deny_budget(run_id, approver=...)ends the run instead.await agent.budget_status(run_id)shows each budget’slimit,granted,spent,reservedandremaining.
GET /runs/{run_id}/budget (the budgets and the run’s requests) and
POST /runs/{run_id}/budget. The design is in
durable runs.