# An incident runbook for AI agents: stop, scope, rotate, review, resume

> A copy-and-adapt runbook for when an AI agent does something it should not: who does what in the first minutes, how to find out what it touched, which credentials to rotate, and how to bring agents back safely.

A copy-and-adapt runbook for when an AI agent does something it should not: who does what in the first minutes, how to find out what it touched, which credentials to rotate, and how to bring agents back safely.

November 24, 2026 · 5 min read · The Sandscale team

Sooner or later an agent will do something nobody intended. It might delete the wrong branch, open fifty pull requests, post a credential in a public issue, or run a script it picked up from a poisoned README. The first time it happens, teams usually improvise. This runbook is meant to be copied into your own docs and adapted before that day comes.

It has five phases: stop, scope, rotate, review, resume. Each phase lists the questions to answer and the evidence to collect. Fill in the bracketed names for your own team.

## Before anything happens

A runbook only works if a few things exist in advance:

- **An owner per agent.** Every agent, including the scheduled ones nobody thinks about, has a named human owner.
- **An inventory of credentials.** For each agent: which keys and tokens it holds, what they can do, where they are stored and how to revoke them.
- **One way to stop everything.** An organization-wide kill switch, and the names of the people allowed to pull it. Our post on [designing a kill switch](https://sandscale.dev/blog/kill-switch-for-ai-agents) covers what it should do.
- **A log you can trust.** A record of what agents did, written somewhere they cannot edit it.
- **A rehearsal.** Run this runbook once on a calm day, with a harmless fake incident.

## Phase 1: Stop (first minutes)

The goal is to stop the damage, not to understand it. Understanding comes next.

1. **Declare the incident** in your usual channel and name an incident lead. One person decides; everyone else reports to them.
2. **Pull the kill switch** if the agent is still acting, or if you do not yet know which agent it is. Do not spend minutes identifying the culprit while it keeps going.
3. **Stop the specific runs** you can identify: running sandboxes, scheduled jobs, CI workflows that trigger agents.
4. **Pause the triggers**: webhooks, schedules and queues that would start new agent runs, so releasing the kill switch later does not restart the problem.
5. **Write down the time** of each step. The timeline will matter.

Resist two temptations: deleting the agent’s output, and “fixing” things by hand before you know what happened. Both destroy evidence.

## Phase 2: Scope (the next hour)

Now answer: what did it do, with what access, and since when?

**Find the start.** Work backward from the visible damage to the first action that went wrong. The trigger is often earlier than the damage: an issue comment it read, a dependency it installed, a file it fetched.

**List every action in the window.** From your audit log, collect what the agent’s identity did between the start and the stop: commands run, files written, network destinations, API calls, messages sent, approvals requested.

**List every credential it could reach.** Not just the ones it used. Anything in its environment, its sandbox, its config files or its prompts counts as exposed if the agent was running untrusted instructions.

**Find the blast radius outside your systems.** Pull requests opened, issues commented on, messages posted, packages published, emails sent. These need cleanup beyond your own infrastructure.

Questions for the incident document:

- What was the agent asked to do, and by whom?
- What did it read that it should not have trusted?
- What could it do that it did not need to?
- Did any control fire, such as an approval request, a policy denial or a DLP block? Did anyone act on it?

## Phase 3: Rotate (as soon as scope is known)

Treat every credential the agent could reach as compromised, whether or not you saw it used.

1. **Revoke first, then reissue.** Revoking stops misuse immediately. Reissuing can wait until the incident lead is satisfied.
2. **Work from the inventory**, not from memory: API keys, cloud credentials, repository tokens, database passwords, webhook secrets, signing keys.
3. **Check for persistence.** Look for things the agent could have created to keep access: new keys, deploy keys, OAuth apps, webhooks, scheduled jobs, users added to groups.
4. **Revert what it changed**, with review: merged code, config, permissions. Reverts go through the normal review process, not straight to production.

## Phase 4: Review (within a few days)

Write a blameless review. Agent incidents tend to have the same few root causes, so check each:

- **Untrusted input reached the agent** with no marking or isolation: issue text, web pages, dependency files. See [from prompt injection to code execution](https://sandscale.dev/blog/prompt-injection-to-code-execution).
- **The agent had more access than its task needed**: a broad token, network it did not need, secrets in its environment.
- **No human checkpoint** stood in front of an irreversible action. See [which actions should wait for a person](https://sandscale.dev/blog/human-approvals-for-agent-tool-calls).
- **Code ran somewhere it could reach valuable things**: a laptop, a shared CI runner, a production host.
- **Nobody was watching**: alerts existed but went to an unread channel.

Each finding should end in a change with an owner and a date. “Be more careful” is not a change.

## Phase 5: Resume (deliberately)

1. **Fix the trigger** that started it, or block it, before restarting anything.
2. **Restart one agent at a time**, starting with the least privileged, and watch the first runs.
3. **Release the kill switch** only once the incident lead agrees, and record who released it and when.
4. **Re-enable triggers gradually**, so a backlog of queued work does not all start at once.
5. **Close the incident** with a link to the review and its follow-ups.

## Where Sandscale helps

If your agents run on Sandscale, several steps above have a direct counterpart:

- **Stop.** Every organization has a kill switch that stops its agents at once, on every plan, and turning it on or off is recorded.
- **Scope.** The [audit log](https://sandscale.dev/docs/concepts/audit) is hash-chained, so a change or a gap shows, and records sign-ins, sandboxes started and stopped, commands run, files moved, secrets used, approvals and policy changes, with who, when and where. Every plan can read it in the console or through the API; Team and Enterprise can export it for a period as evidence.
- **Rotate.** Personal API keys can be revoked at once with `DELETE /api/v1/account/api-keys/{id}` or from the console, and every key has an expiry of at most 90 days, per the [authentication docs](https://sandscale.dev/docs/api/authentication). The [security page](https://sandscale.dev/security) says Vault leases end with the job. A secret a run could read still counts as exposed: rotate it at its source and store the new value in Vault, and later runs get the new one.
- **Review.** Approval requests and decisions are recorded with who decided and why.

None of that replaces the runbook. Tools record and enforce; people decide what happened and what changes next. Write the runbook down now, while nothing is on fire.

**On this page**

1. Before anything happens
2. Phase 1: Stop (first minutes)
3. Phase 2: Scope (the next hour)
4. Phase 3: Rotate (as soon as scope is known)
5. Phase 4: Review (within a few days)
6. Phase 5: Resume (deliberately)
7. Where Sandscale helps

**Run your agents in a box of their own**

Each sandbox is a Firecracker microVM. Free includes 100 awake vCPU-hours a month.

[Start free](https://cloud.sandscale.dev/auth/signup)

## Keep reading

- [November 26, 2026 · **30 questions to ask any agent sandbox provider before you sign up** · A vendor-neutral checklist for choosing where your agents run code: isolation, network, secrets, lifecycle, billing for waiting time, governance, data location, reliability and leaving. With where to find each answer for Sandscale.](https://sandscale.dev/blog/questions-to-ask-an-agent-sandbox-provider)
- [November 26, 2026 · **Agent sandbox glossary: 41 terms in plain English** · Plain definitions for the words that come up when you run AI agent code in isolation: microVM, VMM, KVM, jailer, gVisor, seccomp, namespaces, egress allowlist, lease, snapshot, warm pool, awake vCPU-hour and more.](https://sandscale.dev/blog/agent-sandbox-glossary)

---
Source: https://sandscale.dev/blog/agent-incident-response-runbook
