guide
guide8 min read

Can an AI Agent Self-Heal a Failing Dagster or dbt Pipeline Without Auto-Merging Bad Fixes?

Which repair steps an agent can run alone, and which should wait for a human merge

A self-healing Dagster or dbt pipeline works by catching a failure, handing the error context to an agent, and letting the agent open a pull request with a minimal fix, while a human still merges it. Paradime's DinoAI pipeline healer follows exactly this pattern: a Dagster failure hook triggers an agent, the agent opens one PR per failed run, and a person closes the loop. The sensible line is simple. Let the agent diagnose, retry and propose. Keep merging, schema changes and backfills behind approval.

Key Takeaways

  • •Self-healing in Dagster and dbt is a loop of detect, diagnose, propose and verify. The riskiest step is merge, not diagnosis.
  • •Paradime's documented healer opens exactly one PR per failed Dagster run and requires a human to review and merge it.
  • •Retrying from the point of failure (dbt retry) is safe to automate when the cause is transient; it does nothing useful when the error is in your code.
  • •The MCP specification says there SHOULD always be a human in the loop with the ability to deny tool invocations.
  • •Auto-merge is only defensible for narrow, reversible, test-covered fixes. Anything touching schemas, data contracts or backfills should wait for approval.

How does a self-healing pipeline work end to end?

Every self-healing design we have seen reduces to four stages: detect, diagnose, propose, verify. Detection is the easy part, because orchestrators already emit failure events. Diagnosis means reading the error, the stack trace and the code that produced it. Proposal means writing a change. Verification means proving the change fixes the failure without breaking anything else. The stages differ sharply in risk, which is why treating them as one automated blob is where teams get hurt.

In Dagster, the entry point is usually a failure hook. In the Paradime guide, a Dagster @failure_hook fires in-process when an op fails and sends the run ID, job name, failed step and stack trace to an agent. Dispatch is fire-and-forget, so the run's teardown is not blocked. That design choice matters: the healer never sits in the critical path of the pipeline it is trying to repair.

In dbt, the entry point is the run artifacts. A failed dbt run or dbt build writes run_results.json, and an agent can read which node failed and why. From there the agent can map the error to a model, macro, seed or snapshot. The Paradime healer does the same mapping for dbt errors, and sends dlt ingestion errors to the ingestion script and Dagster definition errors to the project code.

What does the Paradime example actually do?

The most concrete public example we can point to is the Paradime guide. Per its documentation, the agent runs without asking for confirmation, posts a triage summary to a Slack channel before changing any code, creates one branch per failed run, applies minimal fixes for every distinct error and opens one PR. The summary includes the run ID, failed step, verbatim error and planned fix, so a human can see the intent before the diff exists.

The numbers in the guide are modest and useful for planning. A typical healing run takes about 2 to 6 minutes from failure to PR, and failure messages are truncated at 12,000 characters. The truncation limit is a reminder that agents see partial context on large failures, so a fix for a long dbt error cascade may address the first error and miss the real root cause.

The guide also lists coverage gaps that apply to any hook-based design. A hook has to be attached to each job, and materializing straight from the asset graph uses a default asset job that has no hooks, so those runs get no healing at all. Missing credentials make the hook log a warning and do nothing. Silent non-coverage is its own failure mode, and any evaluation should test for it.

Which steps are safe to automate?

Retries are the cheapest repair and the safest. Dagster supports run retries configured in the instance settings; the Dagster documentation's example sets a default maximum of 3 retries for all runs. For dbt, `dbt retry` re-executes the last invocation from the point of failure, without rerunning upstream nodes that already succeeded and without rerunning nodes whose errors you have not fixed.

That second clause is the key limit. Retry fixes transient problems: a dropped connection, a warehouse timeout, a queue spike. It does nothing for a renamed column or a bad join, because the same code fails the same way. The dbt docs also note that if no nodes executed before the failure, retry runs nothing and recommends rerunning the full job. An agent should therefore classify the failure before choosing between retry and a code change.

Read-only diagnosis is also safe to automate fully: reading logs, comparing the failing model to the last green run, checking what changed in upstream schemas and listing downstream consumers. None of it mutates state. Our Pipeline Agent is built around this split, doing the investigation autonomously and keeping writes behind an explicit approval path.

Which steps should stay human-approved?

