Skip to main content

The Autoheal CLI

autoheal (also installed as ah) drives the Autoheal agent platform from the command line. Find the agents in your project and run them, create and improve your own agents, start them automatically with triggers, and chat with Autoheal. It works the same for people and for coding agents. People get readable text on a terminal. Scripts and coding agents get stable JSON and meaningful exit codes.

Install​

macOS / Linux​

BASH
curl -fsSL https://raw.githubusercontent.com/accelos/autoheal-cli/main/install.sh | sh

Homebrew (recommended on macOS):

BASH
brew install accelos/tap/autoheal
# or, if you'd rather type a bare name afterward:
brew tap accelos/tap && brew install autoheal

Windows​

POWERSHELL
irm https://raw.githubusercontent.com/accelos/autoheal-cli/main/install.ps1 | iex

Or with Scoop:

POWERSHELL
scoop bucket add autoheal https://github.com/accelos/scoop-autoheal; scoop install autoheal

Direct downloads​

Prebuilt binaries, .deb/.rpm packages, and checksums.txt for every release are on the releases page. Install a specific version (including a release candidate) with the installer's version flag:

BASH
curl -fsSL https://raw.githubusercontent.com/accelos/autoheal-cli/main/install.sh | sh -s -- --version v0.1.0
# Windows: & ([scriptblock]::Create((irm .../install.ps1))) -Version v0.1.0

First launch on an unsigned build​

