NewWe launched on Y Combinator.Check it out
Back to Blog
Workflows13 min read

How to Automate Databricks Operations with Kestrel Workflows: Incident Response, Job Recovery, CI/CD, Data Quality, Ingestion, and Cost Control

Databricks gives you jobs, clusters, Delta Live Tables, and SQL warehouses in one lakehouse — but the operations around them are still mostly manual: someone notices the red run in the Jobs UI, someone decides whether to retry it, someone remembers to stop the warehouse. Here's how to automate all of it — incident response, job recovery, developer requests, CI/CD, data quality, ingestion, and cost control — as deterministic, approval-gated Kestrel workflows, with copy-paste prompts for each.

July 5, 2026
Raman Varma
By Raman Varma, Founder & CEO

Every team running Databricks in production carries the same operational load. The nightly ingestion job failed on its final task and the four hours of work before that task are about to be thrown away. A job that normally finishes in twenty minutes has been running for three hours and nobody has noticed because nothing has failed yet. A cluster died on an unresponsive driver and the jobs behind it are quietly queuing. The gold table stopped refreshing on Tuesday and the dashboard built on it has been lying ever since. And the SQL warehouse somebody spun up for a Friday-afternoon investigation has been running all weekend. None of this is a Databricks problem — each response is a known, repeatable sequence of steps that happens to be executed by a human with the Jobs UI open. The fix is codifying those sequences as workflows that run the same way every time, with a human approving anything destructive.

This post shows how to automate the seven domains of Databricks operations with Kestrel Workflows: incident response, job and run recovery, developer requests, CI/CD, data quality and freshness, ingestion and pipeline operations, and cost control and compute lifecycle. Each section includes prompts written the way you'd hand them to the Workflow Agent — paste one in, review the workflow it builds, and activate it.

How it works: plain English in, deterministic workflows out

You describe the automation in plain English and the Workflow Agent assembles it from real building blocks — Databricks's workspace API (jobs and their runs from Run Now through Get Run, Get Run Output, Cancel, and Repair; cluster lifecycle from Start through Restart and Terminate; Delta Live Tables pipelines with full-refresh updates and stops; SQL warehouses and SQL execution against them; and an AI-powered read-only Investigate) plus the stack around it: GitHub pull requests and Actions, Slack, PagerDuty, and Jira. The AI builds the workflow once; the workflow itself runs deterministically — the exact same steps on every execution, not an agent improvising at runtime against your production lakehouse.

Databricks has no tenant-wide outbound webhook for workspace events — job notifications have to be configured per job, one destination at a time — so Kestrel polls the Databricks REST API on a cadence you configure between one and thirty minutes, defaulting to five. Completed runs, active runs, cluster state transitions, and each pipeline's latest updates all become triggers that fire within one poll interval, and the poller is subscription-aware: if your only active trigger watches job failures, it never lists your clusters or pipelines. Workflows start from the trigger that fits the job: Job Run Failed, Job Run Succeeded, Job Run Exceeded Duration, Cluster Terminated Unexpectedly, DLT Pipeline Update Failed, CI events, schedules, or plain-English developer requests. And every workflow runs inside Kestrel's access control and approval model — restrict who can invoke it and drop approval gates anywhere in the graph so nothing destructive happens until the right person signs off in the dashboard, in Slack, or by merging a PR.

One design detail matters more here than in most integrations: Investigate Databricks is read-only by construction, not by instruction. The client rejects any request that isn't a GET against the workspace API, and every Databricks mutation — running a job, repairing a run, starting a cluster, refreshing a pipeline, executing SQL — is a POST. The investigation loop therefore cannot change your workspace even if the model tries. Everything that writes is an explicit block your team placed in the graph and reviewed before activation.

The Workflow Agent building a production-ready workflow from a plain-English description.

How to automate incident response in Databricks

Databricks incidents come in three shapes: the job run that terminates in a failed, timed-out, or canceled state; the cluster that dies for a reason nobody asked for — a Spark failure, a cloud-provider launch failure, an unresponsive driver; and the Delta Live Tables update that fails and quietly stops refreshing everything downstream of it. All three follow the same split — the investigation is safe to automate fully, and the remediation gets an approval gate.

/kestrel-workflowInvestigate & Escalate

When a Databricks job run fails, fetch the run output for the failed task to get the error and stack trace, run a read-only investigation into why the run failed and what changed around it, and post the job name, run link, and analysis to #data-eng in Slack. If the failed job is one of our tier-one production pipelines, page the on-call data engineer through PagerDuty with the investigation attached; otherwise create a Jira ticket for the owning team so the failure is tracked.

/kestrel-workflowInvestigate & Fix

