How Do You Add Human Approval and Safe Retries to AI Agent Tasks in Airflow?
Five steps using the Common AI provider 1.0: approval gates, deny-by-default timeouts and retry policies that never let the model pick the delay
To add human approval to an AI agent task in Airflow, mark the toolset with .approval_required() from the Common AI provider (apache-airflow-providers-common-ai), which needs Airflow 3.3 or later. Each tool call then pauses the task in an awaiting_input state until someone approves or rejects it on the Required Actions tab. For safe retries, attach a retry_policy so a failure is classified before it is retried. Both are described in the Airflow Common AI provider 1.0 announcement.
Key Takeaways
- •Tool approval (Airflow 3.3) pauses the task on each approval-marked tool call until a human approves or rejects it; a rejection is reported to the agent, which keeps running.
- •Set
tool_approval_timeoutwithon_tool_approval_timeout="deny"so an unanswered request fails closed instead of hanging or proceeding. - •
ClassifierRetryPolicylets the model choose a failure category while the category, not the model, sets the retry behavior and delay. - •Retries are only safe when the tool call is idempotent or its result is recorded; approval and retry policy do not make a non-idempotent write safe on their own.
- •Tool approval cannot be combined with
durable=True,enable_hitl_review, or aSandboxToolsetthat starts its own sandbox, so pick the combination per task.
Why agent tasks need different guardrails than normal tasks
A conventional Airflow task does the same thing every run, so a retry means running the same code again. An agent task decides at runtime which tools to call and with what arguments. Two runs of the same task can touch different tables. A blind retry can therefore repeat a write the first attempt already made, and a model that is trusted to decide freely can drop a table nobody expected it to touch.
The Model Context Protocol states the same principle for tool use. The MCP specification on tools says there should always be a human in the loop with the ability to deny tool invocations. Airflow's provider turns that guidance into a scheduler-visible state, which matters because your on-call engineer already watches Airflow.
The provider is no longer a niche add-on. The release post reports 133,152 downloads from pypistats in the 30 days to October 19, 2026, per the Common AI provider 1.0 post. That is enough adoption that teams will meet the failure modes in this guide in production.
Step 1: Mark the tools that need a human
Do not gate everything. Approval fatigue is real: if a reviewer clicks approve forty times a day, the forty-first click is not a review. Split the toolset by blast radius. Read-only tools such as schema lookups and row counts run freely. Anything that writes, deletes, grants access or spends money goes into a toolset marked with .approval_required().
When the agent calls a marked tool, the task enters awaiting_input and the call appears on the Required Actions tab. A reviewer approves or rejects it. On rejection the agent is told the call was denied and continues, so it can pick a safer path or report that it could not finish. That behavior is documented in the provider release post.
A practical rule: if you would want to see the exact arguments before the call runs, mark the tool. A DROP, an ALTER, a GRANT, a cost-bearing batch job and a message to an external channel all qualify. A SELECT COUNT(*) does not.
Step 2: Make an unanswered approval fail closed
An approval request that nobody answers is a decision by default, so choose the default deliberately. The provider exposes tool_approval_timeout and on_tool_approval_timeout="deny". With deny, a request that times out is treated as rejected and the agent carries on without the action.
Set the timeout to match your on-call reality, not the task's runtime. A nightly pipeline whose approver is asleep should usually time out and deny, then surface the skipped action in the morning. A business-hours task can wait longer. Either way, write down who owns the Required Actions queue; a queue without an owner is where approvals go to expire.
Record every approval, rejection and timeout in your audit log with the tool name and arguments. If a regulator or a postmortem later asks who allowed a grant on a PII table, the answer should be a log line, not a memory.
Step 3: Choose between tool approval, output approval and review
The provider has three human-in-the-loop controls, and they guard different things. Tool approval (Airflow 3.3) gates individual actions mid-run. Output approval, set with require_approval on LLM operators (Airflow 3.1), gates the final answer before it moves downstream. HITL review, enabled with enable_hitl_review (Airflow 3.1), runs a chat on the task instance page so a person can iterate with the agent.
Use tool approval when the risk is a side effect, output approval when the risk is a wrong answer feeding a downstream job, and review when a person should shape the result. They are not freely combinable. The release post says tool approval cannot be used with durable=True, enable_hitl_review, or a SandboxToolset that starts its own sandbox, so check that matrix before you design the task.
For pipelines that write to production tables, we usually want tool approval on the write tools and output approval on anything a downstream task consumes. That leaves reads fast and puts a human on the two points where a mistake spreads.
Step 4: Replace blanket retries with a retry policy
Default Airflow retries treat every failure alike: wait, try again, up to N times. For an agent that is wasteful and sometimes dangerous. A revoked API key will not fix itself in three retries, and a rate-limit error needs a delay, not an immediate hammer. From Airflow 3.3, operators accept a retry_policy for exactly this.
The provider ships two. LLMRetryPolicy has a model read the failure and decide whether to retry and after what delay. ClassifierRetryPolicy has the model pick a category, and each category defines the retry behavior, so the model never chooses the delay. In the provider's example, a revoked-key 403 failed immediately and skipped its three retries, while a 429 throttling error retried after 60 seconds and succeeded, per the release post.
We prefer the classifier for production. A model that picks its own delay can pick a bad one, and it is hard to reason about in an incident. With categories, you can read the policy table and know what will happen. The provider also offers fallback_rules, which need no model, and fallback_policy, used when the model call fails or confidence falls below min_confidence.
Step 5: Make the retried action idempotent
A retry policy decides whether to retry. It cannot tell you whether retrying is safe. If the first attempt created a table, granted a role or sent a message before failing, running it again can duplicate the effect. Design write tools to be idempotent: CREATE ... IF NOT EXISTS, MERGE on a natural key, grants that can be applied twice, and a request ID the target system can deduplicate.
The provider also offers durable execution through AirflowDurability. In its example, 13 recorded steps replayed in about 50 milliseconds on retry, so completed model and tool steps are not repeated. Durable execution needs no extra configuration from Airflow 3.3, and before that it needs [common.ai] durable_cache_path. Remember the conflict: durable=True cannot be paired with tool approval.
From Airflow 3.3, usage_limits are counted across retries, which is the cost guard you want: a retry loop cannot quietly triple a token budget. Set a limit on every agent task, and treat a limit breach as a failure that needs a human, not a retry.
Where the swarm fits
Approval inside one DAG protects one DAG. The harder case is a pipeline break that crosses systems: a schema change, a governance policy and a failed run. Our Pipeline Agent works across Airflow, Dagster, Prefect, dbt and Fivetran, and the Data Workers agents share context so the approval request arrives with the blast radius and the cause already attached.
We apply the same pattern with a per-domain autonomy dial. Read-only investigation runs on its own, and writes route to a human until the team has watched enough clean runs to loosen the dial. The OSS edition is read-only by default, and Pro adds writes with approval workflows and audit trails.
Because every agent is an MCP server, the approval request can appear in Claude Code or Cursor, where the engineer already works, instead of a separate dashboard. The Airflow Required Actions tab remains the system of record for the task itself.
Frequently Asked Questions
Which Airflow version do I need for tool approval?
Tool approval that pauses a task needs Airflow 3.3 or later. Output approval and HITL review are available from Airflow 3.1. The provider itself installs on Airflow 2.11 and later with Python 3.11 or later, but the pausing approval and retry policy features depend on the Airflow versions listed in the provider release post. Airflow 3.4 adds an AI Model tab on the task instance page and task loops.
What happens if a reviewer rejects a tool call?
The agent is told the call was denied and continues running. It can choose another tool, change its plan or report that it could not complete the step. The task does not fail by default, so your downstream logic should check whether the intended action actually happened before assuming success.
Can I combine approval with durable execution or a sandbox?
Not freely. Tool approval cannot be combined with durable=True, enable_hitl_review, or a SandboxToolset that starts its own sandbox. Sandboxes are also marked experimental in the release. If you need approval, keep the task simple, make writes idempotent and use output approval for the final result.
Do I need a model call to retry safely?
No. fallback_rules work without a model, and plain Airflow retries still apply. A model-driven policy helps when failures are ambiguous, such as telling a transient throttle from a permanent credential error. For many tasks, a fixed rule table is easier to audit and cheaper to run. The Pydantic AI project, which the provider's own operators are built on, is documented in its GitHub repository.