kaxil opened a new pull request, #69003:
URL: https://github.com/apache/airflow/pull/69003
New provider `apache-airflow-providers-anthropic` for the Anthropic Claude
API, so Dag authors call Claude through the official Anthropic Python SDK
instead of embedding SDK calls in task code.
It ships:
- **`AnthropicHook`** — builds the right client for the configured platform:
first-party API, Amazon Bedrock, Google Vertex AI, Claude Platform on AWS, and
Microsoft Foundry. Supports keyless **Workload Identity Federation**
(configured on the connection or resolved from the environment).
- **`AnthropicBatchOperator`** (deferrable) + **`AnthropicBatchSensor`** +
**`AnthropicBatchTrigger`** — the Message Batches API (submit → defer →
collect).
- **`AnthropicAgentSessionOperator`** (deferrable) +
**`AnthropicAgentSessionTrigger`** — Managed Agents sessions (message and
outcome runs).
- Connection form fields (platform, default model, cloud region/resource)
render as **labelled inputs** via declarative `conn-fields`, not raw Extra JSON.
## Design rationale
- **Separate provider, not part of `common.ai`.** `common.ai` is a
provider-agnostic abstraction; this provider exposes Anthropic-specific
surfaces (Message Batches, Managed Agents, token counting, the platform
clients) that do not fit a neutral interface. Users who want a
provider-agnostic layer keep using `common.ai`; users who want direct
Claude/SDK features use this one.
- **Batch-centric operators.** A one-shot message is a single hook call; the
operator-level value is the asynchronous Message Batches workflow, which is
what the operator/trigger/sensor model.
- **Airflow 3+ only.** Airflow 2 is EOL; the provider uses the Task SDK
execution model and the AF3 connection-form metadata.
- **Deferrable and synchronous paths stay symmetric.** Deferrable mode
releases the worker slot during long batches/sessions; `deferrable=False`
mirrors the same cancel-on-timeout (batch) / archive-on-timeout (session)
teardown so neither mode leaks a server-side resource.
- **`model` on the connection.** The default model is read from
`extra['model']` so it changes without editing DAGs; it falls back to
`claude-opus-4-8`.
## Notes / gotchas
- First-party-only endpoints (Message Batches, token counting, the Models
API) are gated to `platform` in {anthropic, aws}; calling them on
Bedrock/Vertex/Foundry raises a clear error rather than a raw 404.
- Ships as `state: not-ready` / `lifecycle: incubation` while the Managed
Agents beta surface stabilises.
- Floors `anthropic>=0.101.0` (introduced `AnthropicAWS`); verified against
0.109.x.
---
##### Was generative AI tooling used to co-author this PR?
<!--
If generative AI tooling has been used in the process of authoring this PR,
please
change below checkbox to `[X]` followed by the name of the tool, uncomment
the "Generated-by".
-->
- [ ] Yes (please specify the tool below)
<!--
Generated-by: [Tool Name] following [the
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
-->
---
* Read the **[Pull Request
Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#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](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals))
is needed.
* When adding dependency, check compliance with the [ASF 3rd Party License
Policy](https://www.apache.org/legal/resolved.html#category-x).
* For significant user-facing changes create newsfragment:
`{pr_number}.significant.rst`, in
[airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments).
You can add this file in a follow-up commit after the PR is created so you
know the PR number.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]