Staso Docs
Heal

Self-Heal

Self-Heal investigates agent issues — errors, behavior drift, guard violations — using trace data and source code, then opens pull requests with fixes.

How it works

  1. Signal — an error, a drift, or a guard violation appears in the trace
  2. Diagnosis — Staso reads the trace and your source at the exact failing version, traces the failure to its root cause
  3. Fix PR — a pull request with the proposed fix, ready to review and merge

Quick vs. Deep

Every diagnosis runs at one of two depths.

QuickDeep
ReadsSpans, errors, guard violations, source code at the failing versionEverything in Quick, plus full repo clone with code execution
Traces across filesIndividual file reads onlyFollows imports, searches symbols, traces call chains
Fix PRsNoWrites the fix, pushes a branch, opens a PR
SpeedSecondsSlower — clones and executes in a sandbox
Runs whenDefaultPick Deep in the depth selector, or escalate from a Quick result

Quick requires a GitHub connection for source-aware analysis. Without it, diagnosis runs on trace data alone.

Deep runs are covered in Deep Runs.

Running a diagnosis

Open a failing trace, switch to the Heal tab, and click Diagnose. You can type a specific question — "why did this return None?", "is this a regression?" — or describe a symptom.

Heal tab with Diagnose button and text input

Staso investigates in real time. You see each tool call and file read as it happens.

Live investigation progress

The result includes a root cause, a proposed fix, and the option to turn it into a pull request.

Follow-ups

Diagnosis is conversational. After the initial result, ask follow-up questions in the same thread. Each follow-up carries the full trace and prior diagnosis context — Staso builds on what it already found rather than starting over.

Fix PRs

When a Deep diagnosis produces a fix, Staso writes the change, creates a branch, and opens a PR against your repo. You review the diff inline before visiting GitHub.

Diagnosis with root cause, fix applied, and View Pull Request link

No fix reaches your code without your approval. The sandbox is scoped to that single fix and torn down immediately after.

Fix PRs require Deep runs and a GitHub connection.

Conversations

Heal works at the conversation level too. Open a conversation, switch to the Heal tab, and diagnose across all traces in the session — useful when a failure spans multiple agent turns.

Prerequisites

RequirementEnablesSetup
Staso SDKAll diagnosisQuickstart
GitHub connectionSource-aware diagnosis, Fix PRsConnect GitHub
Deep runs enabledMulti-file tracing, Fix PRsDeep Runs

Without GitHub, diagnosis runs on trace data alone. Without Deep runs, diagnosis still works but Fix PRs are disabled.