Data on-call at 2 a.m. is a ritual: open the failed task's logs, scroll past 400 lines of scheduler noise, find the actual exception, remember whether this happened before, decide rerun-vs-fix. Most of that ritual is mechanical context assembly — which is exactly what an LLM does well.
Tier: Core · Workflow area: Orchestration, ops & cost
This playbook pipes task logs plus DAG context to an LLM that returns a probable cause, similar past incidents, and a suggested next action, wired into your on-call flow. The copilot diagnoses; the human decides.
Not a fit if your failures are dominated by one known flaky dependency — fix that first; a copilot summarizing the same root cause nightly is expensive alerting.
Assemble the evidence bundle automatically. On task failure (Airflow 3 failure callback or a listener on the API), collect: the last ~200 lines of task logs (tail, not head), the task's operator and rendered params, the DAG-run context (logical date, upstream states, recent code change SHA), and — the differentiator — the last N similar failures from an incident table (same dag/task, error signature via a normalized hash of the exception line).
Prompt for a structured diagnosis.
A data pipeline task failed. Diagnose it.
Evidence:
- dag: orders_pipeline, task: load_orders, logical_date: 2026-07-27
- operator + rendered params: <attached>
- log tail (200 lines): <attached>
- upstream task states: all success
- last deploy: 2026-07-26 21:14 UTC, diff summary: <attached>
- similar past incidents (same error signature): <3 rows: date, root cause, fix>
Return:
1. The exact log line(s) you identify as the root error (quote them).
2. Probable cause, with confidence, reasoning ONLY from the evidence above.
3. Category: transient-infra | upstream-data | code-regression | config/permission | resource.
4. Recommended next action: safe-to-retry / needs-fix (what) / escalate (to whom).
5. If a past incident matches, cite it and say whether the same fix applies.
If the log tail does not contain enough evidence, say what additional log or
query you need — do not guess.
Expected output: a five-part diagnosis in which every claim quotes an evidence line. The quoting requirement is what makes the summary checkable at 2 a.m.
Deliver it where on-call already looks. Post the diagnosis into the alert thread (Slack/PagerDuty note) — not a new dashboard nobody opens. Include deep links: the failed task instance, the quoted log line, the cited past incident. Claude with an MCP connector to the Airflow API is the natural implementation shape (fetch logs and task state as tools); a plain webhook-driven script that calls the API works just as well.
Keep actions human-gated, with one narrow exception. The copilot recommends; the engineer clicks retry. If — and only if — a failure class has a long, clean history of transient resolution (e.g. a specific warehouse connection reset), you may auto-retry that signature once, with the copilot's note attached. Everything else stays read-only: an LLM with rerun/clear permissions is an incident generator.
Close the learning loop. After resolution, on-call marks the diagnosis right/wrong and records the actual root cause in the incident table — one Slack reaction plus a short form. That table is both your accuracy metric and the "similar past incidents" corpus that makes next month's diagnoses better. Review misdiagnoses monthly and patch the prompt or the evidence bundle (usually the bundle: missing upstream logs is the top cause of wrong answers).
Give the triage copilot read-only credentials to the orchestrator. Diagnosis text can be wrong and cheap; an automated clear/rerun on a wrong diagnosis can double-load data or mask a real regression at scale.
Logs are the leakiest artifact in a client's stack — they routinely contain hostnames, table names, and stray data values. For client deployments, the bundle builder and scrubber run inside the client's environment, and the model endpoint is whatever they've approved (their cloud provider's hosted models or self-hosted). Start with a shadow-mode pilot: the copilot posts diagnoses to a private channel visible only to the delivery team, accuracy is scored for two weeks, and the client sees the accuracy report before any engineer-facing rollout. That sequencing turns "we bolted an LLM to your alerts" into a measured operational improvement with evidence.