COST CONTROL · ADMISSION
Agent cost control: reject an over-budget call
Admit eight model calls against a session budget and compare after-the-fact checks, input-only estimates and reserved worst-case estimates.
Your experiment
Eight planned calls with fixed token counts must fit a 20-cent session budget. Calls 5 and 6 fan out in parallel and are checked against the same spent total. Start without reservations, then reserve, serialize, and compare the three admission checks.
Play replays the computed run over sixty inspection seconds; Next event steps, Restart rewinds, and Inspection time scrubs. Any input change recomputes the run and rewinds it without autoplay.
Event trace
Computed data
Final metrics
Fictional prices (1 cent per 1K input tokens, 4 cents per 1K output tokens) and fixed token counts; output beyond the max-output limit is cut and not billed. An estimate uses the call’s input tokens plus the full max output. Nothing calls a model or billing API; real pricing, caching discounts and provider usage metadata differ.
Eight calls, one budget
A session may spend its Session budget, in cents, on eight planned model calls. Prices are fictional: 1 cent per thousand input tokens and 4 cents per thousand output tokens, and output beyond Max output tokens per call is cut and not billed. With the opening 1000-token limit, calls 5 and 6 would have produced 1200 and 1100 tokens, so both answers are cut at the limit. Before each call an admission check decides whether it may run.
The opening overspend: two calls pass one check
The opening check admits a call when spent plus its worst-case estimate, the input cost plus the full max output, stays within 20 cents. Calls 1 to 4 spend 11.3 cents. Calls 5 and 6 are issued in parallel and are both checked against 11.3: each estimate is 7 cents, 18.3 is within budget, so both run and the session ends at 25.3 cents, 5.3 over. Calls 7 and 8 are then rejected. Check Reserve each admitted estimate until the call settles: call 5 reserves 7 cents, call 6 now sees 25.3 and is rejected, and the session ends at 18.3 cents with three rejections. Clearing Calls 5 and 6 are issued in parallel gives the same 18.3.
Which estimate?
Clear the parallel switch, then compare the options of Admission check before each call. Spent so far below budget admits call 6 at 18.3 spent and ends at 25.3: an after-the-fact check always lets the last call overshoot. Spent + input-only estimate rejects call 6 but admits the small call 7, because its output was not counted, and ends at 20.2 cents, 0.2 over. Only the worst-case estimate keeps the session within budget.
The output limit is part of the estimate
Max output tokens trades estimate size against truncated answers. At 500 tokens the estimates are smaller, the session ends at 19.7 cents within budget, but three answers are cut. At 2000 tokens with reservations the estimates grow so large that calls 5 to 8 are all rejected and only 11.3 cents is spent. Raise the budget to 30 cents with the opening settings and the 25.3-cent session fits.
Reading the run and its limits
Play, Next event, Restart, Speed and Inspection time step through every admission check and settlement over sixty seconds; the chart shows cumulative spend against the budget line, and the table lists tokens, estimates, admissions and actual cost per call. Real costs come from provider usage metadata, include cached-input and thinking-token rules, and are settled after the fact, so a reservation ledger must also handle failed and retried calls.