An AI agent can choose the correct tool and still cause operational damage through too many calls, expensive retries or poorly scoped authorization. Billing dashboards often aggregate tokens, but tool calls may trigger database scans, paid APIs, email workflows and irreversible side effects. OWASP’s 2025 risk descriptions for excessive agency and unbounded consumption show why autonomy and resource control must be treated as design questions. This article proposes an engineering ledger for budget reservation, execution and reconciliation. It focuses on transaction semantics, not on the query-budget checks already common in database infrastructure.

Define the budget at more than one scope

A request-level limit prevents one runaway session, but it cannot stop a thousand individually acceptable requests from the same tenant. Define an organizational allowance, a user allowance and a workflow allowance with explicit units: invocation count, maximum external spend, wall-clock duration, concurrent jobs and side-effect categories. A read-only search can have a different risk classification from sending an external message or changing an account balance. OWASP’s excessive agency guidance emphasizes the consequences of unnecessary functionality and permission. Reduce privileges before adding cost controls: a dollar limit is not permission to perform an unrelated action. Keep resource counters separate from approval status, so an approved action cannot exceed technical capacity unnoticed.

Reserve a bounded amount before execution

Treat an expensive tool invocation like a small financial transaction. Before dispatch, compute an estimated upper bound and reserve that amount from the relevant budget ledger. Reject or ask for an authorized adjustment if the reservation fails. A concurrent worker must make the reservation atomically to avoid two requests spending the same remaining allowance. On completion, settle the actual cost and release the unused portion. On timeout, keep the reservation pending until the tool provider’s final state is reconciled rather than assuming failure means zero cost. Use immutable request IDs so retries cannot create a second reservation. The ledger should be inspected through a privileged API and must not be editable by model-generated instructions.

Make retry semantics explicit and idempotent

The difficult case is when an agent sees a timeout but the outside system has already performed the operation. A repeated CRM update may be harmless, while a duplicate payment or email send may not be. Require tools with side effects to accept idempotency keys or expose a status-read endpoint. State whether a retry can happen automatically, requires verification or must wait for human review. Backoff reduces request storms but does not establish exactly-once semantics by itself. Store attempt numbers, provider receipts and reconciliation status without logging access tokens or private payloads. A budget ledger should charge for retries that actually occurred while preventing a retry from accidentally doubling the business action.

Apply a hierarchy of hard stops

OWASP describes unbounded consumption as an AI application risk in its 2025 Top 10 guidance. Build limits that cannot be overridden by the agent’s own reasoning: maximum calls per task, maximum external spend, maximum tokens, expiry time and maximum fan-out of child jobs. Permit the controller to stop a workflow even when the model insists more research is needed. A model may suggest an escalation, but the product must route it to a trusted human policy decision. Reserve an emergency control lane for cancellation and audit queries so resource exhaustion does not prevent stopping the system. When a hard stop is reached, preserve the partial result and clearly identify missing work; do not claim a completed task.

Instrument attribution without leaking customer data

Associate each reservation and settlement with tenant, workflow, tool type, risk class, invocation ID and versioned policy. Aggregate counts by deployment and compute p50, p95 and extreme tail cost, because average spend can conceal rare pathological loops. Mask private arguments and place sensitive audit evidence behind tighter controls than ordinary dashboards. Show blocked call attempts and authorized overrides separately; a high rejection count may indicate a broken prompt or a legitimate new use case. Review provider invoices against ledger totals at defined intervals and flag unresolved attempts older than their maximum reconciliation window. The ledger exists to explain spending and safe execution, not to collect user conversations for unrelated analytics.

Run failure drills and tune thresholds

Recreate the worst plausible workflow: a search tool returns duplicate results, the agent tries five follow-up searches, the paid enrichment provider becomes slow, and a final write times out after succeeding. Confirm that the reserved budget never becomes negative and no business action is repeated without authorization. Deliberately start two concurrent sessions under one tenant cap. Test that attempts with missing idempotency keys fail before reaching side-effecting tools. A useful staged launch may allow generous read budgets but require approval for account modification or outbound communication. Publish operational expectations for the workflow owner and give support engineers a clear recovery playbook for unresolved reservations.

The practical architecture is a small transaction system around agent execution: authorize, reserve, dispatch, reconcile and audit. Its value is predictable work under failure, not a superficial promise that an intelligent model will naturally choose inexpensive or safe actions.

Sources

  1. OWASP GenAI Security Project, LLM06:2025 Excessive Agency
  2. OWASP GenAI Security Project, LLM10:2025 Unbounded Consumption