OfficialJev Repos & SDKs
Python SDK Retries
RetryPolicy for the Python SDK: attempt count, exponential backoff with jitter, which HTTP statuses retry, and a total time budget.
- Format
- Docs
- Published by
- TypeSafe AI
- Last verified
- Oct 2026
Works forJev for Classification
Used inJev for Software & DevTools
- Languages
- Python
Highlights
- Defaults are max_retries 2, backoff_initial 0.5s, backoff_max 5s, backoff_jitter 0.25, and timeout 30s.
- Retried statuses are 408, 429, and the 500-599 range. max_retries 0 turns retries off.
- respect_retry_after honors Retry-After and retry-after-ms. Connection and timeout errors retry by default.
- A predicate or extra exception types can force another retry. The budget stops a retry that would exceed it.
Quickstart
python
from typesafe_sdk import RetryPolicy, TypeSafeClient
client = TypeSafeClient(
retry=RetryPolicy(
max_retries=3,
timeout=10.0,
http_statuses={429, 500, 502, 503, 504},
)
)Watch out
The usage guide shows a different example policy. This page is the dataclass default.
Questions about this entry
Short answers drawn from the linked project or page.
408, 429, and the 500-599 range, with connection and timeout errors retrying as well. max_retries 0 turns retries off, and respect_retry_after honors Retry-After and retry-after-ms headers.
max_retries 2, backoff_initial 0.5s, backoff_max 5s, backoff_jitter 0.25, and a 30-second total budget. The usage guide shows a different example policy; this page is the dataclass default.
backoff_initial is doubled each attempt up to backoff_max, and backoff_jitter subtracts a random fraction of each delay between 0 and 1. Setting either backoff value to zero disables backoff.
timeout is the total budget per SDK call, covering the initial attempt and all delays. The client stops before a retry whose delay would reach or exceed the budget and re-raises the last error; None disables the limit.
Yes. exceptions lists extra exception types that trigger a retry on top of the built-in rules, and predicate is called with the raised exception; returning True forces a retry.
They are governed by api_connection_error and api_timeout_error, each enabling retries for its error class. TypeSafeAPIConnectionError covers unreachable or unreadable requests, and TypeSafeAPITimeoutError covers exceeded timeouts.
When respect_retry_after is on, the SDK honors Retry-After and retry-after-ms response headers. Otherwise it falls back to its own backoff schedule.
Reactions & coverage
Posts, threads, and videos about this entry from around the web.
X: Failing open or failing closed is a per-action choice, not a global default.
This post couldn't be loaded here — read it on X.https://x.com/jevdirectory/status/2781000000000000004More Jev resources like this
The Python SDK error hierarchy: HTTP status classes, rate-limit wait hints, connection and timeout errors, and response-body validation failures.
Jev Repos & SDKsDocs#official#docs#sdk
Official
Release notes for the official Python SDK, from the 14 September 2026 public release through the Pydantic migration and the HTTP/2 extra.
Jev Repos & SDKsDocs#official#docs#sdk
Official
How the Python SDK types questions: Noul, Choice, and Score as objects or dictionaries, including optional JSON instructions and criteria.
Jev Repos & SDKsDocs#official#docs#sdk
Official
Default settings and environment variable names for the Python SDK, including the API root, model alias, and per-request timeout.
Jev Repos & SDKsDocs#official#docs#sdk
Official
TypeSafeClient, the synchronous Python client: ask questions, list models, and set the key, model, retry policy, and HTTP timeout.
Jev Repos & SDKsDocs#official#docs#sdk
Official
Shared Python SDK types: JSONValue, a nested JSON-like value that may be None, and descriptions built from strings or JSON values.
Jev Repos & SDKsDocs#official#docs#sdk
Official
From the Jev guides
Original write-ups on what this entry is for.
Every decision path has a failure posture, whether you chose one or not. How to put retries in the client, bound the whole call, and make the fallback an explicit, per-action policy.
Jev Practices & Patterns#reliability#retries#api
Read article
Closed weights have not stopped the ecosystem from rebuilding the shape in the open. API-compatible servers, retrained heads on small models, and inference-time tricks that skip generation entirely.
Jev Repos & SDKs#open-models#research#local
Read article
From the Jev community
Posts from builders shipping with Jev right now.