---
title: "Use case: Cap what an AI agent can spend before it spends it"
canonical_url: "https://tokenobserve.com/use-cases/cap-ai-agent-spend"
published: 2026-09-02
last_updated: 2026-10-21
---

# Use case: Cap what an AI agent can spend before it spends it

Token Observe decides the money before the request leaves your network. Four optional USD ceilings per governed subject (per request, per rolling hour, per UTC day, per UTC month) sit alongside per-minute ceilings on requests, tool calls and tokens, and a call that would cross one is refused with a typed error.

## The stated limit

What a hard ceiling costs you: One billable egress: no retry, no failover

## A dashboard tells you what you spent after you spent it.

The control a finance owner is asking for is the one that refuses the call, and that means holding a defensible price before it leaves the building. That is a harder problem than drawing the chart, which is why most of the market stops at the chart. A token quota is no substitute: it bounds volume, and volume and money diverge exactly when it matters.

## The steps, in this order

1. Give each agent a record. Ceilings bind a governed subject, so every agent needs a registry row and a named owner. The gateway resolves it per call, so an edit applies without a redeploy.
2. Populate the price table. The 50 shipped rows load additively at boot. Check every model your agents can reach has one, fallbacks included.
3. Set the ceilings that match the failure. Per request catches one absurd call, hourly a retry loop, daily and monthly the drift. Day and month start at 00:00 UTC.
4. Decide what happens when it bites. A refusal is a 429 with a typed reason and a recorded blocked trace, and nothing partially executes.

### The money verdict is taken last, and priced against everything reachable.

USD is skipped in the first pass for any agent with a ceiling, because money cannot be decided until routing has fixed which upstream will serve the call. The primary target and every fallback are then priced against the resolved model rather than the name the caller typed; otherwise a rerouted target is a zero-dollar escape hatch.

- perRequestUsd: Refuses one call whose conservative estimate exceeds the ceiling. Inert on a subscription seat, which prices the seat rather than the request.
- hourlyUsd, dailyUsd, monthlyUsd: A rolling sixty minutes, the UTC day and month. Each blocks when the window is at the limit and when the projection would cross it.
- The unpriced refusal: A 409 before egress naming the model, the provider that would have served it, and how many fallbacks are also unpriced.
- Long cache writes: Anthropic and Bedrock bill a five-minute cache write at 1.25 times input and an hour at 2 times. Any other TTL prices at twice input.

### A parked request holds its money until the decision ends.

Forget the estimate while somebody deliberates and an agent queues a thousand expensive calls past its ceiling; hold it forever and a denied approval counts against that budget until someone edits the database by hand. So the reservation lasts exactly as long as the decision, and every terminal path releases it in the same transaction as the state change that ended the wait.

## What this still does not solve

- There is no team-level or fleet-level budget pool. A team figure is the sum of the per-agent ceilings that exist, beside a count of the agents that have none.
- Nothing is reconciled against a vendor invoice. Every figure is metered against price rows you hold, and a shipped row is a list price captured on a date that will go stale.
- A hard ceiling costs you retry and failover, because a timeout cannot prove the vendor did not complete and bill the call.
- Token Observe cannot bound spend it never sees. A vendor credential used directly is a discovery problem before it is a budget one.

## Questions and answers

Q: What happens when an agent hits its monthly ceiling mid-conversation?
A: The next call is refused before it reaches a provider, with a 429 naming the limit type, the configured value and the actual figure. Nothing partially executes and nothing is billed, and the attempt is still recorded as a blocked trace. A budget warning is published at 80 per cent of any window and a budget-exceeded event at 100 per cent.

Q: Can two concurrent requests both slip past the same cap?
A: No. The USD admission runs inside one per-agent transaction that reads the windows, tests the projection and writes the reservation before releasing the lock, and in-flight requests count: a running trace contributes the greater of its billed cost and its reservation.

Q: What happens if a model has no price row?
A: For an agent with any USD ceiling, the request is refused with a 409 before egress, naming the unpriced model and how many fallbacks are also unpriced. The alternative was tried and was worse: an unpriced model produced a zero estimate, which silently disarmed every per-request ceiling.
