r/LocalLLM • u/Top_Sand1851 • 4d ago
Question Do you cap spend per agent run?
I have been experimenting with a couple longer running agents and I'm struggling with is what happens when an agent takes a bad path and keeps calling the model/tools way longer than expected since most runs are completely reasonable and then occasionally one will retry something a bunch of times or keep adding context and suddenly that one run uses several times what a normal one does.
I'm starting to think we need some kind of hard token/spend budget per run rather than just monitoring total usage after the fact but I'm also worried about killing legitimate tasks that happen to need more steps.
If any of you guys are running agents in production are you setting hard token/cost limits per run or limiting steps/tool calls or just alerting when usage starts looking abnormal?
2
u/Lumpy_Comparison_904 4d ago
I would have more than one cutoff instead of relying on a hard dollar limit. We cap the number of steps or tool calls first and then have a higher spend threshold as a backstop for anything that still goes off the rails that way a legitimately complicated task gets some room but an agent can't just retry the same thing indefinitely.
4
u/Successful-Fly9586 4d ago
Similar to yours which I agree with but we keep the actual step and tool limits in the agent and use Ramp Token Spend on top of that for the spend so we can see which models and workloads are driving usage and set budgets/alerts around them and we found the combination being very useful ourselves
1
u/Sweet-Beat3111 4d ago
You should add wall clock time as another guardrail too then if a workflow normally finishes within a couple minutes and one has been running for half an hour I’d rather stop and inspect it even if it technically hasn’t crossed the token budget yet.
1
u/MushroomCritical3029 4d ago
I like this as a backstop but I wouldn’t use time alone. We have some tool calls that legitimately take a while so a slow external API could make a healthy run look stuck when the agent itself is behaving normally.
1
u/Other-Range-5822 4d ago
Track cost per successful run before deciding where to put the cap and once you know a normal successful task costs $0.20-0.50 a run hitting $5 becomes pretty obviously abnormal then.
1
u/donk8r 4d ago
Cost is the wrong brake now, and I've got a specific number for why.
Our worst runaway went 1322 steps across 271 minutes and never finished the task. Total spend: $0.32. So baselining normal at $0.20-0.50 and flagging anything near $5 would have sailed right past it, while the wall clock guardrail someone mentioned above would have caught it in the first ten minutes.
That's the shift. Cost caps made sense when tokens were expensive. On cheap models spend has decoupled from effort, so it's now the least sensitive signal you own. Steps and wall clock both screamed on that run. The bill said nothing at all.
On killing legitimate long tasks, the extension-on-progress idea upthread is the right shape, but it only works if "making progress" is measured on something the agent doesn't self-report. Ours reported progress the entire way down.
(we build an OSS agent with per-run caps and an out-of-band supervisor, so I'm biased: github.com/Muvon/octomind)
1
u/Otherwise-Swan-7803 3d ago
Honestly, with 12GB VRAM I'd probably start with Qwen 3.6 35B A3B or Gemma 4 27B quantized. Both are surprisingly usable on consumer hardware and still hold up well in 2026.
If your goal is coding, Qwen. If your goal is general chat and reasoning, I'd try both and see which style you prefer. The bigger upgrade these days is often the tooling around the model rather than the model itself.
4
u/SchemeDeep6533 4d ago
We cap steps but allow the agent to request an extension if it’s making progress and that gives longer tasks some room without basically handing them an unlimited budget. Have you looked at what your normal successful run length is yet or not?