Skip to content
mentoor

Topic 3 of 5 · 5 min read

Runbooks people and agents can execute

Goal: Rewrite a vague runbook into numbered, verifiable steps with stop conditions that an on-call engineer or an agent can follow.

A good runbook is a numbered list of steps where each step says what to do, how to check it worked, and when to stop. If a tired engineer at 3 a.m. or an AI agent can follow it without guessing, it is good enough.

Check yourself · 1 of 3

Which line is the most executable runbook step?

Choose one answer

Why it matters

During an incident nobody reads a long essay. They look for the next action. A vague line such as "check the database and restart if needed" hides decisions: check what, restart which service, and what if it does not recover? A human fills the gaps from experience. An agent fills them with its best guess, and a wrong guess in production can make things worse. Runbooks that are safe for an agent are also better for people.

Anatomy of a step

For every step write:

  1. Action. One command or click, exact and copyable. Name the environment, for example prod-eu.
  2. Expected result. What you should see, such as "HTTP 200 and status: ok".
  3. Stop condition. What to do if it does not match: stop, do not retry, call a named role.
  4. Approval gate for risky steps. Anything that deletes data, changes access or restarts a shared service says "ask the incident commander first". An agent must wait for a human yes.
  5. Rollback of the step, if it has one.

Start the runbook with the symptom it covers, the owner, and a "last tested" date. Keep read-only checks before changes. Put the safest mitigation first.

Before and after

Vague:

If the queue backs up, check the workers and restart them. Clear old jobs if needed.

Executable:

Runbook: email queue backlog (owner: platform, last tested 2026-11-20)

1. Check depth: `queue-cli depth emails --env prod`
   Expect: under 5,000. If above 50,000, go to step 4 now.
2. Check workers: `queue-cli workers emails --env prod`
   Expect: 8 healthy. If fewer than 4, STOP and page platform on-call.
3. Restart one worker: `queue-cli restart emails-worker-1 --env prod`
   Expect: depth begins falling within 3 minutes. If not, STOP, do not restart others.
4. [APPROVAL: incident commander] Scale workers to 16:
   `queue-cli scale emails 16 --env prod`
5. NEVER purge the queue. Jobs are customer emails and cannot be rebuilt.

What goes wrong

  • Stale steps. Commands that no longer work erode trust. Test the runbook in a game day and record the date.
  • No stop condition. The reader keeps trying actions after the situation has changed.
  • Destructive steps without a gate. "Clear the cache and the table" is one slip from data loss.
  • Written for the author. Names a dashboard "the usual one". Link it.
  • Too broad for an agent. Give an agent a narrow runbook and narrow permissions, so a misread step cannot reach beyond it.

Examples

Turning a vague line into a step

Before: "Restart the API if it is slow." After: "3. Run kubectl rollout restart deploy/api -n prod. Expect all pods Ready within 4 minutes. If any pod stays unready after 4 minutes, STOP and page the platform on-call; do not restart again."

An approval gate for an agent

A runbook lets an agent run read-only checks alone: queue depth, worker status, recent deploys. Step 4 reads "[APPROVAL: incident commander] scale workers". The agent posts its proposed command and waits. A human types yes, and only then does the agent run it.

Key points

  • Each step needs an exact action, an expected result and a stop condition.
  • Put read-only checks first and the safest mitigation before riskier ones.
  • Mark destructive or shared-system steps with an approval gate that an agent cannot skip.
  • State what the runbook must never do, such as purging a queue of customer data.
  • Record an owner and a last-tested date, and test runbooks before you need them.

Common mistakes

  • Writing "check and fix if needed" instead of exact commands with expected output.
  • Leaving out stop conditions, so the reader retries a failing step forever.
  • Mixing destructive steps in with safe ones and giving no approval gate.
  • Never testing the runbook, so commands and links have silently gone stale.

Check yourself · 2 of 3

Why does a step that deletes data need an approval gate in a runbook an agent may follow?

Choose one answer

Check yourself · 3 of 3

What should a runbook step say to do when the expected result does not appear?

Choose one answer

Practice items, not counted towards your mastery.

Start here

More for this topic