The binaries are not yet code-signed, so the OS may warn on first run. This is a one-time step (Homebrew avoids it on macOS, which is why it's recommended there):

  • macOS: xattr -d com.apple.quarantine "$(command -v autoheal)" (and once more for ah), or approve it under System Settings → Privacy & Security.
  • Windows: on the SmartScreen prompt choose More info → Run anyway.

Code signing and notarization are planned (coming soon). Once they ship, you no longer need these steps.

Use with your coding agent (Claude Code / Codex / Cursor / GitHub Copilot)​

Installing the CLI offers to install four Autoheal skills for your coding agent. They ship embedded in the binary, so they always match your CLI version:

  • run-agent: find the right agent in your project and run it, wait for the result, answer its questions, and send follow-ups. When no agent fits, it asks Autoheal in a chat instead. Use it for production questions too: "why is checkout slow?", "what changed before the 14:00 alert?".
  • build-agent: create or change an agent (its agent.yaml, instructions, tools and skills), check it, publish it, try it, and wire it to triggers.
  • oncall: set up On-Call: create schedules and rotations, add overrides, see who is on call, build escalation paths and the alerts they page for, and send, acknowledge or resolve pages.
  • context-graph: answer from what Autoheal already knows, through the Context Graph: what depends on a service, who owns it, what breaks if it goes down, which pull request caused an incident, and what past runs and postmortems found. It also imports your incident history (incidents, pull requests and postmortems) and links runs and documents to services.

In Claude Code they arrive as the autoheal plugin, so you invoke them as /autoheal:run-agent, /autoheal:build-agent, /autoheal:oncall and /autoheal:context-graph (or just ask, and Claude picks the right one).

BASH
autoheal skill install     # prompts for scope (global/project) and which agents
autoheal skill status # where they're installed + installed vs. embedded version
autoheal skill update # refresh after a CLI upgrade
autoheal skill uninstall # remove them

The curl … | sh and install.ps1 installers run autoheal skill install for you (it prompts on a terminal, and skips silently when there is none, so CI never gets surprise files). Opt out with:

  • --no-skill on the shell installer, or -NoSkill via the PowerShell script-block form (& ([scriptblock]::Create((irm …))) -NoSkill)
  • AUTOHEAL_SKIP_SKILL=1 in the environment (works for a plain irm … | iex too)

Package-manager installs (brew/scoop) have no install script, so the CLI offers the skills once on your first interactive run instead.

Per-agent notes:

  • Claude Code: installed as a plugin from a local plugin marketplace the CLI keeps in ~/.autoheal/claude-marketplace (or ./.autoheal/claude-marketplace for a project install). The CLI registers it with claude plugin marketplace add and claude plugin install autoheal@autoheal. If the claude command isn't on your PATH, it prints those two commands for you to run. If your Claude Code is too old for claude plugin, it asks you to run claude update and then autoheal skill update.
  • Codex: ~/.codex/skills/autoheal-run-agent, autoheal-build-agent, autoheal-oncall and autoheal-context-graph (or ./.codex/… for a project install).
  • Cursor: reads the open-standard ~/.agents/skills tree, where autoheal skill install writes the same four skills.
  • GitHub Copilot: has no global skills directory. Its customization is per-repository. autoheal skill install --project --agents copilot writes .github/instructions/autoheal-run-agent.instructions.md, autoheal-build-agent.instructions.md, autoheal-oncall.instructions.md and autoheal-context-graph.instructions.md into the current repo without touching any existing instructions. Copilot is skipped for a global install.

Upgrading from a CLI that installed the older single autoheal skill? autoheal update (or autoheal skill update) replaces it with the four new skills, and keeps any file you edited by hand.

Log in​

BASH
autoheal login

It asks where to log in, then takes one browser approval (OAuth device flow):

? Where do you want to log in?
Press Enter for autoheal.ai — your organization is found when you sign in.
Otherwise type your Autoheal URL, for example:
acme.autoheal.ai an autoheal.ai organization
autoheal.example.com a BYOC or self-hosted install
>

Press Enter for autoheal.ai. The CLI discovers your organization from the login, writes a default CLI profile to ~/.autoheal/, and silently renews tokens afterwards. On a BYOC or self-hosted install, type the URL you open Autoheal at (pasting it from the browser works). Or name it up front: autoheal login --domain autoheal.example.com.

After the approval it connects you to a project. Agents, runs and triggers all live in a project, so the CLI always works in one. If you can open just one project, the CLI picks it for you. Otherwise the CLI lists your projects and asks. Pass --project <id> to skip the question.

The CLI profile it writes is just the target host, your project, and any of those overrides, so ~/.autoheal/config stays readable and hand-editable. If your organization is renamed, update domain there.

Most people only ever need that one CLI profile. For a second organization or a dev/BYOC host, add another with autoheal login --cli-profile NAME --org NAME (or --domain HOST). autoheal cli-profile list shows them. autoheal cli-profile use NAME changes the default. --cli-profile / AUTOHEAL_CLI_PROFILE pick one for a single command. (A CLI profile is just where and how the CLI logs in.) Any of --org, --domain or --yes skips the question, as does running without a terminal. So scripts and coding agents keep the flag-free zero-config behaviour against autoheal.ai.

Headless / CI environments skip the browser: set AUTOHEAL_TOKEN and AUTOHEAL_DOMAIN (e.g. acme.autoheal.ai). API credentials can't reach projects, agents, runs or triggers yet, so those commands need autoheal login for now.

AUTOHEAL_TOKEN takes an Autoheal API credential. It accepts either a service account key (ahsa_…) for shared automation, or your personal access token (ahpat_…) for your own CI. Both are long-lived and revocable. See API Credentials for how to create one and which to pick.

BASH
export AUTOHEAL_DOMAIN=acme.autoheal.ai
export AUTOHEAL_TOKEN="$AUTOHEAL_SERVICE_ACCOUNT_KEY" # from your CI secret store
autoheal whoami

Prefer a service account for anything shared. A personal access token carries your access. It stops working the day you lose a role or leave, and that will break the pipeline at the worst possible moment.

BYOC (connected or airgapped): each deployment has its own identity provider, and it tells the CLI how to log in to it. The install's URL is all you need:

BASH
autoheal login --domain autoheal.example.com

The browser opens the same approval page as on autoheal.ai: sign in the way you sign in to the web app, then approve. Each login rereads the install's settings, so a reinstalled deployment needs no changes on your side.

An older install that does not publish its settings makes the CLI ask for the issuer and client id instead (ZITADEL_ISSUER and ZITADEL_CLI_CLIENT_ID in a compose install's .env.zitadel). Flags override anything the install publishes:

BASH
autoheal login --cli-profile acme \
--domain autoheal.example.com \
--issuer https://auth.example.com \
--client-id <ZITADEL_CLI_CLIENT_ID>

Projects​

BASH
autoheal project                 # the project you're working in
autoheal project list # every project you can open, with your roles
autoheal project use payments # switch (no id: pick from a list)
autoheal project create "Payments" # organization admins: create one and switch to it

The project is saved on your CLI profile. To use another project for a single command, pass --project <id> or set AUTOHEAL_PROJECT.

Run an agent​

BASH
autoheal agents list --search triage
autoheal run alert-triage "Triage the checkout 5xx alert from 14:00 UTC" --wait

autoheal run starts the agent and prints the run id and a link to the run in the web app. --wait blocks until the run finishes or needs you. --follow prints the agent's messages as they arrive. Pass structured input with --arg key=value (repeatable, and values that parse as JSON keep their type).

BASH
autoheal runs list --agent alert-triage     # recent runs of an agent
autoheal runs view <run> # result and full transcript
autoheal runs send <run> "Now check the payments DB too" --wait # follow-up
autoheal runs cancel <run>
autoheal runs labels set <run> service=checkout incident=inc-4512 # link it in the Context Graph

A run has one id for its whole life. runs send adds a turn that is answered in the same run, and runs wait, status, view, hitl, answer and cancel given that id act on the run's latest turn. runs list shows the status of each run's latest turn; --status takes running, waiting, succeeded, failed or canceled. --agent matches a recorded address or entity UUID, so it also finds history for deleted Agents and Agents present only on another branch.

A follow-up continues the run's conversation on the commit the run started on, so it never picks up a later push. To try a newer version, start a new run with --commit.

runs labels set replaces every label on the run, so pass the ones you want to keep too (runs labels get <run> prints them as KEY=VALUE lines). A label links the run to a Context Graph resource: a key that names a blueprint (service, incident) or one of agent, skill, run and artifact, and the target's exact name as the value.

When a run stops to ask you something or needs an approval, --wait returns with exit code 6:

BASH
autoheal runs hitl <run>                                  # what it's waiting on
autoheal runs answer <run> --ref <ref> --text "us-east-1"
autoheal runs approve <run> --ref <ref>
autoheal runs wait <run>

Build an agent​

An agent is a folder in your project's repository: agents/<slug>/agent.yaml plus any files it refers to, such as an instructions.md. You edit it locally and publish it with push.

BASH
autoheal agents create checkout-triage --name "Checkout triage"
# edit ./agents/checkout-triage/agent.yaml and instructions.md
autoheal agents validate agents/checkout-triage
autoheal agents push agents/checkout-triage -m "Look at the payments DB first"
autoheal run checkout-triage "Why did checkout fail at 14:00?" --commit <sha> --wait

push saves your changes, commits them, and waits until Autoheal reads the new version. It prints any problems it found and the commit to run (--commit runs exactly what you just pushed). To change an agent someone else made, start with autoheal agents pull <agent>. If someone commits a change to the agent after you pull, push stops rather than undo it. Pull again to get their change (your own edits are kept), then push. autoheal agents show <agent> and autoheal agents history <agent> show the current version and its commits. autoheal agents schema prints every field agent.yaml accepts.

push also prints the tools that the new version adds or removes. autoheal agents tools <agent> shows every tool a run of the agent can use, and why it cannot use each of the others.

autoheal agents delete <agent> removes the agent's folder from the branch in one commit; your local files stay. It stops and names anything that still uses the agent: other agents or benchmarks that reference it, enabled triggers that start it (or one of its subagents) from that branch, and unsaved edits someone has in its folder in the web editor. It also stops, deleting nothing, when the catalog cannot index the branch, because it can't tell then what uses the agent. --force deletes anyway. Deleting needs the Project Admin role. Runs pinned to an earlier commit still work. An agent created later with the same slug is a new agent, with a new id and its own run history.

A minimal agent.yaml:

YAML
apiVersion: agents.autoheal.ai/v1
name: Checkout triage
description: Triages checkout errors and points at the likely cause.
instructions: ./instructions.md
system_tools: operation_type == "read"
integration_tools: integration_type == "datadog"
inputs:
prompt:
type: string
required: true
description: What the agent should do on this run.
with:
prompt: "${{ inputs.prompt }}"

Leave out integration_tools to give the agent every tool your connected integrations offer, or write a filter on integration_type, operation_type or tool name to narrow them. system_tools does the same for Autoheal's own tools; left out, the agent gets all of them, write tools included. Tool filters do not limit the shell, which uses the project's CLI connections. See Tools and integrations.

inputs.prompt receives the text you pass to autoheal run <agent> "…" (or a trigger's with.prompt). agents create writes inputs.prompt but no with.prompt: the model then gets the prompt, followed by one name: value line per other input. Write with.prompt, as this example does, to word the message yourself. Then add each other input to it (for example a line Dry run: ${{ inputs.dry_run }}), or the model won't see it.

autoheal agents create <slug> --template workflow starts a two-step workflow agent instead: gather runs gather.py, then answer, an LLM step with instructions.md, reads what gather found through its with.prompt. --template only picks the starter files; agent.yaml has no such field.

Try a change on a branch​

To try a change without affecting the version other people and triggers use, create a branch, push to it, and run the commit push printed:

BASH
autoheal branches create try-new-prompt     # at the default branch's latest commit; --from picks another branch
autoheal agents push agents/checkout-triage --branch try-new-prompt
autoheal run checkout-triage "Why did checkout fail at 14:00?" --commit <sha> --wait
autoheal branches list

run --branch try-new-prompt runs the last commit Autoheal has read on that branch, which can trail a push by a few seconds. No command creates a branch for you: a --branch that doesn't exist stops with exit code 4 and the branches create command to run. Branches can't be deleted or renamed, so check the name first. Merging a branch back into the default branch isn't supported yet.

Start agents automatically​

Triggers run an agent when something happens: an alert group opens, or a GitHub event arrives.

BASH
autoheal triggers catalog                          # events you can trigger on
autoheal triggers catalog --event alertgroup.created # its fields, and a sample
autoheal triggers catalog --event alertgroup.created --sample > sample.json # that sample, as an event file for dry-run
autoheal triggers dry-run -f critical-alerts.yaml --event sample.json # would it match?
autoheal triggers create -f critical-alerts.yaml
autoheal triggers list --agent alert-triage
autoheal triggers disable <trigger>
YAML
# critical-alerts.yaml
apiVersion: triggers.autoheal.ai/v1
name: Triage critical alert groups
on:
alertgroup.created:
- severity: critical
- status: firing
run:
agent: alert-triage
with:
prompt: "Triage alert group ${{ event.data.title }} (${{ event.data.alert_count }} alerts)"

on names one event and lists conditions that must all hold. Each condition is a field and the value it must have, or a comparison such as {greater_than: 5}. anyOf groups alternatives. with.prompt is what the agent is asked, with values from the event. autoheal triggers fire <trigger> --event sample.json runs it once for real. autoheal triggers runs <trigger> shows the runs it started.

Chat with Autoheal​

BASH
autoheal chat create -m "What changed in checkout before 14:00?" --wait
autoheal chat send <session> "Show me the deploys" --wait
autoheal chat view <session>

Exit codes​

CodeMeaning
0success: the run or chat finished
1error: CLI/API failure, or the run failed or was canceled
2usage error, including "no project selected"
3authentication required
4not found
5wait timeout: the run is still going. Wait again
6awaiting a person: answer or approve, then wait again

Everything else​

A few more API domains ship as generated command groups: alerts, artifacts, integrations, context-graph, skills, and agent-policies:

BASH
autoheal alerts list
autoheal alerts get <alert-id>
autoheal integrations list
autoheal context-graph blueprints list
autoheal context-graph blueprints create --input blueprint.json
autoheal context-graph blueprints entities list service --search checkout
autoheal context-graph nodes --search checkout
autoheal context-graph neighborhood --root-kind catalog_entity --root-id <entity-id> --depth 2
autoheal artifacts search --q "connection pool" --kind postmortem
autoheal artifacts get <artifact> --include content
autoheal artifacts create --field scope=tenant --field kind=postmortem --field title="INC-4512 postmortem" --field content=@inc-4512.md
autoheal artifacts update-labels <artifact-id> --field labels='{"service":["checkout"],"incident":["inc-4512"]}'
autoheal skills imports list
autoheal agent-policies create --input policy.json # see Governance Policies for the fields

Path parameters are positional and query parameters are flags. A request body comes from --field key=value (values that parse as JSON keep their type; key=@file sends the file's text as a string, @- reads stdin) or from --input file.json. A list flag such as --node-kinds takes one comma-separated value: --node-kinds catalog_entity,run.

Run autoheal alerts --help (or artifacts, integrations, context-graph, skills, agent-policies) to see every command in a group. Commands renamed since v0.4.0 still accept their old names, so existing scripts keep working.

And autoheal api is the raw escape hatch to any endpoint not in that allowlist:

BASH
autoheal api GET /api/v1/incidents
autoheal api GET /api/v1/alerts --query page=1
autoheal api GET /api/v1/oncall/schedules --project payments # routes owned by a project need it named
autoheal api GET /api/v1/projects

Output auto-detects: human text on a TTY, JSON when piped (--json to force). Data goes to stdout and progress to stderr, so pipe away.

Updating​

BASH
autoheal update          # update to the latest release
autoheal update --check # report whether an update is available, without acting

autoheal update replaces a standalone install (from curl … | sh or a direct download) in place after a checksum-verified download. It refreshes the agent skills in the same step. For an install from a package manager, autoheal update prints the matching command instead:

Installed viaUpdate command
Homebrewbrew upgrade autoheal
Scoopscoop update autoheal
.deb / .rpmdownload the latest package from the releases page

When run interactively, the CLI checks for a newer release at most once a day and prints a one-line hint. Set AUTOHEAL_NO_UPDATE_CHECK=1 to disable that check. The check never runs for agents or CI (any of --json, non-TTY, CI, or a preset AUTOHEAL_TOKEN suppresses it).