Reference · Glossary

Exponential backoff

Last updated

Retry strategy: **wait longer after each failure** (1s, 2s, 4s…) to avoid hammering a rate-limited API.

When to use

429 rate limits, transient 5xx errors, queue workers calling LLM APIs.

When not to

401 bad credentials or 400 invalid payload — fix the request first.

Example

wait = 1
for attempt in range(5):
    try:
        return call_api()
    except RateLimitError:
        time.sleep(wait)
        wait *= 2