Agent Exponential Backoff Implementation

Reliability · updated Thu Feb 26

Standardize transient failure recovery using jittered exponential delays.

Steps

  1. Initialize `base_delay` at 500ms to 1000ms.
  2. Increment `retry_count` on every 429 (Rate Limit) or 5xx (Server) error.
  3. Calculate delay using the formula: `base_delay * (2 ^ retry_count)`.
  4. Apply 'Full Jitter' by picking a random duration between 0 and the current delay.
  5. Set `max_backoff_cap` (e.g., 30s) to prevent excessive idle time.
  6. Terminate and escalate after a hard limit of `max_retries` (e.g., 5 attempts).

view raw JSON →