How to write a runbook an AI agent can actually follow
A runbook an agent can follow states six things the agent cannot guess: the goal, the inputs it may use, the constraints it must not cross, the checkpoints where it pauses, a pass or fail result for each step, and the rule that tells it to stop. A prompt that covers only the goal is not a runbook. It is a request, and the agent will fill every missing part with a plausible guess.
That distinction explains why three common formats each fall short on their own. A prose prompt can carry intent. A machine-readable workflow can carry order and checks. An incident playbook can carry ownership and recovery. An agent-readable runbook needs parts of all three, stripped of the ceremony that only helps a human reader.
The six parts an agent cannot guess
1. Goal and success criteria. A runbook prompt defines goals, constraints, success criteria, outputs and error handling. Write the goal as an end state that can be checked, not an activity. “Publish the update” is an activity. “The page shows the new price, the old price appears nowhere, and the change is logged” can be checked.
2. Inputs. Name the exact files, pages, accounts or records the step may use, and where they live. If an input is missing, the runbook should say whether the agent stops or asks. Silence on that point is where invented inputs come from.
3. Constraints. List what the agent must not do even if it would reach the goal faster: no publishing without a checkpoint, no role wider than the task needs, no deleting the original before a copy exists.
4. Steps with expected outputs. The incident-playbook format records steps with expected outputs, plus prerequisites before the first step starts. An expected output gives the next section its test: the step either produced that output or it did not.
5. Verification with pass/fail criteria. Each step ends in a stated result, not a feeling that it went well. The format also carries a verification section with pass/fail criteria separate from the steps themselves, so the check is written before the run, not improvised after it.
6. Rollback, owner and version. The same playbook format includes rollback, an owner and a version. For an agent runbook, rollback means the action to take on an error, named in advance. Owner and version look like paperwork until two versions of a runbook circulate and nobody can tell which one the agent followed.
Checkpoints and stop rules: where the agent must pause
A checkpoint is a planned pause, placed before an action that is hard or impossible to reverse. Guidance for runbook prompts puts stepwise checkpoints at exactly those points: pause before publishing or before irreversible actions, and specify rollback behaviour on errors.
A stop rule is stricter than a checkpoint. A checkpoint asks for approval and then continues. A stop rule ends the run. Write both kinds explicitly, for three situations:
- The input does not match what the runbook describes, wrong file, wrong account, wrong record count.
- A step fails its pass/fail check twice, or fails in a way the runbook does not name.
- The next action is irreversible and its checkpoint approval has not been given.
Machine-readable runbooks enforce the same idea in code. In the StateM format, transitions run checks before a transfer, and a blocking check failure keeps the agent in the current state, with the failure recorded for repair. The prose version of that behaviour is one sentence in the runbook: “If this check fails, do not proceed; record the failure and stop.”
Pass/fail at every step, not a verdict at the end
End-only checking has a specific failure mode. An early step drifts slightly, every later step builds on the drift, and the final check fails with no record of where the run went wrong. Per-step checks localise the failure to one step and one expected output.
Keep each check binary and observable. “Page looks right” is neither. “Headline matches the approved text exactly, and the price field reads the new value” is both. Where a check needs a human eye, say so at that step instead of letting the agent grade its own visual work.
A short before-and-after discipline, taken from a copyable WordPress workflow runbook, strengthens the checks. Before the run: a backup exists and a restore from it has been tested, and the agent is connected with the lowest role that works. After the run: compare the result directly, check the page at phone width, and confirm a log entry was written. Credentials given for a project are revoked at the end of that project.
Three real formats, compared
| Format | What it gives the agent | What it leaves out | Use it for |
|---|---|---|---|
| Prose prompt runbook | Goal, constraints, success criteria, outputs, error handling, checkpoints | No enforced order; a skipped check is invisible | Single-agent tasks run under supervision |
| YAML state machine (StateM) | Static workflow definition kept separate from per-run state; checks run before each transition and transitions are recorded | Harder for a non-technical owner to read and edit | Repeat runs where order and blocking checks must be enforced |
| SRE incident playbook | Title and ID, trigger, impact and severity, prerequisites, expected outputs, verification, rollback, owner, version | Written for incidents and human responders, not routine agent tasks | High-impact or recovery work where ownership matters |
That comparison is the decision framework for choosing a format. Start with the prose form. Move to the state-machine form when a run repeats often enough that skipped checks become a real risk. Borrow the playbook header, trigger, impact, rollback, owner, version, whenever the cost of a bad run is high, whichever body format sits underneath it. Practised playbooks matter: Google SRE practice, as summarised in the playbook source, puts the improvement at roughly threefold for mean time to recovery compared with improvising a response.
Prove it: the cold-run test
A runbook is not proven when it reads well. It is proven when a fresh run, with no help from the person who wrote it, passes its own checkpoints. Run the test like this:
- Freeze the version. Save the runbook with its version noted, and use a low-stakes copy of the real inputs, a draft page, a test record, a secondary account.
- Check the prerequisites. Backup exists and a restore has been tested. The agent is connected with the lowest role that works. Every named input is present.
- Hand over only the runbook. No extra chat, no hints, no corrections mid-run. Anything the runner has to ask about is a gap in the document, and it gets written down.
- Let each checkpoint do its job. At every pause, confirm the step's stated output is actually present before approving the next step.
- Force one failure. Remove an input or use a wrong value on purpose. The correct behaviour is a recorded failure and a stop, in line with the stop rule, not a workaround.
- Run the after checks. Compare the result directly against the goal, check any page at phone width, and confirm the log entry exists and names the runbook version.
- Fix the document, not the memory. Every question, guess or workaround from the run becomes an edit to the runbook. Then run it cold once more.
What success looks like: the second cold run completes with no questions outside the runbook, every step records a pass, the forced failure stops the run cleanly, and the log entry lets a reader reconstruct what happened. If the runner needed oral help, the runbook failed the test, however good the final output looked.
Sources, accessed October 25, 2026: CometAPI, “How to Use ChatGPT Agent Mode” (runbook prompt: goals, constraints, checkpoints, rollback on errors); StateM project on GitHub (YAML runbooks, before-transfer checks, recorded transitions); UiChemy, “AI Agent Workflow for Many WordPress Sites” (before/after checklists, lowest role, tested restore); beefed.ai, “Automated Runbooks for Incident Response” (playbook fields, verification, SRE practice). Tool behaviour varies by platform; adapt the format to the agent system in use.
, Dex Carter, Tech Writer