Skip to main content
The Dagster pipeline healer is a DinoAI agent that dispatches every op failure to a background agent session. The moment a step fails, a Dagster @failure_hook captures the exception and stack trace and hands it to the agent, which posts a triage summary, applies the minimal fix on a new branch, and opens one pull request per failed run.
Prerequisites
  • GitHub connected so the healer can create branches and open PRs against the workspace repository.
  • Slack connected so the healer can post its triage summary and progress.
  • A Paradime API endpoint, key, and secret with DinoAI agent API capabilities enabled (Workspace Settings, API; requires Admin access). Keys are workspace-scoped: generate the key from the workspace whose connected repository contains your .dinoai/agents/ folder, because the agent always runs in the workspace that issued the key.
  • Familiarity with programmable agents.
Estimated time: 30 minutes.

Steps

1

Create the agent

Build the healer in the Agent UI: fill in the builder fields below, leave Model on Auto, then select Deploy and choose Open a pull request so the definition lands at .dinoai/agents/dagster-pipeline-healer.yml. (Prefer working as code? That file is the full definition, and you can author or edit it by hand from then on.)Name: dagster-pipeline-healerRole:
Goal:
Backstory:
Allowed tools: read_file, search_files_and_directories, ripgrep_search, run_sql_query, run_terminal_commandOutput: Slack channel #dagster-dinoai-self-healing
Merge the deploy pull request to your default branch before triggering. API-triggered agents are loaded from the default branch of the workspace repository, so a definition sitting on a feature branch, an open PR, or only in your local checkout is invisible to trigger_run, and the session fails with no messages. Any later edits also only take effect once merged.
Adapt the error-to-file mapping in step 3 of the Goal to your own repository layout. The mapping is what lets the agent go from a stack trace to the right file without exploring the whole repo.
2

Add the failure hook

The hook fires in-process the moment an op fails: no sensor polling, no daemon dependency. Create dagster_project/hooks.py:
dagster_project/hooks.py
Then attach the hook to your jobs at definition time:
dagster_project/jobs.py
Finally, set the three environment variables wherever your Dagster code runs, dagster dev locally or your deployment’s environment configuration in production:
The hook is a graceful no-op when the env vars are unset: it logs a warning and returns. Local development without credentials never fails a run because of the hook, and the original op failure is always surfaced normally in Dagster either way.
Materializing assets directly from the asset graph runs Dagster’s internal __ASSET_JOB, which carries no hooks. Always launch through a hooked job to get self-healing coverage.
3

Test it end-to-end

Verify the loop with a deliberate, controlled failure. Two rules make or break the test:
  1. The break must be a runtime error, not a parse error. A typo’d ref() breaks dbt parsing, which breaks Dagster’s code-location load itself. The run dies with “Could not load job definition” before any op starts, and the hook never fires. Instead, reference a column that doesn’t exist in the source table:
This parses fine, Dagster loads, and the model fails in the warehouse with Unrecognized name: grand_prix_sponsor, a real op failure that fires the hook.
  1. The break must be pushed to the branch your Paradime workspace tracks. The agent clones the remote repository, so a local-only break fires the hook but the agent finds healthy code and has nothing to fix.
Push the break, then launch the hooked job from the Dagster UI. Watch the run in three places, in the order things happen:
  1. Dagster event log: right after STEP_FAILURE you’ll see the dispatch confirmation, Triggered DinoAI agent 'dagster-pipeline-healer' … Result: ok=True agent_session_id='…' status='queued'
  2. Slack: #dagster-dinoai-self-healing receives the triage summary, then progress updates
  3. GitHub: the fix PR appears a few minutes later, citing the exact error string
Each failed run produces exactly one PR that heals the pipeline, with every distinct error documented (the verbatim error string, the file changed, and the fix applied). Merge the PR to close the loop. If a session fails immediately with no messages, the API key likely belongs to the wrong workspace, because trigger_run always runs the agent in the workspace that issued the key. A long-running dagster dev process keeps the environment variables it started with, so restart it after rotating or switching keys.

How it works

The hook fires in-process the moment an op fails and dispatches the failure fire-and-forget: it returns immediately, so the Dagster run’s teardown is never blocked by the agent session. A typical healing run completes in 2 to 6 minutes from step failure to open PR. The agent posts a triage summary before touching any code, maps each error to its source file, then creates one branch and opens a single PR itemizing every distinct error.
Each failed run produces one PR with every distinct error documented verbatim:

Next steps

Bolt pipeline healer

The same pattern driven by Bolt self-healing.

Pipeline incident commander

Multi-agent triage from Airflow failures.

Build an agent in the UI

Create this agent visually instead of by hand.

Programmable Agents reference

The agent YAML schema and tools.