Expand description
Per-scope cost budgets + spend aggregation (CH-06, fable §R11 / §7).
Builds on the existing opt-in cost estimation (LlmConfig.cost_tracking,
estimate_cost, the uar_llm_cost_usd metric). This module adds the
accounting layer the runtime was missing: aggregate spend per run / task /
session / agent, declare budget envelopes, and emit threshold-crossing
events so the UI and operators can react before a runaway burns the budget.
The synchronous tracker measures live activity; the trusted driver wrapper reserves and settles durable aggregate liability before exposing provider events.
Structs§
- Budget
Limit - A configured budget limit for one
(scope, scope_id). - Client
Tool Budget Snapshot - Immutable local-accounting evidence retained across a caller-tool handoff. Durable monetary liabilities remain in the existing accounting store.
- Cost
Budget Tracker - Thread-safe cost-budget tracker. Cloneable handle over shared state.
Enums§
- Budget
Scope - The dimension a budget / spend record is keyed on.
- Budget
Status - Result of recording spend against a budget.