Merging code is the first. An agent that opens a PR is proposing; an agent that merges is deciding. The difference shows up when a fix is plausible but wrong. A model that fails on a null in customer_id can be "fixed" by coalescing nulls to zero, the run goes green, and every downstream join silently matches the wrong rows. Tests passing is not the same as the data being right.

Schema-affecting changes are the second. Dropping or renaming a column, loosening a data contract, or changing a type has a blast radius beyond the failed run. Backfills are the third, because they rewrite history and cost warehouse credits. Changes to permissions or access policies are the fourth. For all of these, we want a human to see the intent and the impact before anything executes.

The MCP specification gives a general principle that applies here. For tools exposed to models, there SHOULD always be a human in the loop with the ability to deny tool invocations, and clients SHOULD present confirmation prompts for operations. The spec says SHOULD, not MUST, so the policy is yours to set. We recommend setting it by risk tier rather than one global switch.

A five-step approval ladder for pipeline repair

StepWhat the agent doesAutonomyWhy
1. DetectReceives failure hook or reads run_results.jsonFully automaticNo state change
2. DiagnoseReads logs, code, upstream schema diffs, lineageFully automaticRead-only
3. RetryReruns from point of failure for transient causesAutomatic with a retry capIdempotent when models are idempotent
4. ProposeOpens a branch and one PR with itemized fixesAutomatic, PR onlyReviewable and reversible
5. Merge and deployMerges, deploys, backfillsHuman approvalHighest blast radius

The ladder puts the approval gate where mistakes become expensive. Steps one through four can run at 3 a.m. with nobody awake, and the worst outcome is a bad PR that nobody merges. Step five is the only place where an unattended error can reach production data, so that is where a person stays.

When is auto-merge defensible?

We would not rule auto-merge out forever, but we would narrow it hard. A fix qualifies only if it is small, reversible and covered by tests that would catch a wrong answer, not just a crash. Typical candidates are a typo in a model reference, a pinned package version bump that restores the previous behavior, or a documentation-only change. A changed join key or a null-handling rule does not qualify.

Even for qualifying fixes, we would add guardrails: a per-day cap on auto-merged changes, a rule that the same model cannot be auto-fixed twice in a week, a required data diff against the last good build, and an automatic revert if the next scheduled run fails. If you cannot state the rollback path in one sentence, the fix is not a candidate.

Our view is also that the triage message matters as much as the PR. Posting the verbatim error and planned fix before touching code, as the Paradime guide describes, gives the on-call engineer a chance to interrupt. It turns the agent from an invisible actor into a colleague who narrates its work.

How should you evaluate a self-healing tool?

Start with coverage, not cleverness. List the ways your pipelines can run, such as scheduled jobs, asset materializations from the UI, backfills and sensors, and check which of them trigger the healer. The hook gap in the Paradime guide shows how easily a whole execution path goes uncovered. Then check what the agent is allowed to run: a tool list limited to reading files, searching and running SQL is a different risk from one with deploy rights.

Next, replay known failures. Pick five historical incidents with known root causes, including at least one where the obvious fix is wrong, and see what the agent proposes. Count how many PRs you would merge as written, how many need edits and how many you would reject. That ratio is a better signal than any vendor claim about resolution rates. The Orchestration Agent in our swarm routes these cases to the Pipeline, Incidents and Quality agents, but the same replay test applies to any tool.

Finally, check the audit trail. Every autonomous action should record what the agent saw, what it changed and who approved it. Without that record, you cannot tell whether a green pipeline was healed or just silenced.

Frequently Asked Questions

Can an AI agent fix a failing Dagster pipeline on its own?

It can diagnose and propose on its own, and it can retry transient failures within a cap. Fixing in the sense of changing production code should go through a PR. The Paradime example opens one PR per failed run and leaves the merge to a human, which is the pattern we would copy.

Does dbt retry count as self-healing?

Only for transient failures. The dbt docs describe dbt retry as re-executing from the point of failure, so it saves time after a timeout or connection drop. It will not fix a model whose SQL is wrong, because it does not rerun nodes whose errors you have not fixed.

What is the main risk of auto-merging agent fixes?

A fix that makes the run green while making the data wrong. Tests that only check for crashes will pass, and downstream dashboards will quietly drift. Keep merges, schema changes and backfills behind human approval, and require data diffs for anything an agent changes.