The cost of an agent run is not simply the price of its final response. Planning, implementation, retries, review, and repair can each produce provider requests. A useful budget begins with that sequence rather than an optimistic estimate for one call.
Record usage at the request boundary
Keep provider-reported usage with the relevant attempt and task. Associate an estimate with the model and pricing policy used for that request. If a provider reports different usage categories, such as cached input, do not silently price every category as ordinary input unless the calculator explicitly supports that assumption.
An estimate is not an invoice. Account-specific agreements, taxes, provider billing rules, and unsupported usage categories can make the billed total differ. Label the number accordingly and retain the source usage information needed to investigate discrepancies.
Unknown is not zero
A missing price should produce an unavailable estimate, not a zero-dollar success. Likewise, a failed request without usage information is not evidence that the provider charged nothing. Keep “known estimated cost” and “pricing coverage” separate so a partially priced run does not appear fully accounted for.
This matters in dashboards: a short N/A can be clearer than a long warning inside a crowded table, provided the detail view explains what is missing. Hiding uncertainty behind a reassuring total makes the interface less useful.
Bound work before it starts
Set limits on task scope, attempts, repair cycles, and run budget. An inexpensive model can still generate a costly loop if the system repeatedly asks it to fix the same underlying environment problem. Retry network failures selectively; do not keep retrying invalid credentials or missing billing access.
Before enabling automatic startup, consider what happens after a reboot. A runner that immediately claims eligible issues can spend money even when nobody opens the dashboard. Explicit consent and visible running status are part of cost control.
Test the accountant without paying the provider
Feed deterministic usage fixtures into the calculator. Include missing prices, zero usage, large counts, failed attempts, and multiple requests. Assert units carefully: dollars, million-token prices, and stored microdollars are different scales. Then validate provider billing separately when a funded account is available. Read the free-testing guide for the distinction.