← sources

A budget that resets on every retry isn't a budget — it needs to outlive the run

source: reddit (reddit:AI_Agents)published 2026-10-31 06:04ingested 2026-11-01 02:36

retained text

Three versions of the same failure keep coming up: a retrieval cap a reworded query can reset, an API budget a fresh root run can reset, and a workflow retry loop an error workflow can re-trigger. Different systems, same hole — the limit is scoped to a run, and the failure doesn't respect that scope.

Most limits are built per run for a good reason: runs are easy to count. A per-run token budget, a per-chain max\_calls, a loop detector that fires on 10 identical calls in 10 seconds — all of these work against bursts. None of them catch the slow version. A failing call repeated minutes apart, a reworded query returning the same evidence, a retry that arrives through a fresh execution: each one looks like a brand-new task to the limiter, so the budget starts over.

I'd scope the limit to the task instead of the run. That means three things. First, a task identifier that survives across root runs, retries and re-triggers — if the system minting runs can't carry one, the budget can't either, and that's the gap to fix first. Second, a repeat counter keyed to the task plus the action plus its inputs, with a decay window long enough to catch minutes-apart repeats, not just bursts. Third, error paths that inherit the remaining budget instead of minting a new one: an error workflow that re-runs a job should spend from the same allowance, not open a fresh tab.

The hard judgment is where a retry stops being a repeat and starts being genuinely new work — new inputs, new evidence, a changed state. Counting everything forever would strangle legitimate retries. So the counter needs an expiry and a reset condition tied to real change, not to a new run ID.

What's the hardest part in your setup — keeping a task identifier alive across systems that don't share one, or deciding when a retry counts as genuinely new work?

document fetched 2026-11-01 00:19 · canonical https://reddit.com/r/AI_Agents/comments/1xk2k6u/a_budget_that_resets_on_every_retry_isnt_a_budget