AI_DIAGNOSE: Automating Spark Job Debugging With LLM Agents
Overview
| Experience | In Person |
|---|---|
| Track | Artificial Intelligence & Agents |
| Industry | Enterprise Technology |
| Technologies | Databricks SQL |
| Skill Level | Intermediate |
Debugging distributed Spark jobs is notoriously difficult, often requiring hours of sifting through massive logs to find root causes. We introduce AI_DIAGNOSE, a new Spark SQL procedure in Databricks Runtime that automates this process using large language models (LLMs).
This session explores the architecture of AI_DIAGNOSE, detailing how we implemented a ReAct-style agent within the Spark engine. We will demonstrate how the agent autonomously gathers context, retrieves distributed logs, and analyzes job failures. We'll cover technical challenges like managing LLM context windows with large logs, ensuring structured actionable outputs, and leveraging Databricks Model Serving for secure inference. Join us to learn how AI_DIAGNOSE works under the hood to drastically reduce Mean Time To Resolution (MTTR) for data pipelines.
Session Speakers
Allison Wang
/Staff Software Engineer
Databricks
Shujing Yang
/Software Engineer
Databricks
Full Summary
Why Spark debugging needs context engineering, not smarter models
Spark failures are hard to diagnose, and handing a stack trace to a generic coding agent rarely fixes that. The talk argues that reliable AI debugging on the Databricks Platform hinges less on a smarter model and more on giving any model the right context at the right time: targeted evidence from the job plus encoded domain know-how.
FAQ
Execution errors that leave evidence in logs, metrics, and plans. Examples include out-of-memory failures, data skew, shuffle fetch failures, hanging Python UDFs, lost executors, and spill or streaming issues. Logic errors or failures caused by upstream third-party systems are out of scope for now.
A code snippet and a stack trace do not capture what happened across the cluster. Many distinct root causes present the same symptom. Without targeted access to Spark metrics, logs, and plans, models tend to suggest the statistically common fixes instead of identifying the actual cause.
Playbooks are modular and loaded only when relevant. Tools fetch focused slices of Spark evidence on demand rather than dumping full logs, so the model sees high-signal context instead of raw volume.
Every prompt or skill change is evaluated against hundreds of end-to-end cases reproduced from real customer issues, with an LLM-as-judge comparing results to ground truth. Full agent traces and tool calls are recorded so regressions can be investigated and fixed.
No. Debugging knowledge is encoded in the agent's skills. For example, for hanging Python UDFs it knows about the Spark 4.0 idle timeout warning and the specific configs to terminate stuck workers and generate tracebacks, then gathers the right evidence automatically.