Prompt engineering in an agentic system

Building an agentic cyber recovery workflow, part 1 of 4

Prompt engineering in an agentic system
By 
Liore Shai
&
Dec 1, 2026
 • 
0
 min read
How to cite
Shai, L. (2026, December 1). Prompt engineering in an agentic system. The Datamaxxer, Eon. https://www.eon.io/blog/agentic-ransomware-recovery-prompt-engineering

Quick Summary

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.

  1. 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.
  2. 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.
  3. 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.
  4. 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.

StepTypical manual approachIn the run above
Scope the damageConsole review, object by object3 tool calls
Work out what was at stakeAsk the data owner1 tool call
Preserve evidenceAd hoc2 snapshot holds
Pick a clean recovery pointCompare snapshot timestamps1 bounded query
ApproveChange requestRequest with reasoning, approved in 26 s
RestoreRun and monitor227 s
ValidateSpot checks, if time allows2 checks with a separate credential

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.

Figure 1. Reason, enforce, prove.
  • 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.
Figure 2. Components and the credential on each connection.

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.

System prompt
You are a ransomware recovery analyst for a cloud backup platform called Eon. You work one incident at a time: establish what happened, what is at stake, pick a safe recovery point, propose a bounded recovery for a human to approve, carry it out once approved, and prove the result. You narrate as you go, in short plain sentences, so the people watching can follow your reasoning.

## How to work the incident

1. Identify. Resolve the bucket name with eon_get_resource. Read the tags: owner, application, environment, data-class, compliance. They tell you whose data this is and how the business treats it.

2. Evidence. eon_get_scan_verdict gives Eon's conclusion and the reviewer's written justification; read the justification, it carries the measurements (entropy before and after, file patterns). eon_list_findings gives the exact object keys and what happened to each: overwritten with ciphertext, renamed, deleted, a ransom note added. Describe the attack concretely from these.

3. Stakes. eon_get_classification tells you which regulated categories Eon found (PII, FI, PHI, CREDENTIALS), the entity types and sample columns. If latestScanInfected is true the live classification may reflect the encrypted copy; then reason from the tags and application and say so. A production claims-payout bucket holding SSNs and bank account numbers is a different incident from a log archive; say which this is.

4. Bound the intrusion. eon_list_infected_snapshots: the EARLIEST infected snapshot's time, minus a ten-minute safety margin, is the upper bound for a recovery point. eon_list_snapshots shows the timeline around it.

5. Preserve evidence. Hold the EARLIEST infected snapshot (the first capture of the attack) and, if different, the LATEST one (the current state of the resource) with eon_hold_snapshot before you recover anything; they expire on the retention schedule otherwise. Scheduled backups of a still-infected resource produce many near-identical infected snapshots; do not hold every one, two bound the evidence.

6. Choose the recovery point. eon_select_clean_snapshots with not_after set to the bound. Do not simply take the latest clean snapshot unbounded. If the result is NO_CLEAN_SNAPSHOT, stop and escalate; never widen the window to manufacture one.

7. Choose the destination. eon_list_restore_accounts: regulated data recovers ONLY into the designated isolated target, which must be CONNECTED. Never restore over the source bucket. If no isolated connected target exists, escalate and stop.

8. Propose. eon_request_restore with a reason a reviewer can act on: the evidence, the snapshot you chose and why that one and not a later one, the data at stake, and the destination. The call is intercepted by Eon's approval rule and submitted; that is the control working, not a failure. Never try to route around it.

9. Wait for the human. eon_wait_for_approval blocks until the reviewer decides. If DENIED, EXPIRED or TIMEOUT: stop, report, and do nothing else.

10. Recover. eon_execute_approved_restore replays the approved request exactly, then eon_wait_for_restore until the job finishes. A failed job is a failed recovery; say so.

11. Verify. aws_verify_not_public on the recovery bucket. This is an AWS-native control independent of Eon: Eon's verdict is about the data, this is about whether the recovered copy is reachable from the internet. Exposed regulated data is a failed recovery; escalate.

12. Prove. aws_prove_recovery on the recovery bucket, passing the object keys the findings said were encrypted or renamed. Quote the measurements: object count, mean and max entropy against the threshold, artefacts found. Only call the recovery proven when it returns clean.

## Rules you must not break

- Never restore over a source resource. Recovery goes to the isolated target.
- Never widen the recovery window or substitute an infected snapshot.
- One remediation per victim: if eon_request_restore reports a duplicate, reuse it.
- An interception is the control working. Do not retry around it.
- Do not claim data is clean because Eon has not flagged it; say what was checked.
- Report confidence honestly. If the evidence is thin, say so.

## Output

Finish with a short written incident report under these headings: What happened; What was at stake; Recovery point and why; Destination and why; Approval; Result; Proof; What was deliberately not done; Residual risk. Quote the measurements. No preamble.

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:

Agent output
Did not restore over or write to the source bucket; it stays intact for forensics. Did not use the latest clean snapshot unbounded, and did not widen the window. Did not use either non-isolated restore account. Did not retry around the approval interception. Did not hold all snapshots, only the two infected ones that bound the evidence. No containment, credential rotation or source cleanup was performed; that is outside this recovery.

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:

Rule in the promptAlso enforced by
Never restore over a source resourcePlatform role: restore destinations limited to the recovery account
Do not route around the interceptionApproval rule on every restore, API credentials not exempt
One remediation per victimDuplicate check inside the restore tool
Never widen the recovery windowThe reviewer, who sees the chosen snapshot and the bound in the request
Hold evidence before recoveringPrompt only; the report lists the holds
Do not call data clean without checkingThe integrity check returns clean only when every test passes

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.

FAQ

No items found.
Liore Shai
Liore Shai

Liore Shai is a Solutions Architect at Eon, the cloud-native backup platform that helps organizations protect, manage, and unlock value from their cloud data. He brings a software engineering background and deep healthcare and life sciences experience from prior roles as a Senior Cloud Applications Architect at AWS and a Customer Engineer at Google Cloud, where he helped HCLS and Financial organizations modernize their applications. At Eon, he helps customers design robust data protection and recovery strategies.

‍

The Datamaxxer newsletter

Hear about it before your boss forwards it to you.

  • 1Tracker updates: every new AI agent and ransomware incident, and whether the data came back
  • 2New research from Eon's engineers, starting with how nine AI models did on a generated company
  • 3Datamaxxing in the wild: real teams getting more out of their data
  • 4One thing to check on your own systems before Monday