When a Databricks cluster terminates unexpectedly, fetch the cluster's state and termination reason, run an investigation into what killed it and which jobs were running on it, and post the findings to #data-eng in Slack. Send restarting the cluster to a Slack approval gate for the platform team; on approval, start the cluster and confirm it reaches a running state.

/kestrel-workflowTriage

When a Databricks Delta Live Tables pipeline update fails, run a read-only investigation into the pipeline's recent updates and what the failing update was trying to do, and post the pipeline name, update ID, and analysis to #data-platform in Slack. Create a Jira ticket for the pipeline's owning team with the investigation attached, so a failed refresh never becomes a silently stale table.

How to automate job and run recovery in Databricks

Recovery is where Databricks automation pays for itself fastest, because the manual alternative is expensive in both compute and attention. A multi-task job that fails on its last step doesn't need a full rerun — it needs a repair, which reruns only the failed tasks and reuses the results of the ones that already succeeded. And a run that overruns its window needs a decision, not a wait: is it slow because the data grew, or stuck because something upstream never landed?

/kestrel-workflowRetry

When a Databricks job run fails, fetch the failed task's run output and run an investigation to determine whether the failure looks transient — a timeout, a throttled API, a lost spot node — or a real defect in the job. Post the verdict to #data-eng in Slack, then send repairing the run to a Slack approval gate with the error and the verdict attached. On approval, repair the run so only the failed tasks rerun, and confirm the repair started.

/kestrel-workflowInvestigate & Cancel

When a Databricks job run exceeds 90 minutes, run a read-only investigation into what the run is doing, how it compares to previous runs of the same job, and whether the cluster behind it is healthy. Post the analysis and the run link to #data-eng in Slack, then send canceling the run to a Slack approval gate for the on-call data engineer — a long run is sometimes correct, so a human decides whether to kill it.

/kestrel-workflowSweep

Every weekday at 8am, list our Databricks jobs and run a read-only investigation into the health of the overnight batch — which jobs failed, which ran unusually long, and which haven't run at all — then post a single morning digest to #data-eng in Slack. Read-only, no approval gate; this is the standup summary nobody should have to assemble by hand.

The best way to automate developer requests in Databricks

Databricks is where self-service matters most for the people who aren't data engineers. An analyst who needs a warehouse started, a backfill kicked off, or an answer about why last night's run failed shouldn't need workspace admin rights or a personal access token — and shouldn't have to wait for the one person who has them. Developers and analysts ask in Slack with /kestrel-workflow, from the CLI, or on the Developer Requests page; Kestrel matches the request to an active request-triggered workflow, extracts the parameters from the phrasing, and runs it with team-scoped permissions.

/kestrel-workflowRun

When a developer requests a Databricks job run — a backfill, a one-off refresh, a re-processing of a date range — run the named job with the parameters they gave, then fetch the run and reply in Slack with the run link and its state. Allow it without a gate for jobs in our non-production workspace; require approval from the data platform team before running anything in production.

/kestrel-workflowInvestigate

When a developer asks why a Databricks run failed or what a job is doing, fetch the run's output and run a read-only Databricks investigation to answer the question, then post the findings back to the requester with the run link. Allow it for everyone with no approval gate — the investigation cannot change anything in the workspace.

/kestrel-workflowProvision

When an analyst requests compute for ad-hoc work, start the named Databricks SQL warehouse — or the named cluster, if they asked for a notebook cluster — and reply in Slack once it's running. Allow it for all analysts with no gate, and pair it with a companion workflow (“every day at 8pm, stop the ad-hoc Databricks SQL warehouse and confirm in #data-eng”) so the compute you hand out doesn't stay running overnight.

This is the same pattern our internal developer platform guide builds across the whole stack — Kubernetes, AWS, Vercel, and more. Here it's scoped to Databricks, but the request workflows compose: the same front door serves every integration you connect.

How to automate CI/CD with Databricks

The gap in most Databricks CI/CD setups isn't the deployment — it's the verification. Code lands, the bundle deploys, and whether the pipeline actually still works is discovered the next morning by whoever reads the Jobs UI first. These workflows close that gap: the pull request that should run the integration-test job, the merge that should refresh staging, and the release that should run the production job behind an approval with its result checked on the other side.

/kestrel-workflowVerify

When a pull request is opened in GitHub against our data platform repo, run the Databricks integration-test job, fetch the run once it completes, and post the run link and result state back to the pull request and to #ci in Slack. If the run failed, fetch the failed task's output and include the error in the comment so the author doesn't have to open the workspace.

/kestrel-workflowDeploy

When a pull request is merged in GitHub, start an update on our staging Databricks Delta Live Tables pipeline so staging reflects the new code, then post the update ID and pipeline link to #ci in Slack. No approval gate — staging exists to be refreshed.

