Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Airflow Knowledge Patch?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/nevaberry-airflow-knowledge-patch)
---
name: airflow-knowledge-patch
description: Apache Airflow
version: "3.4.0"
license: MIT
metadata:
author: Nevaberry
---
# Apache Airflow Compatibility and Development
Load this skill when upgrading Airflow, authoring DAGs or extensions, or changing
scheduling, assets, task execution, deployment configuration, APIs, or CLI scripts.
Use the topic references for detailed guidance and version-specific behavior.
| Reference | Topics |
| --- | --- |
| [Upgrade and compatibility](references/upgrade-and-compatibility.md) | Upgrade procedure, public imports, metadata access, runtimes, dependencies, images, database migrations, DAG bundles |
| [Task authoring and execution](references/task-authoring-and-execution.md) | Context, templates, TaskGroups, loops, XCom, state, retries, sensors, triggers, callbacks, human input, language runtimes, testing |
| [Scheduling, assets, and deadlines](references/scheduling-assets-and-deadlines.md) | Timetables, logical dates, backfills, reruns, asset events, partitions, Deadline Alerts |
| [Operations, logging, and extensions](references/operations-logging-and-extensions.md) | API server, DAG processor, executors, workers, secrets, teams, logs, metrics, SMTP, plugins, cleanup |
| [API, CLI, and UI](references/api-cli-and-ui.md) | Authentication, permissions, requests, filters, results, asset and state endpoints, connection testing, administration, UI |
## Breaking changes and deprecations
### Upgrade procedure
Upgrade to Airflow 2.7 or later before migrating to 3. Run
`airflow dags reserialize` on the 2.x instance and resolve DAG-processing errors.
Install `apache-airflow-providers-standard` on 2.x to migrate operator and sensor
imports before upgrading core.
Use Ruff 0.13.1 or newer. `AIR301` and `AIR302` flag breaking changes;
`AIR311` and `AIR312` flag recommended updates; `F401` catches unused legacy imports.
```bash
ruff check dags/ --select AIR301,AIR302
ruff check dags/ --select AIR311,AIR312,F401
```
Some same-name import rewrites require unsafe fixes; review the resulting diff.
```bash
ruff check dags/ --select AIR301 --fix --unsafe-fixes
```
Run `airflow config update` to check configuration changes and add `--fix` to apply
them. `airflow config lint` finds obsolete keys. Airflow no longer rewrites values
matching deprecated defaults, so set required values explicitly.
### Public imports and metadata access
Extend `airflow.sdk.BaseOperator` or `airflow.sdk.BaseSensorOperator` for a public
base class. Concrete operators' parameters and behavior follow semantic versioning;
their methods may change between releases.
```python
from airflow.sdk import BaseNotifier, BaseOperatorLink, ParamsDict
```
Move `airflow.io` imports to `airflow.sdk.io`. Import task-facing exceptions from
`airflow.sdk.exceptions` and serialization functions from `airflow.sdk.serde`.
The old serialization paths warn and are scheduled for removal in Airflow 4.
Replace `from airflow import Dataset` with `from airflow.sdk import Asset`.
Worker task code is isolated from metadata database sessions and models. Replace
task-side ORM queries with runtime task-instance methods such as `get_dr_count`,
`get_dagrun_state`, or `get_task_states`. DAG author code in the DAG processor and
triggerer can still have direct database access.
For metadata operations outside task context, use `apache-airflow-client` with the
REST API and obtain an access token from `/auth/token`. The upgrade reference
describes the temporary read-only database-query option when the client lacks an
operation, including its worker-access and schema-maintenance requirements.
### Component and API migrations
When launching components individually, start `airflow dag-processor` separately,
even in local development. Replace `airflow webserver` with `airflow api-server`.
Move Helm `webserver` values to `apiServer` and check nested keys for renames and removals.
Migrate `/api/v1` callers to `/api/v2`. API v2 reports invalid inputs with HTTP 422;
update callers that expect HTTP 400 or send `execution_date` instead of
`logical_date`. Use DAG bundles in place of `--subdir` (`-S`) on DAG commands.
Use `airflowctl` for remote operations such as triggering DAGs and managing Connections.
Move the API-server options listed in the operations reference from `[webserver]`
to `[api]`, and its listed DAG-processing options to `[dag_processor]`. Replace `[api] access_logfile`
with `[api] log_config`, and use `[api] fallback_page_limit` instead of deprecated
`[api] page_size`. `[api] workers` defaults to `1`.
### Schedules and task context
An omitted schedule defaults to `None`; set `schedule="@once"` for a DAG that needs
the old one-time automatic run. Bare cron strings use `CronTriggerTimetable`.
Set `create_cron_data_intervals=True` before upgrading to retain
`CronDataIntervalTimetable`; switching back after Airflow 3 runs exist can skip a
scheduled run because of a logical-date collision.
Use `logical_date` in place of `execution_date`. Asset-triggered runs and
REST-triggered runs omitting `logical_date` can lack both a logical date and a data
interval. Read `dag_run.logical_date`, which can be `None`, and use
`context.get("data_interval_start")` or `context.get("data_interval_end")` for optional intervals.
The `conf` context key and `dag_run.external_trigger` were removed; use DAG params
or DAG-run APIs for run configuration. The task reference lists the removed date keys.
A `SKIPPED` task no longer invokes its `on_success_callback`.
### XCom, stored state, and attempt identity
Omitting `task_ids` in `ti.xcom_pull()` reads only from the current task. Supply the
producer ID to read a different task's value. XCom keys must be nonempty.
XCom POST and PATCH store submitted values directly: send native JSON values
without first JSON-encoding them into strings.
Loop DAGs fail to start with XCom backends that still write through `serialize_value`,
including `XComObjectStorageBackend` from `apache-airflow-providers-common-io` 1.10.1
or earlier. Move custom backends to `store_value` and `load_value` using paths from
`XComCoordinate.build_path`; include `scope.region_id` in custom task state backend keys.
Clearing individual task instances deletes stored state by default. Set
`keep_task_state=True` or select **Keep task state** to retain it. Retries and
whole-DAG-run clears still retain state. During `up_for_retry`, `try_number` and
the task-instance UUID identify the pending attempt.
Upgrade every Airflow component to 3.3.1 before introducing pandas 3. Older readers
cannot read DataFrame XComs written under pandas 3, including after a rollback.
The reader's pandas version determines string dtypes and missing-value representation.
### Runtime, database, and worker changes
Airflow 3.4, the Task SDK, and `airflowctl` require Python 3.11 or later. Production
images use Debian 13 and a hardened Python base; custom `BASE_IMAGE` values must
supply Python. `PYTHON_LTO` is removed; FIPS builds should select a hardened FIPS base.
Airflow defaults to psycopg 3 and sets `prepare_threshold = None` by default for
transaction-mode PgBouncer. Each API server worker has separate sync and async pools: budget for up
to 30 connections per worker with defaults, even when serving only one API app.
`[workers] max_failed_heartbeats` is the sole task-heartbeat failure budget and
defaults to 30. At the default 5-second interval, a worker tolerates roughly
`5 × max_failed_heartbeats` seconds before terminating a task; review overrides
against `[scheduler] task_instance_heartbeat_timeout`.
Workers with Task SDK 1.1.x or earlier cannot resume deferred tasks with custom
class instances in `next_kwargs`. Upgrade to 1.2.0 or later, or pass only built-in
values, assets, and asset aliases through defer kwargs and trigger events.
### Authentication, plugins, and email
Airflow 3 defaults to Simple Auth. To keep FAB, install the FAB provider and set
`auth_manager` to `airflow.providers.fab.auth_manager.fab_auth_manager.FabAuthManager`.
Plugin FastAPI apps must enforce authentication and authorization on protected routes.
Invalid or expired explicit API credentials fail even when the session cookie is valid.
Import email helpers from `airflow.providers.smtp.utils.emailer` with
`apache-airflow-providers-smtp>=3.2.0`. Keep
`[email] email_backend = airflow.utils.email.send_email_smtp` for Connection-based
task mail; the provider path as an email backend uses `[smtp]` settings.
Configure the email backend and credentials on the DAG processor.
## Task authoring and scheduling features
### Mapping, loops, async tasks, and persistent state
A `@task_group` can expand over inputs; tasks inside run depth-first so downstream
work can proceed when dependencies for the same input are ready. Call `.loop()` on
a decorated TaskGroup for a runtime-determined number of repetitions using previous
results. A conditional loop with `until` and `max_iterations` runs its body at least once.
Pass an `async def` callable directly to `PythonOperator`; it handles the event loop.
Async tasks can use async XCom, task-state, and asset-store accessors, along with
Variable methods `aget`, `aset`, `adelete`, and `akeys`.
Use `task_state_store` and `asset_state_store` for JSON values across retries and runs.
Set `retry_policy` to decide whether and when a task retries; a retry policy can also
reschedule a task without consuming a retry. Set `render_template_as_native_obj=True`
for native values or `False` for strings per operator. Use `literal` from
`airflow.sdk` to protect a value from rendering.
### Asset scheduling and partitions
Use `Asset`, `AssetAlias`, or `Asset.ref(...)` as asset event mapping keys.
Single-asset and asset OR schedules create one run per event; already serialized
timetables retain batching until reparsed. To preserve batching, set
`batch_asset_events=True` on the timetable or enable `[scheduler] batch_asset_events`.
Keep batching enabled for asset AND, asset lists, and `RollupMapper`, which reject
`batch_asset_events=False`. Use `AssetAndTimeSchedule` to combine asset and time conditions.
Use `RollupMapper` for many-to-one mapping, `FanOutMapper` for one-to-many mapping,
and `FixedKeyMapper` with `SegmentWindow` for categorical rollups. `WaitForAll`
waits for every upstream partition in a window; `MinimumCount(2)` runs after two arrive.
Read `partition_key` from task context and upstream keys from
`triggering_asset_events` or `dag_run.consumed_asset_events`.
### Deadlines, human input, and run control
Deadline Alerts are experimental. A DAG can mix `SyncCallback` and `AsyncCallback`
in a `deadline` list. `SyncCallback` can resolve Connections and Variables from
3.3.0. Use `timedelta` or `VariableInterval`: numeric seconds are deprecated and
booleans are rejected. Upgrade core and `apache-airflow-task-sdk` together on workers
running synchronous Deadline Alerts.
Install the standard provider for `HITLOperator`, `ApprovalOperator`, or
`HITLEntryOperator`. Check `awaiting_input` for tasks waiting for human responses;
the triggerer handles the wait. `airflow dags test` waits for the required response.
Create and monitor scheduler-managed backfills through the UI or REST API.
For rerun bundle selection, Airflow checks an explicit request or CLI flag, the DAG's
`rerun_with_latest_version`, then `[core] rerun_with_latest_version`. With all unset,
clear and rerun use the original version; backfill keeps its existing default.
Set `scheduling_state` to `draining` to stop new scheduled and asset-triggered runs,
allow explicit triggers, and pause automatically when outstanding runs finish.
For manual triggers, backfills, or asset materialization on paused DAGs, send
`"drain_dag": true` or select **Drain**. Resume paused backfills whose unfinished runs
prevent draining from completing.