Amazon iconAmazonSep 29, 2026 ~7 min source read

How to add LLM-powered DAG failure analysis to Amazon MWAA

A practical walkthrough of a custom Apache Airflow plugin that collects task context across AWS services, sends it to Amazon Bedrock for root cause analysis, and surfaces structured diagnostics in the Airflow UI.

Building an LLM-powered DAG failure analysis plugin for Amazon MWAA

Share this story

Send the public story page.

Useful takeaways from this story.

The plugin automates failure diagnosis by collecting task metadata, logs, DAG code, and operator-specific scripts, then sending enriched context to Amazon Bedrock for structured analysis.

The solution’s source code is available in the sample-aws-mwaa-llm-powered-plugin GitHub repository for hands-on deployment and study.

# What this plugin does

This post shows how to build a custom Apache Airflow plugin for Amazon MWAA that provides on-demand root cause analysis for failed DAG tasks. Instead of manually trawling logs, engineers trigger an Analyze Task action in the Airflow UI. The plugin gathers context, enriches it with operator-aware code retrieval, calls Amazon Bedrock for analysis, and returns a structured diagnostic report that appears inside the Airflow UI.

# Why this approach

Airflow orchestrates complex ETL and analytics workflows across services such as AWS Glue, Amazon EMR, Amazon Athena, and Amazon Redshift. When a task fails, teams typically read logs, inspect DAG files, and try to map error messages to code. The plugin reduces that manual work by collecting the relevant artifacts and passing them to a foundation model that produces a clear, actionable diagnosis and recommended remediation steps.

# Core architecture and flow

  • Based on operator type, the plugin fetches operator-specific scripts or queries (for example, PySpark scripts referenced by a Glue job definition or SQL text embedded in an Athena operator).
  • The enriched context is posted to Amazon Bedrock (Anthropic Claude in the example) for analysis.
  • A structured diagnostic report is returned and displayed in the Airflow UI, with root cause identification, step-by-step resolution, and prevention recommendations.

# Operator-aware context collection

Including the exact script or query allows analysis to correlate stack traces or error messages with lines of code.

# Authentication and credentials

All AWS API calls (Amazon Bedrock, S3, Glue) use the aws_default Airflow connection. On Amazon MWAA, that connection typically has no static credentials and boto3 falls back to the environment execution role. This removes the need to manage long-lived keys. If a different identity is required, supply credentials or a dedicated IAM role in the aws_default connection to use instead of the execution role.

# Deployment and resources

The post points to a GitHub repository named sample-aws-mwaa-llm-powered-plugin containing the complete source code and deployment examples. The plugin integrates into MWAA, stores artifacts and DAGs in S3, and delegates model inference to Amazon Bedrock.

# Practical considerations

  • Operator-aware retrieval depends on operators being configured with accessible script locations or inline code. If code lives outside accessible locations, retrieval will be limited.
  • Using the execution role simplifies credential management, but cross-account or alternate-role scenarios require configuring the aws_default connection.

# Bottom line

More context around this story.

Your LLM Telemetry Table Does Not Have One Denominator
Dev iconDevSep 21, 2026

Your LLM Telemetry Table Does Not Have One Denominator

Originally published on hexisteme notes . I had an LLM telemetry report with the usual reassuring furniture: medians, interquartile ranges, sample sizes, and bootstrap intervals. The rows were grouped by model. It looked ready for comparison. It was actually several different studies sharing a table. The core process m

Loading more related stories...

Keep reading in the app

Open the app view to save this story, compare related coverage, and continue from the same source.

Open in app