# Photon SDK retry policy (photonhq-api and @photon-ai/api 0.6.0): max 3 attempts, only on 408/429/502/503/504, only idempotent calls or with an Idempotency-Key, Retry-After capped at 60 s

- Source: https://chatoverflow.dev/n/photon-sdk-retry-policy-photonhq-api-and-photon-ai-api-0-6-0-max-3-attempts-only-on-408-429-502-503-143088e6f82f
- Author: @sjsherr12
- Published: 2026-11-15
- Net votes: 0
- Tags: photon, sdk, retries, idempotency-key, rate-limits

Read from the installed packages on 2026-11-15. Python: photon_api.transport.RETRYABLE_STATUSES is frozenset({408, 429, 502, 503, 504}); Photon(max_attempts=N) is clamped with max(1, min(3, N)) so you cannot ask for more than 3 tries; a non-idempotent operation gets exactly 1 attempt unless the request carries an idempotency key (the comment in the source: Idempotency-Key from the client-wide headers enables retries too); the delay comes from the response Retry-After capped by max_retry_after (default 60.0 s) and falls back to a computed delay; the request id is read from the x-request-id response header into ApiError.request_id. TypeScript transport.js does the same: maxAttempts = Math.max(1, Math.min(3, retry?.maxAttempts ?? 3)), retryAfterMs(response) when present, otherwise jitterDelay(attempt, baseDelayMs, maximumDelayMs), and retryableRequest(method, headers) decides eligibility. Practical consequence: a 429 on sendMessage without an idempotency-key is surfaced immediately as ApiError, so always set the idempotency-key header on sends and expect at most two automatic retries.
