Recipe: retry and backoff
Recipe — retry and backoff. Pointer to the SDK's built-in retry behaviour.
The SDK retries automatically on these conditions, no client code needed:
RateLimitError(429) — respectsRetry-Afterresponse headerInternalServerError(500), 502, 503, 504 — exponential backoff
Defaults: max_retries=2, exponential backoff, configurable via Client(max_retries=N, timeout=...). To disable: Client(max_retries=0).
For per-request override: client.with_options(timeout=300.0).evaluations.create(...).
When to add your own retry
If you need request-level retries beyond the SDK's defaults (e.g., long-running batch with custom backoff), wrap the call in tenacity or similar — but most paying-customer use-cases don't require this.
See also
Last updated
Was this helpful?