Your team has stopped the compromised AI agent. The malicious document is deleted and the credentials are replaced. The incident looks contained. The harder question comes next: what exactly are you bringing back?
The software may be clean, but the agent may still remember a false instruction. Another worker (a “worker” is a discrete execution unit – like a sub-agent or script – that carries out delegated tasks.
While the main agent decides what to do, the worker executes how to do it.), a separate agent or automated job, may still be carrying out its request. An external action may have completed without the agent receiving confirmation.
The recovery needs to address three things together: what the agent remembers, what it has set in motion and what it has already changed.
Restarting the process addresses only part of that problem.
A clean restart can inherit an old mistake
Consider a hypothetical support agent that reads tickets and prepares diagnostic files.
An attacker places a fabricated troubleshooting procedure in a document the agent can access. The procedure directs the agent to upload diagnostics to an external ‘verification service’. This is a simplified example of indirect prompt injection, where instructions hidden in content an agent reads are treated as legitimate.
The agent saves a summary describing this as an approved practice. It then assigns the upload to another worker. Monitoring detects the suspicious destination. Responders stop the agent, revoke its credentials and remove the document.
That response may prevent further damage. It does not establish that the system is ready to resume.
The saved summary could generate another upload when the next support request arrives. The delegated worker could continue its existing task. Or the upload could already have completed, despite the agent recording it as unfinished.
Each possibility requires a different check.
The features that preserve progress also preserve risk
Agent systems increasingly separate the running process from the information and work it uses.
LangGraph, for example, distinguishes saved conversation state from memory shared across conversations. Replacing a worker therefore does not necessarily replace everything influencing its decisions. That separation supports useful capabilities: remembering previous work, resuming interrupted tasks and coordinating other agents.
It also expands the recovery boundary.
A short summary can preserve the conclusion of a malicious document while losing the context that should make it suspicious. “An external attachment recommending this destination” can become “use the approved destination”.
The issue is no longer simply whether malicious text remains. It is whether the agent still treats an attacker-influenced conclusion as a reason to act.
What should a safer recovery design do?
I would organise recovery around three responsibilities, followed by staged restoration and testing. These are proposed practices, not a tested standard. They draw on established distributed-systems techniques and emerging research.
1: Repair the information behind decisions
Deleting the original source is the starting point.
Responders need to identify the summaries, saved procedures and shared records derived from it. Where possible, the memory system should retain links showing which sources contributed to each record.
That allows a team to trace a chain such as:
Untrusted attachment → saved summary → troubleshooting procedure.
A research project called MemoRepair examines withdrawing affected information before publishing repaired replacements. Its guarantees depend on knowing the relevant relationships between records.
When those relationships are missing, selective deletion provides limited assurance. A broader rebuild may be necessary.
The restriction must also reach search indexes and caches. Marking a memory as unsafe achieves little if another part of the system still retrieves its contents.
Preserve the original material for investigation, but keep it outside the recovered agent’s normal retrieval path. Otherwise, evidence retained to explain the incident can reintroduce it.
2: Stop unfinished work at the point of execution
Stopping the main agent does not necessarily stop its scheduled jobs or delegated workers.
The workflow system should track what was assigned, who accepted it and whether it remains active. Cancellation requests need follow-up: the Agent2Agent (A2A) protocol explicitly recognises that cancellation may not succeed.
One practical design is to attach an execution version to work. During containment, a trusted controller changes the current version. Tool services then reject requests from workers using the old version.
The essential detail is enforcement. The receiving service must check before acting. A warning in the agent’s instructions cannot provide the same control.
Permissions need similar treatment. A restored memory saying “this was approved” must be checked against the current approval record.
Revocations and already-used approvals must survive a restart. Restoring an earlier conversation must not restore permission that has since expired or been consumed.
3: Establish what actually happened outside the agent
A timeout does not establish that an action failed.
The receiving system may have completed an upload, changed a record or issued a payment before its response was lost.
Recovery should distinguish confirmed success, confirmed failure and an unknown outcome. Treating every unknown as a failure invites unsafe retries.
Keep a durable record of each consequential operation, with a stable identifier that survives restart. Where supported, use that identifier to check the receiving system or retry without creating an additional effect.
Research on durable authorisation state reinforces a related point: issuing a fresh token does not necessarily mean the underlying action has fresh approval.
If the outcome cannot be established, block dependent work pending review.
Also recognise the limits of corrective action. Removing an access grant may address an unauthorised change. Deleting a poisoned memory cannot recall information already disclosed.
Restore permissions in stages
These responsibilities should sit outside the agent’s own judgment.
A trusted recovery controller — or an equivalent operational process — should coordinate repaired memory, outstanding tasks and external outcomes. It can then restore specific capabilities. The agent might regain access to public documentation while remaining unable to upload files or change accounts.
For each permission restored, the owner should know which information the agent will use, which unfinished tasks remain and which uncertainties could affect the action. This also protects useful service. Keeping everything disabled indefinitely prevents activity, but it does not demonstrate successful recovery.
Test what happens after restart
A meaningful exercise should leave a poisoned summary after deleting its source. It should reconnect an old worker and withhold the receipt for an action that was already completed.
Then test the recovered system. Does it exclude the summary? Reject the old worker? Establish the external outcome before retrying? Prevent an earlier approval from being reused?
Run legitimate tasks alongside these cases. Record harmful actions attempted, duplicate effects, unresolved operations and useful work completed.
The test should show whether the controls work together across the system. Before you restore access, confirm:
● Memory: affected summaries and procedures are repaired or quarantined, including in search indexes and caches.
● Delegated work: every outstanding task is stopped or accounted for, and old workers are rejected.
● External actions: each one is confirmed as done, confirmed as failed, or marked unknown and blocked.
● Approvals: used or revoked approvals cannot be reused after the restart.
● Permissions: restored one capability at a time, with legitimate tasks tested.
What a trustworthy restart requires
A trustworthy restart depends on consistency between the agent’s knowledge, its current authority and the real-world effects of its previous work.
Before restoring consequential access, the responsible owner should be able to explain what was repaired, what was stopped, what already happened and what remains uncertain.
Recovery isn’t complete when the agent is running again. It is complete when the team can show, with evidence, what was repaired, what was stopped, what already happened and what is still unknown.
