PagerDuty Airflow Provider
raw JSON → 5.2.4 verified Sat Apr 25 auth: no python
The `apache-airflow-providers-pagerduty` package provides Apache Airflow integrations for PagerDuty, enabling users to send incident notifications and interact with the PagerDuty API directly from Airflow DAGs. It supports both the PagerDuty REST API and Events API. The current version is 5.2.4 and it follows the Apache Airflow provider release cadence, with frequent updates addressing features, bug fixes, and compatibility.
pip install apache-airflow-providers-pagerduty Common errors
error ModuleNotFoundError: No module named 'airflow.providers.pagerduty' ↓
cause The 'apache-airflow-providers-pagerduty' package is not installed or not properly configured.
fix
Install the package using 'pip install apache-airflow-providers-pagerduty'.
error ImportError: cannot import name 'PagerdutyHook' from 'airflow.providers.pagerduty.hooks.pagerduty' ↓
cause The 'PagerdutyHook' class has been moved or renamed in recent versions of the provider package.
fix
Update the import statement to 'from airflow.providers.pagerduty.hooks.pagerduty import PagerDutyHook'.
error AttributeError: 'PagerdutyHook' object has no attribute 'create_event' ↓
cause The 'create_event' method has been deprecated and removed in favor of 'send_event'.
fix
Replace 'create_event' with 'send_event' in your code.
error TypeError: send_event() missing 1 required positional argument: 'event' ↓
cause The 'send_event' method requires an 'event' argument that was not provided.
fix
Ensure you pass the required 'event' argument when calling 'send_event'.
error RuntimeError: The package 'apache-airflow-providers-pagerduty' needs Apache Airflow 2.11.0+ ↓
cause The installed version of Apache Airflow is lower than the required version for this provider package.
fix
Upgrade Apache Airflow to version 2.11.0 or higher.
Warnings
breaking Provider version 5.0.0 removed all deprecated classes, parameters, and features. Ensure your code does not rely on any previously deprecated components. ↓
fix Refer to the official changelog for specific removals. Update your code to use current API methods.
breaking Minimum Apache Airflow version required is 2.11.0. Older Airflow versions are not supported. ↓
fix Upgrade your Apache Airflow environment to at least version 2.11.0. If upgrading from Airflow <2.1.0, an `airflow upgrade db` might be necessary.
breaking Python 3.9 support was dropped with version 5.0.1. Ensure your environment uses Python 3.10 or newer. ↓
fix Upgrade your Python environment to version 3.10 or later.
gotcha When configuring a PagerDuty connection in Airflow, there are two main types: 'Pagerduty' for the REST API (requires an API token in the 'Password' field) and 'Pagerduty Events' for the Events API (requires an Integration Key). Using the wrong type or credential will lead to authentication failures. ↓
fix Select the correct connection type in the Airflow UI (Admin -> Connections) and provide the corresponding API token or Integration Key in the designated field. For Events API, the integration key can often be passed directly to the `send_pagerduty_notification` function.
gotcha An issue (reported in Jan 2025 as #45626) indicated that the `PagerdutyNotifier` class's `notify` method was attempting to use a `create_event` method that no longer existed, leading to failed notifications. While this might be resolved in current versions, using the `send_pagerduty_notification` function directly in callbacks is often a more robust and commonly demonstrated approach. ↓
fix Prefer using the `send_pagerduty_notification` function for DAG/task callbacks. If using `PagerdutyNotifier`, ensure your provider version is sufficiently updated and test the notification flow thoroughly.
Install compatibility last tested: 2026-04-25
runtime status import time mem disk
3.10-alpine 5.19s 64.8MB 253.1M
3.10-slim 3.64s 64.8MB 253M
3.11-alpine 6.26s 70.1MB 273.9M
3.11-slim 5.75s 70.1MB 274M
3.12-alpine 5.85s 68.9MB 264.0M
3.12-slim 6.36s 68.9MB 265M
3.13-alpine 5.05s 69.5MB 265.7M
3.13-slim 5.94s 69.5MB 267M
3.9-alpine 5.33s 58.8MB 211.1M
3.9-slim 5.15s 58.8MB 206M
Imports
- PagerdutyHook
from airflow.providers.pagerduty.hooks.pagerduty import PagerdutyHook - send_pagerduty_notification
from airflow.providers.pagerduty.notifications.pagerduty import send_pagerduty_notification - PagerdutyNotifier wrong
from airflow.providers.pagerduty.notifications import PagerdutyNotifiercorrectfrom airflow.providers.pagerduty.notifications.pagerduty import PagerdutyNotifier
Quickstart
import os
from datetime import datetime
from airflow.models.dag import DAG
from airflow.operators.bash import BashOperator
from airflow.providers.pagerduty.notifications.pagerduty import send_pagerduty_notification
PAGERDUTY_INTEGRATION_KEY = os.environ.get('PAGERDUTY_INTEGRATION_KEY', '')
with DAG(
dag_id='pagerduty_notification_example',
start_date=datetime(2023, 1, 1),
schedule=None,
catchup=False,
tags=['pagerduty', 'notification'],
on_failure_callback=[
send_pagerduty_notification(
summary="The DAG {{ dag.dag_id }} failed!",
severity="critical",
source="airflow dag_id: {{dag.dag_id}}",
dedup_key="{{dag.dag_id}}-failure",
component="airflow",
integration_key=PAGERDUTY_INTEGRATION_KEY,
)
]
) as dag:
start_task = BashOperator(
task_id='start_task',
bash_command='echo "Starting DAG..."',
)
failing_task = BashOperator(
task_id='failing_task',
bash_command='exit 1', # This task will intentionally fail
on_failure_callback=[
send_pagerduty_notification(
summary="Task {{ ti.task_id }} failed in DAG {{ dag.dag_id }}",
severity="error",
source="airflow task_id: {{ti.task_id}}",
dedup_key="{{dag.dag_id}}-{{ti.task_id}}-failure",
component="airflow",
integration_key=PAGERDUTY_INTEGRATION_KEY,
)
]
)
success_task = BashOperator(
task_id='success_task',
bash_command='echo "DAG succeeded!"',
)
start_task >> failing_task >> success_task