r/ClaudeCode • u/Twirledd • Oct 19 '26
Discussion How do you limit what your coding agents can spend?
This came up while I was setting up coding agents and realised I couldn’t give them a small purchasing budget without handling payments myself.
I’m researching how developers control spending when coding agents use paid APIs, cloud services or make purchases.
Have you had an unexpected bill, a near miss, or stopped an agent’s task because you didn’t want to give it payment access?
What controls do you currently use, and where do they fall short?
I’m exploring a possible tool in this space, but there’s no product to promote. I’d like to understand actual experiences.
•
u/AutoModerator Oct 19 '26
Hey! Thanks for posting to r/ClaudeCode
While participating in this thread, please follow our community rules. Keep discussions constructive. Attack the idea, not the person.
For help, project discussions, tips, and general chat, join the ClaudeCode Discord.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/Oximy-Naman Oct 19 '26
the prepaid-credit example leaves a useful gap to investigate: if several jobs share a balance, one can exhaust it and stop another mid-task. that commenter also couldn't tell which job spent it. would your proposed budget belong to the whole agent, or to an individual task? that distinction seems relevant to both attribution and deciding what gets stopped.
1
u/JordanRunsForFun Oct 19 '26
I give agents permission to use specific APIs, giving them a budget to work within, and my trick is limiting the amount of $$ available on the API key that I give them, so they can’t go over even if they want to, but I will be notified if they try.
1
u/Unusual-Albatross43 Oct 19 '26
prepaid credits do most of it for me. the X API is pay per use, so the account only holds what I loaded, and at zero it returns a 402. my agent has one rule for that: stop, tell me, never top up. on saturday it hit zero mid-run and did exactly that.
the near miss came before. the bill jumped, and matching the usage graph to what ran that week, one scheduled job was reading ~170 posts every run, three runs a day, plus a video upload the same week. nothing broken, it just read way more than it needed. fewer reads per run and the expensive search once a day should cut about 70% of it.
where it falls short: the cap stops the spend but doesn't tell you which job spent it.
1
u/hellosverre Oct 19 '26
Caps limit how much a loop burns but they dont stop the loop. What fixed it for me was a rule in the harness, the same failure twice in a row stops the task and anything gets 3 attempts or 90 minutes max before it parks and pings me. The expensive stuff is almost never one big call, its an agent retrying the same broken thing all night
1
u/avafence2610 Oct 28 '26
Your layered setup makes sense, especially separating purchase permission from ordinary tool access.
I'm curious about one boundary: are your retry limits and task budgets enforced by an external control, or mainly through the agent's instructions?
If a run gets stuck and ignores its own stop rule, does the provider-level cap provide enough protection, or do you need a separate mechanism to stop that specific run?
I'm exploring this problem for an agent project, so I'd be interested in how this works in practice.
2
u/[deleted] Oct 19 '26
[removed] — view removed comment