/kestrel-workflowGate

When a release is published in GitHub, send running the production Databricks transformation job to a Slack approval gate for the on-call data engineer, with the release notes and job name attached. On approval, run the job, fetch the run when it finishes, and post the result state and duration to #releases in Slack — and if it failed, fetch the run output and page on-call.

How to automate data quality and freshness checks in Databricks

Data quality failures are worse than job failures, because a job failure is loud and a stale table is silent. The pattern that works is to express the check as SQL and branch on the answer: the Execute SQL block runs a statement against a warehouse and returns a row count and a first value designed to feed a Condition node, so “is this table fresh?” becomes a real decision point in a workflow. One caveat worth designing around: Execute SQL runs whatever statement you give it, so point these workflows at a warehouse whose credentials only have the grants the check needs.

/kestrel-workflowVerify

Every morning at 7am, run a freshness check on our Databricks SQL warehouse that returns the age in hours of the newest row in each gold table. If any table is more than 12 hours stale, post the table names and their staleness to #data-quality in Slack and create a Jira ticket for the owning team. If everything is fresh, stay quiet.

/kestrel-workflowDetect drift

Every day at 6am, run a row-count check against our main fact table on the Databricks SQL warehouse comparing yesterday's ingested rows to the trailing seven-day average. If the count is more than 30% below the average, run a read-only investigation into the pipelines that populate the table, post the findings to #data-quality in Slack, and send a full refresh of the Delta Live Tables pipeline to a Slack approval gate for the data platform team.

/kestrel-workflowValidate

When our nightly Databricks ingestion job succeeds, run a validation query on the SQL warehouse that counts null values in the columns downstream dashboards depend on. If the query returns any rows, run an investigation into the run that produced them and post the failing columns plus the analysis to #data-quality in Slack — a job that finished successfully isn't the same as a job that produced correct data.

How to automate Databricks ingestion and pipeline operations

Delta Live Tables handles the mechanics of incremental ingestion well; what it doesn't handle is the operational judgment around a pipeline that's failing, stalled, or misbehaving. A failed update needs an investigation and often a full refresh — which reprocesses everything and therefore costs real money, so it belongs behind a gate. A pipeline that hasn't produced a successful update in days needs someone to notice. And a runaway pipeline needs a stop button that leaves an audit trail.

/kestrel-workflowRecover

When a Databricks Delta Live Tables pipeline update fails, run a read-only investigation into the pipeline and its recent update history, and post the analysis to #data-platform in Slack. Send starting a full-refresh update to a Slack approval gate for the data platform team, with the failure reason and the estimated reprocessing scope in the message. On approval, start the update with full refresh enabled and confirm the update ID.

/kestrel-workflowAudit

Every Monday at 9am, list our Databricks Delta Live Tables pipelines and run a read-only investigation to identify pipelines whose most recent update failed, was canceled, or hasn't completed in more than 48 hours. Post the stalled pipelines and the analysis to #data-platform in Slack, and create a Jira ticket for each pipeline that has been stalled for more than a week.

/kestrel-workflowStop

When the data platform team requests an emergency stop of a Databricks pipeline, run a read-only investigation into what the pipeline is currently doing for the record, then send stopping it to a Slack approval gate for a data platform lead. On approval, stop the pipeline and post who requested it, why, and what was stopped to #data-platform in Slack. Restrict the workflow to the data platform group.

How to automate Databricks cost control and compute lifecycle

Databricks bills for running compute, and the compute that costs the most is the compute nobody remembered to stop: the interactive cluster from Tuesday's debugging session, the SQL warehouse behind a dashboard nobody opens, the all-purpose cluster somebody sized for a one-time load test. Lifecycle automation keeps the bill honest, and because starting compute back up is cheap and fast, the shutdown side is exactly the kind of reversible action that's safe to automate — with a gate on the first few runs until you trust it.

/kestrel-workflowSchedule

Every weekday at 8pm, list our Databricks SQL warehouses and clusters and run a read-only investigation to identify which non-production compute is still running. Send stopping them to a Slack approval gate for the data platform team with the list attached; on approval, stop the approved SQL warehouses and terminate the approved clusters, then post a summary of what was reclaimed to #data-eng in Slack.

/kestrel-workflowReclaim

When our nightly Databricks batch job succeeds, terminate the job's cluster and stop the SQL warehouse the downstream checks used, then post a one-line confirmation to #data-eng in Slack. No approval gate — the compute's work is done, its configuration is retained, and it restarts on the next run.

/kestrel-workflowAlert

