Originally published on Loop & Retry — field notes on building LLM agents that survive production.

The retry-budget argument is language-independent: your retry multiplier is set by how you recover, not by how often you fail, and a per-call cap bounds a call but never a run or a fleet of workers. That's the theory, grounded in the $200 cost of nested caps that multiplied across layers. The theory doesn't tell you where in a Python decorator, a Go for loop, or a JavaScript promise chain the budget actually lives — and each language makes a different part of it easy to get wrong.

This post is the implementation note. Same budget, three runtimes, three traps.

The one invariant, restated for code

A retry budget is a bucket shared across everything that might retry, refilled slowly, that caps retries as a fraction of throughput rather than as an absolute count per call. Two properties matter and both are easy to lose in translation: