When to reach for it
- Costs must be capped or allocated.
- Agents autonomously execute loops.
- Optimization of models and patterns is required.
Token consumption, model costs, and tool-related expenses are measured per run, agent, or workflow. The metric is only useful if something acts on it: a kill switch (a hard budget ceiling that terminates a runaway run) and caching of intermediate results turn the measurement into a control. Variable execution paths make cost forecasting hard, and a single edge case that triggers a retry chain can cost many times a normal run — so the ceiling is a safeguard, not an optimization.
In practiceAn autonomous research agent emits token and cost telemetry on each LLM call, and a hard per-run budget cap terminates the run before a self-initiated retry storm triples the daily bill.
When to reach for it
When it backfires
The tradeoff
Better budget control is achieved against additional measurement and aggregation effort.
Every model call is metered against a budget.
Usage is computed at month end from the provider's invoice. A runaway loop has already cost a week's budget by the time anyone notices.
Fix · Emit cost on every span as it happens. Set hard per-run caps at the harness; treat exceeding the cap as a correctness failure, not a billing concern.
A supervisor fans out to specialists and tools that all bill to one account. The total is visible, but you cannot tell which agent, tenant, or feature drove the spend, so you cannot act on it.
Fix · Tag every model call with run, agent, and tenant identifiers on the span, and aggregate cost along those dimensions — not just a single global counter.
Keep going
Search patterns, frameworks, and pages.