Repository navigation
Keep common.ai on anthropic 1.x until pydantic-ai supports anthropic 2 - #75640
Conversation
pydantic-ai's Anthropic model (up to 2.59.0) calls BetaMessageParam(...), which anthropic 2 turned into a Union, so installing common.ai[anthropic] with anthropic 2 fails with "Cannot instantiate typing.Union" on the first request. Cap anthropic below 2 in the extra and the dev group.
d1b6f0c to
5fb5733
Compare
potiuk
left a comment
There was a problem hiding this comment.
Looks good. The cap is the right minimal fix: pydantic-ai ≤2.59 calls BetaMessageParam(...), which is a Union in anthropic 2, so common.ai[anthropic] currently installs a broken combination.
Non-blocking: this is a workaround cap, so per our contribution guidelines it should have a tracking issue linked from the comment at the cap. pydantic-ai 2.60.0 already supports anthropic 2.x (pydantic/pydantic-ai#11077), so the cap can be lifted once common.ai supports pydantic-ai 2.60.
Heads-up, not caused by this PR: pydantic-ai 2.60.0 clears the uv cooldown on 2026-10-27, and this cap doesn't hold it back (it only needs anthropic>=1.12.1). Locally, 2.60 breaks 13 common.ai tests in the retry and durable-replay paths, for example test_retry_budget.py::TestSQLToolsetInAnAgent::test_the_default_budget_still_ends_the_run ("DID NOT RAISE UnexpectedModelBehavior") and the durable/test_capability.py replays (ValidationError for ModelResponse). That lines up with the 2.60 compatibility notes: RetryPromptPart is deprecated in favour of ToolReturnPart(outcome='retried'), and streamed responses are now replayed as the final response. So tomorrow's upgrade PR will probably fail again, and the released 1.1.0 may already be affected for anyone who installs pydantic-ai 2.60+. That probably needs either a pydantic-ai-slim<2.60 cap or the migration, plus a common.ai follow-up release.
Drafted-by: Claude Code (Opus 5); reviewed by @potiuk before posting
pydantic-ai's Anthropic model (up to 2.59.0) calls BetaMessageParam(...), which anthropic 2 turned into a Union, so installing common.ai[anthropic] with anthropic 2 fails with "Cannot instantiate typing.Union" on the first request.
Cap anthropic below 2 in the extra and the dev group.
Was generative AI tooling used to co-author this PR?
{pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.