Cookbook
Retries with backoff
Runnable coded-error retry example with a stable idempotency key.
The retry example is included in Errors and retries.
Key behaviors demonstrated:
- Branches on the coded
error.codeenvelope. - Retries only retryable codes (
same_key_after_delayclass). - Honours
Retry-Afterwhen present; otherwise uses exponential backoff with jitter capped at 10 seconds. - Reuses one idempotency key and one identical payload across retries.
- Does not retry
idempotency_conflict, validation failures, orterminal_outcome. - Surfaces
X-Request-Idand recovery guidance for uncertain outcomes.
See Errors and retries for the full source and Idempotency and recovery for no-ID recovery.