Limit anthropic provider to anthropic SDK below 1.0.0 - #72072
Conversation
anthropic 1.0.0 replaces httpx with httpx2 and is a major release the provider has not been validated against. Once the CI environment upgrade pulled it into uv.lock, MyPy providers checks started failing on every PR built on top of it, blocking unrelated work such as the provider release PR apache#72069. Cap the dependency until the provider is migrated to the 1.x SDK, tracked in apache#72071.
amoghrajesh
left a comment
There was a problem hiding this comment.
Reposting from slack.
I just ran both SDK versions side by side to get past guessing which one to pick.
The provider is close to 1.x anthropic api. Everything our provider imports still exists in 1.0.0, including the beta managed-agents types, all 16 client call paths resolve, and the full unit suite passes: 204/204 against anthropic==1.0.0
The mypy failure is the only thing 1.0 breaks in our tree, and it is one test helper, because BadRequestError's response param went from httpx.Response to httpx2.Response.
So type: ignore in #72088 is correct as far as it goes. I thought and my problem with landing only that: it clears the one loud symptom and leaves us floating into 1.x, and two issues are hiding which our tests dont catch today.
Bedrock and AWS region no longer self-resolves. get_conn passes aws_region=extras.get("aws_region"), so None when the extra is unset.
On 0.125 that warns and defaults to us-east-1. On 1.0 it raises ValueError. Our test mocks AnthropicBedrock, and the comment above it says "pass None so the SDK falls back to its own resolution", which is the exact assumption 1.0 removed. Existing Bedrock users relying on the default would break at runtime with a green test suite.
Picks up the anthropic SDK cap (apache#72072), which fixes the MyPy providers check that was failing on every PR built on the previous main.
anthropic 1.0.0 replaces httpx with httpx2 and is a major release the provider has not been validated against. Once the CI environment upgrade pulled it into uv.lock, MyPy providers checks started failing on every PR built on top of it, blocking unrelated work such as the provider release PR apache#72069. Cap the dependency until the provider is migrated to the 1.x SDK, tracked in apache#72071.
anthropic SDK 1.0.0 (released 2026-08-20) replaces
httpxwithhttpx2(pydantic's fork) and is a major release the provider has not been validated against. Once the automated CI environment upgrade (#72016) pulledanthropic==1.0.0intouv.lock, "MyPy providers checks" started failing on every PR built on top of it:This blocks unrelated PRs — first seen on the provider release PR #72069.
This PR caps the provider dependency to
anthropic>=0.121.0,<1.0.0(main dependency and thebedrock/vertex/awsextras) and regeneratesuv.lock, which now resolvesanthropic==0.125.0back on classichttpx.The migration to the 1.x SDK and removal of the cap is tracked in #72071.
Tested:
prek run --from-ref upstream/main --to-ref HEAD --stage pre-commitpasses;uv.lockverified to resolveanthropic==0.125.0(httpx-based), which is the version the last green main canary MyPy run used.Was generative AI tooling used to co-author this PR?
Generated-by: Kiro CLI (claude-fable-5) following the guidelines