apache-airflow-providers-common-ai

Run model calls and tool-using agents as Airflow tasks. A task can classify, extract, summarize or route with any model vendor, or hand a model a set of tools built from your Airflow connections and let it work. Airflow supplies what a script does not: the API key comes from a connection, a failed call retries, a run can pause for a person to approve the output, the result lands in XCom for the next task, and the whole thing runs on a schedule.

Start here

This is the Dag the quick start runs. The summarize task sends the release notes to the model on the pydanticai_default connection; publish receives the answer like any other upstream result:

airflow/providers/common/ai/example_dags/example_quickstart.py[source]

from airflow.sdk import dag, task

RELEASE_NOTES = """
Changes since the last release:
- Tasks can now carry a retry policy that decides whether a failure is worth retrying.
- Heartbeat writes are batched, which cut metadata database load by about a third in testing.
- Fixed a crash when two tasks in one Dag file shared a task id.
- Dropped support for Python 3.9.
"""


@dag(schedule=None, tags=["example"])
def quickstart_llm():
    @task.llm(llm_conn_id="pydanticai_default", system_prompt="You write release announcements. Be concise.")
    def summarize(notes: str):
        return f"Summarize these release notes in two sentences for a team status update:\n{notes}"

    @task
    def publish(summary: str) -> dict[str, str | int]:
        print(f"Release summary: {summary}")
        return {"summary": summary, "characters": len(summary)}

    publish(summarize(RELEASE_NOTES))


quickstart_llm()

Point pydanticai_default at OpenAI, Anthropic, Google, Bedrock or a self-hosted server and the Dag does not change. Core concepts explains the ideas behind the provider in one page.

When to use this provider

Use case

Use

Package

Portable generation, classification, extraction, branching, or a worker-run agent with toolsets

common.ai

apache-airflow-providers-common-ai

Many prompts through a batch API at half the price, with retry-safe re-attachment and results landed on object storage

common.ai

apache-airflow-providers-common-ai (Batch processing: LLMBatchOperator)

A vendor’s native Embeddings or Responses API, or a batch of raw provider request bodies (multi-turn, images, non-chat endpoints)

The vendor’s own provider

e.g. apache-airflow-providers-openai, apache-airflow-providers-anthropic, apache-airflow-providers-cohere

A vendor-managed, server-side agent session (e.g. Anthropic Managed Agents)

The vendor’s own provider

e.g. apache-airflow-providers-anthropic

As a rule of thumb: if Airflow should run the AI step (and the model should stay swappable), use common.ai; if the Dag submits work to a vendor-managed service and waits for the result, use that vendor’s provider.

apache-airflow-providers-common-ai package

AI/LLM hooks and operators for Airflow pipelines using pydantic-ai.

Release: 0.10.0

Provider package

This package is for the common.ai provider. All classes for this package are included in the airflow.providers.common.ai python package.

Installation

You can install this package on top of an existing Airflow installation via pip install apache-airflow-providers-common-ai. For the minimum Airflow version supported, see Requirements below.

Requirements

The minimum Apache Airflow version supported by this provider distribution is 3.0.0.

PIP package

Version required

apache-airflow

>=3.0.0

apache-airflow-providers-common-compat

>=1.15.0

apache-airflow-providers-standard

>=1.20.0

pydantic-ai-slim

>=2.33.0

Optional cross provider package dependencies

Those are dependencies that might be needed in order to use all the features of the package. You need to install the specified provider distributions in order to use them.

You can install such cross-provider dependencies when installing from PyPI. For example:

pip install apache-airflow-providers-common-ai[common.sql]

Dependent package

Extra

apache-airflow-providers-common-sql

common.sql

apache-airflow-providers-git

git

Optional dependencies

These extras install optional third-party libraries that enable additional features of the provider. Install them when installing from PyPI. For example:

pip install apache-airflow-providers-common-ai[anthropic]

Extra

Dependencies

anthropic

pydantic-ai-slim[anthropic]>=2.33.0, anthropic>=1.0.0

bedrock

pydantic-ai-slim[bedrock]>=2.33.0

google

pydantic-ai-slim[google]>=2.33.0

openai

pydantic-ai-slim[openai]>=2.33.0, openai>=2.47.0

typesafe

typesafe-sdk>=0.6.0

mcp

pydantic-ai-slim[mcp]>=2.33.0

modal

modal>=1.5.0

code-mode

pydantic-ai-harness[codemode]>=0.3.0

shields

pydantic-ai-shields>=0.3.4

skills

apache-airflow-providers-git>=0.4.0, pydantic-ai-skills>=1.2.0

avro

fastavro>=1.10.0; python_version < "3.14", fastavro>=1.12.1; python_version >= "3.14"

parquet

pyarrow>=18.0.0; python_version < '3.14', pyarrow>=22.0.0; python_version >= '3.14'

sql

apache-airflow-providers-common-sql>=1.33.0, sqlglot>=30.0.0

common.sql

apache-airflow-providers-common-sql>=1.33.0

langchain

langchain>=1.0.0

llamaindex

dataclasses-json>=0.6.7, llama-index-core>=0.14.5, llama-index-embeddings-openai>=0.6.0, llama-index-llms-openai>=0.6.8

pdf

pypdf>=4.0.0

docx

python-docx>=1.0.0

git

apache-airflow-providers-git

Downloading official packages

You can download officially released packages and verify their checksums and signatures from the Official Apache Download site

Was this entry helpful?