Recovering from ransomware requires some serious decision-making, especially under pressure. We need to consider which resources were hit, what type of data they held, and whether we have a clean recovery point that predates the attack.
An agentic workflow makes this repeatable and tunable. Deadlines, worry about blame, and lack of sleep don’t change how it runs. In this series, we’ll explore how to create an agentic workflow that can safely respond to a ransomware attack.
The example recovers an S3 bucket hit by simulated ransomware. It runs on the Strands Agents SDK with Claude Opus 5 on Amazon Bedrock, and uses Eon as the backup platform. Participants at an agentic recovery workshop in New York on October 8 each ran it against their own bucket. The code is public at eon-solutions/eon-agentic-recovery-workshop (MPL-2.0). Excerpts are trimmed for length, with error handling removed.
- Prompt engineering in an agentic system (this post): Writing the system prompt as a runbook, adding stop conditions, telling the model what a guardrail looks like when it fires, and setting an output contract that makes the agent report what it chose not to do.
- Governance and guardrails: The agent can propose a restore but cannot run one. A server-side approval rule intercepts the call, a person decides, and the platform replays the exact request that was approved. It also covers scoped identities on both the platform and AWS sides.
- Tool calling and enrichment: Fifteen tools that are one or two API calls each, docstrings that carry the operational detail, a blind spot that makes “zero sensitive data found” mean the opposite, and threat intel, CMDB, and lineage over MCP.
- Validation and proof: Keeping the compromised data intact as evidence, and proving the restored copy is clean with a credential the backup platform never sees, along with what that proof cannot show.

The agent’s dashboard 21 seconds into a run. The phase track across the top follows the prompt's numbered steps; the analyst panel shows the model’s narration.
The whole run, start to proof, took five minutes.
Three layers: reason, enforce, prove
The design has three layers, and each one assumes the previous layer can be wrong.

- Reason: The model follows a runbook prompt, reads evidence through tools, and proposes a recovery with its reasoning attached. This post.
- Enforce: The backup platform limits what the agent’s credential can reach, intercepts every restore for a human decision, and executes only the stored copy of the approved request. Part 2.
- Prove: A second credential, in AWS, checks the restored copy without involving the platform. Part 4.

The same builder creates the agent for a laptop run and for Bedrock AgentCore Runtime:
DEFAULT_MODEL = os.environ.get("AGENT_MODEL", "us.anthropic.claude-opus-5")
def build_agent(model_id=None, callback_handler=None, hooks=None, streaming=True) -> Agent:
model = BedrockModel(model_id=model_id or DEFAULT_MODEL, region_name=AWS_REGION,
streaming=streaming, max_tokens=8192)
kwargs = {}
if callback_handler is not None:
kwargs["callback_handler"] = callback_handler
return Agent(model=model, tools=[*EON_TOOLS, *AWS_TOOLS], system_prompt=SYSTEM_PROMPT,
hooks=hooks or [], **kwargs)
There is no state machine in the code. Strands runs the loop: the model picks a tool, reads the result, and repeats until it stops calling tools. The order of operations comes from the system prompt and from what the tools return, which puts most of the design work in the prompt.
The system prompt is a runbook
The prompt is written like an incident responder’s runbook: a role, a numbered procedure, rules, and the output format. Here it is in full.
Numbered steps that name their tools
The steps give the model an order of operations without code enforcing one. Each step names the tool to call, so the model isn’t choosing among fifteen tools from their descriptions alone. Each step also says what to read in the result. The numbering also drives the dashboard’s phase track, which maps every tool to a step.
Judgment calls, written down
The decisions a senior responder makes are stated with numbers: a ten-minute margin before the earliest infected snapshot, two held snapshots rather than every one, regulated data restored only to a connected, isolated target. Because they’re written into the prompt, the agent makes them the same way on every run, and a reviewer can read the policy it followed.
Stop conditions on every failure branch
Every branch that should end the run says so. No clean snapshot in the window means escalate. No isolated, connected target means escalate. A denied, expired, or timed-out approval means stop and report. Without a stop condition, the model still has its instruction to finish the task, so it looks for another way to do it.
Telling the model what a guardrail looks like
When the agent asks for a restore, the platform intercepts the call and returns an approval request instead of a restore job. To a model that hasn't been told about the approval rule, that looks like a failed call. Step 8 and the fourth rule describe it in advance: the interception is the control working, submit the request and wait. The guardrail holds either way (part 2 shows why). Telling the model about it keeps the run on its procedure and the narration accurate.
Honesty rules
Two rules target the failure that matters most in a recovery report: overstating certainty. The agent may not call data clean just because the platform hasn't flagged it, and it must report its confidence. Part 4 shows what the second rule produced.
An output contract
The report has fixed headings and asks for measurements, not prose. Two headings carry most of the value for the reviewer. Here is “What was deliberately not done” from the run above:
Each line can be checked against the tool trace. “Residual risk” is in part 4.
Keep incident details out of the system prompt
The system prompt is the standing runbook. The incident comes in as the user message, built from the bucket name:
def incident_task(bucket: str) -> str:
return "\n".join([
f"Eon's ransomware detection has flagged the S3 bucket {bucket}.",
"A human reviewer is in the room and will decide on your proposal.",
"",
"Work the incident end to end, steps 1 through 12 of your runbook: investigate,",
"preserve evidence, choose the recovery point and destination, submit the restore",
"for approval, wait for the decision, carry out the approved restore, then verify",
"and prove the recovered copy. Narrate briefly between steps. Finish with the",
"incident report.",
])In a hosted run, the platform’s detection notification supplies the bucket name. Keeping incident facts out of the system prompt means the runbook is reviewed and versioned once, and runs differ only in their input.
What a prompt cannot do
A prompt makes the agent behave well. It does not make it safe. The prompt is input to the model, and so is everything a tool returns, including text an attacker controls, such as a ransom note’s file name. Every safety rule in the prompt needs a second place where it is enforced, out of the model’s reach:
Two rows rely on a person or on the prompt alone. Part 2 covers the platform controls.
Checklist: prompting a recovery agent
- Write the runbook as the system prompt: a role, numbered steps that name their tools, rules, and output headings.
- State judgment calls with numbers.
- Give every failure branch a stop condition.
- Describe what each guardrail looks like when it fires.
- Ask the report for what was not done and what risk remains.
- Keep incident facts in the task message.
- Give every safety rule a second place it is enforced, outside the model.
Next, part 2: governance and guardrails. How the platform intercepts the restore, binds an approval to one exact request, and scopes what the agent’s identities can reach.


