Constructor
The maximum number of retries that can be made in the presence of failures.
Coefficient controlling how much the retry delay increases each retry attempt. A backoff coefficient of 1.0 creates fixed-delay where the delay period always equals the initial delay.
Number of seconds that must elapse before the first retry occurs.
Maximum length of retry delay in seconds, preventing the delay from growing infinitely.
Usage
Basic retry configuration
Fixed-interval retries
Exponential backoff
- 1st retry: 1 second delay
- 2nd retry: 2 second delay (1 * 2^1)
- 3rd retry: 4 second delay (1 * 2^2)
- 4th retry: 8 second delay (1 * 2^3)
Custom max delay
Validation
max_retriesmust be non-negativemax_delaymust be at least 1 second and at most 60 secondsinitial_delaymust be positive and at most 60 secondsbackoff_coefficientmust be between 1.0 (fixed-interval) and 10.0
Notes
- Retries are not supported for web endpoints (functions with
@modal.web_endpoint) - Retries are not supported for generator functions
- The retry policy only applies to application errors and timeouts, not internal failures
- Internal failures (like worker preemption) are retried automatically up to a limit, separately from the user-specified retry policy