What Should You Do When an AI Agent Makes a Mistake?
What to do when an AI agent makes a mistake: stop it, find out what it did, undo what you can, fix the access or instructions behind it, then review it.
Reviewed by WaveBrain Operations TeamReviewed 8 min read
The short answer
When an AI agent makes a mistake, stop it first, then find out everything it did, undo what you can, fix the cause and review it before giving back its freedom. Pause the agent or revoke its key, read its record from the first bad action onward, reverse each change in the system it touched, then change the permission or instruction that let it happen, not just the prompt.
Sooner or later an AI agent you rely on gets something wrong. A support agent promises a refund you don't offer. A marketing agent posts the wrong price. A coding agent deploys a change that breaks checkout. The first instinct is to fix the visible problem and move on, but the visible problem is rarely the only one.
This guide is for founders and ops owners who run AI agents or "AI employees" and want a calm, repeatable way to handle mistakes. It uses the same order an incident team would: contain, investigate, undo, fix the cause, then review. None of the steps need code.
What should you do when an AI agent makes a mistake?#
You stop the agent, work out everything it did, undo what you can, fix the reason it happened and watch it closely for a while. Doing it in that order matters, because an agent left running keeps repeating the mistake while you clean up after it.
- Contain it: pause the agent, its schedule or its workflow, and revoke its key if you can't pause it.
- Find out what it did: read its actions from the first wrong one onward, across every tool it touched.
- Undo what you can: reverse each change in the system where it happened, starting with anything that reaches customers or money.
- Tell the people affected: customers, teammates or clients who saw or acted on the mistake.
- Find the cause: a vague instruction, too much access, a missing approval step or bad input.
- Fix the cause in the tool or account, not only in the prompt.
- Review it: give the agent less freedom for a week, then check its record before you restore it.
NIST's incident response guide, SP 800-61 Rev. 3, frames the same work as detection, response and recovery. You don't need a security team to follow that shape.
How do you stop an AI agent from doing more damage?#
You stop it by switching off whatever makes it run, then cutting its access if switching off isn't instant. For a chat-based agent that means ending the session. For a scheduled bot or an n8n, Make or Zapier workflow, it means turning off the schedule or trigger, because those keep running while you sleep.
If the agent runs somewhere you can't reach quickly, revoke its credentials. That's much easier when each agent has its own API key or login, because you can cut off one agent without locking out the rest. Our guide on giving an AI agent tool access safely covers how to set that up before you need it.
Don't delete the agent or its history at this point. You'll need both to work out what happened.
How do you find out exactly what the agent did?#
You read its record from just before the first wrong action to the moment you stopped it, and you check every system it could reach, not just the one where you noticed the problem. A refund promise in one email often means the same promise went out in other emails that day.
Start with whatever gives you the widest view: a shared activity log if your agents report to one, then each agent's own history, git for code, and each platform's change history for ads, posts or records. For each action, note what changed, where, when and whether it reached anyone outside your team. Our guide on how to see what your AI agent did walks through where each kind of agent keeps that history.
Write the list down. It becomes your undo checklist and the evidence for the fix.
How do you undo an AI agent's mistake?#
You undo each change in the system where it happened, with that system's own tools, starting with anything customers can see or that moves money. There's rarely one undo button, so the table gives a first move and a log check for the common mistake types.
| Mistake type | First move | What to check in the log |
|---|---|---|
| Wrong email or message to customers | Stop sends, then send a short correction | Every email or message the same agent sent since the first bad one |
| Wrong post or published content | Unpublish or edit it on the platform | Other posts and scheduled items from the same run |
| Bad code change or deploy | Revert the commit or redeploy the last good version | Pushes, deploys and database changes in that project around the same hour |
| Ad budget, price or setting changed | Restore the old value from the platform's change history | Other ad or pricing changes by the same agent |
| Records deleted or overwritten | Restore from a backup or the platform's trash | Bulk updates or deletions in the same session |
| Agent stopped working silently | Restart it and check its login or quota | When it last logged anything and what failed just before |
Coding agents have their own undo for file edits. Claude Code's checkpointing lets you run /rewind to restore code, the conversation or both to an earlier prompt. Its docs are clear about the limits: files changed only by Bash commands aren't tracked, changes made outside Claude Code usually aren't captured, and checkpoints are "not a replacement for version control". Anything an agent did outside your files, like a deploy, an email or a database change, has to be undone where it happened.
When people outside your team saw the mistake, tell them plainly what happened and what you've fixed. A short, honest correction usually lands better than silence.
How do you find the cause of the mistake?#
You find it by asking which of four things went wrong: the instructions, the access, the approvals or the input. Most AI employee mistakes trace back to one of them, and each needs a different fix.
- Instructions: the job description was vague or missing a rule, so the agent guessed. Example: it was never told refunds over $50 need a person.
- Access: it had a tool or permission its job didn't need. OWASP's LLM06:2025 Excessive Agency names "excessive functionality", "excessive permissions" and "excessive autonomy" as the root causes of harmful agent actions.
- Approvals: a high-impact action ran without a person checking it first. OWASP recommends human-in-the-loop control "to require a human to approve high-impact actions before they are taken."
- Input: the agent acted on wrong data, or on text in an email, web page or document that told it to do something. OWASP lists prompt injection among the triggers for excessive agency.
Anthropic's guidance on building agents warns about "the potential for compounding errors" when agents act on their own for many steps, and recommends testing in sandboxed environments with guardrails. If the mistake grew over many steps, the fix is often an earlier checkpoint where a person looks at the work.
How do you stop the same mistake from happening again?#
You change the thing that allowed it, and you put the hard limits in the tool or account rather than only in the prompt. A line in the instructions shapes what the agent tries to do. A permission setting decides what it can do.
Claude Code's permissions docs put it directly: permission rules "are enforced by Claude Code, not by the model". So if a coding agent pushed to main by mistake, add a rule that blocks or asks before that push, as well as a line in its instructions. For business tools, swap a full-access login for a narrower one, or move the action into a draft-and-approve flow.
Then give the agent less freedom for a while. Have it draft instead of send for a week, or require approval for the action type that went wrong. Check its record at your next weekly review of your AI employees, and restore its freedom only when that record looks clean.
Where does WaveBrain fit?#
WaveBrain helps with the "find out what it did" and "review" steps. It's a hosted activity log that agents report their finished actions to, so you get one timeline across Claude Code, Codex, Cursor, Hermes, Claude Desktop, scripts and no-code workflows instead of opening each tool separately.
Agents connected to its MCP server get a log_action tool and instructions to call it after any action with an external effect, such as an email, a post, an ad change or a deploy. Scripts and workflows log with one REST request. Each entry has a title, details, the project, a link, a status and the agent's name, and you can filter by agent, project or action type and search titles and details. Failed actions can post to a Slack channel with a link to the entry, and the Stats page shows when each bot last did anything, which helps catch an agent that stopped silently. The dashboard suggests a separate API key per machine or agent, so you can revoke one agent's key without touching the others.
Be clear about what it isn't. WaveBrain records only what agents report, so an agent that never calls log_action leaves no entry, and its own history still matters. It can't undo, block or approve anything. It isn't LLM tracing and doesn't record prompts, responses or token costs. It isn't a tamper-proof audit trail, and it doesn't filter secrets out of what agents write, so entries should read like commit messages. See what gets logged for the full list.
The Free plan includes 1,000 actions a month and 7-day history. Pro is $12 a month for 50,000 actions and 90-day history, which helps when a mistake is only noticed weeks later. You can start free with no credit card.
Frequently asked questions#
What's the first thing to do when an AI agent makes a mistake?#
Stop it. Pause the agent, its schedule or its workflow, or revoke its key, so it can't repeat the mistake while you investigate.
Should I delete an AI agent that made a mistake?#
Usually not. Most mistakes come from vague instructions, too much access or a missing approval step, and fixing those works better than starting over. Keep its history either way, since you need it to see what happened.
Can I undo everything an AI agent did?#
Not always. File edits can often be reverted with git or a coding agent's checkpoints, but sent emails, published posts and payments have to be corrected in each platform, and some can't be taken back.
Is telling the agent "don't do that again" enough?#
No. Instructions shape what an agent tries, but they aren't a limit. Put the hard rule in the tool's permissions or the account's access, and add an approval step for the action type that went wrong.
How long should I watch an agent after a mistake?#
A week of closer checks is a sensible default: drafts instead of sends, or approval for the risky action. Restore its freedom once its record for that week looks clean.