Skip to content

Keep common.ai on anthropic 1.x until pydantic-ai supports anthropic 2 - #75640

Merged
potiuk merged 1 commit into
apache:mainfrom
astronomer:common-ai-cap-anthropic-2
Oct 26, 2026
Merged

potiuk merged 1 commit into
apache:mainfrom
astronomer:common-ai-cap-anthropic-2

Conversation

@Lee-W

@Lee-W Lee-W commented Oct 26, 2026

Copy link
Copy Markdown
Member

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?
  • Yes (please specify the tool below)

  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {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.

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.
@Lee-W
Lee-W force-pushed the common-ai-cap-anthropic-2 branch from d1b6f0c to 5fb5733 Compare October 26, 2026 09:38
@potiuk
potiuk marked this pull request as ready for review October 26, 2026 20:17

@potiuk potiuk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@potiuk
potiuk enabled auto-merge (squash) October 26, 2026 20:17
@potiuk
potiuk merged commit dac0a7a into apache:main Oct 26, 2026
125 checks passed
@Lee-W
Lee-W deleted the common-ai-cap-anthropic-2 branch November 9, 2026 08:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants