builders · review · first seen Dec 4, 10:33 UTC
Anthropic Python SDK v2.17.0 fixes retries and header handling
Anthropic Python SDK v2.17.0 shipped changes to response-body retries, connection errors, and the headers visible to middleware (1770, 1771). Builders with request hooks or middleware should check failure handling and credential redaction before treating this as a routine update (1770, 1771).
In short
- A dropped response body after x-should-retry: false now raises after one request (1770).
- Middleware can see SDK credentials in APIRequest.headers; redact and check merge order (1771).
- The beta project list and new error code shipped, but their usage is not specified here (1768, 1769).
What shipped
The v2.17.0 release notes say the client no longer retries a dropped or timed-out response body when the response carried x-should-retry: false. It raises the same error after one request. This is a narrow rule: it concerns a failure while reading the response body after that header was received. The notes do not say that all connection failures stop retrying or that the error type changes in this case. Treat the header and the phase of the failure as part of the behavior you test. [1]
The release notes also say connection error messages now name the host, cause, and timeout. The client now raises APITimeoutError when a request hook replaces the request's extensions. Those changes matter if your hooks alter requests or your diagnostics consume error messages. They are separate from the x-should-retry: false fix; do not read the one-request behavior as a blanket change to timeout handling. The supplied excerpt does not give an exhaustive list of affected paths. [1]
APIRequest.headers now includes the SDK's headers, default_headers, and credentials, including an authorization header built from api_key or auth_token, beneath the call's headers. Client header names are lowercase; call header names retain their casing. The release also adds a beta analytics list of projects in the new projects experience and the organization_url_fetch_disabled error code. Those additions shipped in v2.17.0, but the supplied notes give no usage example for either one. Inspect the header change first if middleware reads or rewrites requests. [1][2][3]
Why it matters if you build
An operation that receives x-should-retry: false and then loses the response body now surfaces the error after one request. For a builder, that changes the request count in this specific failure path and puts any further recovery decision in code above the SDK. It does not establish whether your application should retry. Review any assumption that every dropped body gets another SDK attempt, and test this branch rather than inferring its behavior from a generic connection failure. [1]
Header-aware middleware has a different view of the request. A logger that records request.headers can now record credentials unless it redacts them, matching header names without regard to case. A writer using {"x-team": "mine", **request.headers} will send the client's x-team if one is present, because the later expansion wins. Put your header after **request.headers if you mean to override the client value. These are concrete ordering and exposure issues for existing wrappers, not evidence that every header changed. [1]
For incident triage, the host, cause, and timeout in connection error messages give you fields to inspect, while the APITimeoutError change gives request-hook users an exception path to check. Neither statement supplies a benchmark, a count of affected requests, or a guarantee that existing log filters remain safe. The beta project list and new error code are worth noting if your integration covers those areas, but the excerpt does not describe their request shape or handling contract. Do not build against details absent from the supplied notes. [1][2][3][4]
How to try it today
- Inspect middleware that reads APIRequest.headers; redact credentials using case-insensitive header-name matching (1771).
- Check any merge shaped like {"x-team": "mine", **request.headers}; put your override after the expansion if that is the intended precedence (1771).
- Exercise a response-body drop or timeout after x-should-retry: false; check that the error is raised after one request (1770).
- If a request hook replaces extensions, check your handling of APITimeoutError and inspect the changed connection error messages (1770).
What we checked
Every claim below was walked down the source ladder. The rung is how close the source is to the thing itself; the tense is the source's own.
-
shipped L0 · primary
Anthropic Python SDK v2.17.0 adds a beta analytics list of projects in the new projects experience.
per GitHub releases · anthropics/anthropic-sdk-python (L0) -
shipped L0 · primary
Anthropic Python SDK v2.17.0 adds the organization_url_fetch_disabled error code.
per GitHub releases · anthropics/anthropic-sdk-python (L0) -
shipped L0 · primary
When a response body read fails after x-should-retry: false, the client raises the error after one request instead of retrying.
per GitHub releases · anthropics/anthropic-sdk-python (L0) -
shipped L0 · primary
APIRequest.headers now includes the SDK's default headers and credentials for middleware.
per GitHub releases · anthropics/anthropic-sdk-python (L0)
What is not confirmed
The supplied release excerpt does not establish retry behavior for responses without x-should-retry: false, how to invoke the beta project list, or when organization_url_fetch_disabled is returned. It does not quantify performance, operational cost, or the prevalence of affected requests. It also cannot tell you whether your application's logger already redacts authorization headers. Check those local facts before changing production retry policy or claiming a measured improvement. [1][2][3][4]
Who should act, who should wait
Move now if your Python SDK integration logs APIRequest.headers, merges custom headers with request.headers, relies on retries after a response-body read failure, or replaces request extensions in a hook. Audit redaction and precedence, then exercise the named error paths in your own client flow. Wait on product work that depends on the beta project-list request shape or a detailed contract for organization_url_fetch_disabled: the supplied excerpt names them but does not explain enough to design that integration. This is an integration check, not a claim that every application must change. [1][2][3][4]
Sources
- v2.17.0 — GitHub releases · anthropics/anthropic-sdk-python L0 · primary