DEV Community

Discussion on: 0 of 12 AI agent frameworks can cap what an agent spends in dollars (we checked)

Collapse
 
ranareebaal profile image
Rana Reebaal •

Useful table, and the C4 vs C5 split matches what I ran into on the LLM side. Building multi-agent platforms for clients, the problem was never one call, it was not knowing at month end which agent in the tree had burned the budget. We were reconciling it with spreadsheets and shell scripts after the fact.

One thing I'd add to the "put the check in the C2 hook" advice: once several agents share a budget and run in parallel, check-then-spend races. Two calls each see $40 left and both go through. The control layer needs to reserve the estimated amount atomically before the call and settle the real cost after, otherwise the cap leaks under concurrency. Same shape as your split-payment problem, just across agents instead of across payments.

Did any of the 12 frameworks run the hook before parallel tool calls are dispatched, or do they all fire per call?

Collapse
 
azizanapp profile image
Azizan •

The check-then-spend race is exactly the failure that a per-call hook hides: two calls both see $40 left. Reserve-then-settle is the right shape.

On your question: the survey only recorded whether a per-tool hook exists (C2), not whether it runs before parallel calls are dispatched, so I cannot claim any of the 12 do. That is worth checking properly.

For what it is worth, we tested the shared-ceiling case on Pink's sandbox: three agents firing 40 concurrent requests against one $6,000 daily ceiling landed at the ceiling in both runs, with every block naming the ceiling. It is a sandbox test, not a proof of atomicity: pinkwallet.com/agentic/learn/give-...

Collapse
 
ranareebaal profile image
Rana Reebaal •

Fair that a sandbox run isn't proof of atomicity, but landing exactly on the ceiling in both runs is a good sign. The test I'd add is one built to break it: set the ceiling just above the cost of a single request, fire all 40 at once, and check total spend never goes past it. Then kill the guard mid-run so you also exercise the fail-closed path, and confirm those calls come back blocked with a reason instead of being retried.

Would be great to see the parallel-dispatch question added to the survey. A per-call hook that can't see the other calls in the same batch is exactly where these caps leak.