Skip to main content

typesafe_sdk.RetryPolicy

dataclass Configuration for SDK retry behavior. Examples:

max_retries

class-attribute instance-attribute Maximum retries after the initial attempt; 0 disables retries.

backoff_initial

class-attribute instance-attribute First backoff delay in seconds, doubled each attempt up to backoff_max; zero disables backoff.

backoff_max

class-attribute instance-attribute Maximum backoff delay in seconds; zero disables backoff.

backoff_jitter

class-attribute instance-attribute Fraction of each backoff delay randomly subtracted, between 0 and 1.

http_statuses

class-attribute instance-attribute HTTP status codes that are retried.

respect_retry_after

class-attribute instance-attribute Whether to honor Retry-After and retry-after-ms response headers.

api_connection_error

class-attribute instance-attribute Whether to retry TypeSafeAPIConnectionError, raised when the request cannot reach or read from the server.

api_timeout_error

class-attribute instance-attribute Whether to retry TypeSafeAPITimeoutError, raised when the request exceeds its timeout.

exceptions

class-attribute instance-attribute Additional exception types that trigger a retry, on top of the built-in rules.

predicate

class-attribute instance-attribute An optional predicate called with the raised exception; returning True triggers a retry in addition to the other rules.

timeout

class-attribute instance-attribute Total retry budget in seconds per SDK call, including the initial attempt and delays; None disables the limit. Stops before a retry whose delay would reach or exceed the budget, re-raising the last error.