Knowledge
Reliability: centralize backoff, don't retry per call
Naive per-call retry makes 429s worse. Put one concurrency limiter in front of the pool, back the whole pool off on a retry-after, and add jitter.
Why naive per-call retry worsens 429s
When you fan out N agents and each retries its own failed call, every retry fires at once — a thundering herd that keeps you rate-limited. See rate limit backoff.
One concurrency limiter in front of the pool
Centralize the throttle instead of scattering retries.
- Put a single concurrency limiter (cap at
min(cores, 8)or a token bucket) in front of *all* agents so excess calls queue instead of firing. - Excess work waits in line — it never becomes a burst.
Retry-after-aware pool backoff with jitter
React to the provider's own signal, and react as a pool.
- On a
429, read theretry-afterheader and back off the whole pool, not just the failed call. - Add jitter to the backoff so retries don't resync into a new herd.
- A token bucket in front of the pool is the pattern that consistently fixes this.
Related patterns
Parallelization: fan out independent work
Parallelization runs independent sub-tasks concurrently — split-and-merge for speed, or same-task-N-ways for accuracy — but only when no step depends on another's output.
Guardrails: hard gates vs soft dials
Validate what comes in, validate what goes out, and give the agent an explicit escalation path. Decide up front which checks block and which only nudge.