Every Friday at 4pm, list our Databricks clusters and warehouses and run a read-only investigation into which have been running continuously for more than three days and what, if anything, is using them. Post a capacity and spend report to #data-platform in Slack and create a Jira ticket for the owning team for each long-lived cluster that appears idle. Read-only, no gate — this one informs a decision rather than making it.

Making Databricks easier to manage

Twenty-one workflows, seven domains, one pattern: describe the operation in plain English, let the Workflow Agent assemble it from real Databricks blocks and the stack around them, review the graph, and put approval gates on anything destructive. Databricks keeps doing what it's best at — jobs, clusters, Delta Live Tables, and SQL warehouses on one lakehouse — and Kestrel turns its events into governed action: investigations with the failed task's stack trace attached, gated run repairs that don't throw away four hours of successful work, cluster and warehouse lifecycle, pipeline refreshes, SQL-based quality gates, pages, and tickets. The recurring 80% runs itself, and your team's time goes to the judgment calls.

This isn't Databricks-only, either. The same workflow engine spans 40+ integrations across infrastructure, PaaS, observability, comms, databases, CI/CD, and IaC — so the workflow that repairs a failed job run lives next to the one that resets a Supabase branch migration or rolls back a Vercel deploy. If you're thinking about this as one job rather than one integration, start with how to build an AI DBA with Kestrel Workflows. For deeper dives on the rest of the data layer, see the companion posts on automating ClickHouse operations, automating Supabase operations, automating PlanetScale operations, automating Neon operations, and automating AWS cloud operations.

FAQ: automating Databricks operations

How do you automate Databricks operations?

Turn each recurring lakehouse event — a failed job run, a run that overruns its window, a cluster that dies on a Spark error, a failed Delta Live Tables update, a table that stops being fresh — into a deterministic, approval-gated workflow instead of a data engineer watching the Jobs UI. With Kestrel, you describe the automation in plain English, the Workflow Agent assembles it from real Databricks blocks plus the stack around them (GitHub, Slack, PagerDuty, Jira), and it runs the exact same steps every time, pausing at approval gates before anything destructive.

How do you automatically retry a failed Databricks job?

Use the Repair Run block, which reruns only the failed tasks of a multi-task job and reuses the results of the tasks that already succeeded — so a five-hour pipeline that failed on its last step doesn't restart from scratch. The pattern is: the Job Run Failed trigger fires, Get Run Output pulls the error and stack trace from the first failed task, an AI investigation says whether the failure looks transient or like a real defect, and repairing the run sits behind a Slack approval gate so a human confirms the retry is worth the compute.

Is it safe to let AI operate a Databricks workspace?

It's safe when the AI's role is bounded. In Kestrel the AI does two things: it builds the workflow once, before anything runs, and it investigates at runtime. The Investigate Databricks block is read-only by construction rather than by instruction — the client rejects any request that isn't a GET against the workspace API, and every Databricks mutation is a POST, so the investigation loop provably cannot change the workspace. Everything that writes is an explicit block your team reviewed, and destructive blocks like Terminate Cluster, Stop Pipeline, and Stop SQL Warehouse sit behind approval gates.

What is the best automation tool for Databricks?

It depends on scope. Databricks Workflows and Delta Live Tables are the right primitives for orchestrating tasks inside the lakehouse, and the Databricks CLI and SDK are right for scripting individual operations. For turning Databricks events into governed action across your whole stack — investigations, gated run repairs, cluster and warehouse lifecycle, pipeline refreshes, SQL-based quality gates, pages, and tickets in one system — Kestrel Workflows builds deterministic workflows from plain English, triggered by job run failures, successes, overruns, unexpected cluster terminations, and DLT pipeline failures.

Getting started

Connect Databricks — your workspace URL plus a personal access token scoped to jobs, clusters, pipelines, and sql, about five minutes end to end, with no webhooks to configure — then pick the domain that hurts most. For most teams that's job recovery: the failed run that should investigate itself and offer a gated repair instead of waiting for someone to open the Jobs UI. Paste one of the prompts above into the Workflow Agent, review the workflow it builds, tighten the scoping and approvals, activate it, and add the next one. The Workflows Quickstart walks through your first workflow end to end, and the Create Workflows guide and Integrations Setup cover connecting GitHub and the rest of your stack. Prefer the terminal or an AI coding agent? Workflows can also be created and managed through the CLI, Python SDK, and MCP. Within a few weeks every failed run, stalled pipeline, and idle warehouse that matters will have a workflow behind it — and an audit trail to prove it.

Automate your Databricks operations with $1,000 in credits

Incident response, job recovery, developer requests, CI/CD, data quality, ingestion, and cost control — describe each workflow in plain English and Kestrel builds it. New accounts get $1,000 in usage credits to get started.

Get Started