Overview
The SDK supports automatic retries with exponential backoff for transient errors. Retries are enabled by default.Default Behavior
By default, the SDK automatically retries failed requests that are likely to succeed on retry, such as:- Rate limit errors (429)
- Server errors (500, 502, 503, 504)
- Network connection failures
Per-Request Configuration
Override retry behavior for a single API call:Global Configuration
Override retry behavior for all operations at SDK initialization:Configuration Options
| Option | Type | Description |
|---|---|---|
strategy | "backoff" | Retry strategy to use |
backoff.initialInterval | number | Initial delay in milliseconds |
backoff.maxInterval | number | Maximum delay between retries |
backoff.exponent | number | Exponential backoff multiplier |
backoff.maxElapsedTime | number | Maximum total retry time |
retryConnectionErrors | boolean | Whether to retry on connection failures |
How Exponential Backoff Works
With exponential backoff, the delay between retries increases with each attempt:Disabling Retries
To disable retries entirely for a specific request:Best Practices
- Use defaults for most cases - The SDK’s default retry behavior works well for typical use cases
- Increase timeouts for batch operations - When processing many items, allow more retry time
- Disable retries for time-sensitive operations - If you need immediate feedback, consider disabling retries
- Monitor retry patterns - If you see many retries, consider reducing request volume