Pattern 34 · Agents

Agent sandbox & dry-run preview

A plan in words says what the agent intends. It does not show what will actually change in your data.

By Alex StepikinUpdated December 20264 min readLive demo
In short

Run the task as a dry run against a snapshot, then show counts of what would be created, changed and deleted and the before and after of each item. Let people exclude items, apply the approved change set, and report any drift from the preview. Say plainly what the simulation could not check.

Live demo · try it

An interactive mock built in plain HTML, CSS and JavaScript. Data is fictional; no model is called.

FitWhen to use it — and when not

Use it when

  • Bulk changes to records, files or settings (rename, merge, archive, reprice)
  • Actions that are hard to undo: deletes, sends, payments, publishing
  • Tasks where the agent’s query decides the scope ("all stale contacts") and the count matters

Skip it when

  • Single small edits the user can see and undo immediately
  • Actions whose effect cannot be simulated honestly, such as a send to an external system you cannot read from
  • Tasks cheap enough that running and undoing is faster than previewing

AnatomyThe parts of the pattern

  1. Dry-run triggerA named mode, not a hidden flag: "Preview changes" next to "Run".
  2. Summary countsCreated, changed, deleted, skipped; the first number people check.
  3. Change listEach item as before and after, grouped by type, with the deletes first.
  4. ExclusionsA checkbox per item or group to remove it from the run.
  5. Snapshot labelWhen the preview was computed and what it read, with a warning when it goes stale.
  6. Apply with drift reportApplying runs the same plan and reports anything that differed from the preview.

GuidelinesDo & don’t

Do

  • Show counts first, details second, and put destructive changes at the top.
  • Say what the simulation could not check: "Emails are not previewed. 12 will be sent."
  • Let people exclude items and apply the rest, without regenerating the plan.
  • After apply, report differences from the preview, even small ones.

Don’t

  • Call it a preview when the agent only restates the plan in other words.
  • Let a stale preview be applied silently; re-run it or require a confirmation.
  • Mix real and simulated results in one list without a label.
  • Show only the first ten items of a hundred; show the shape of the rest.

In the wildReal-world examples

Terraform (plan, then apply)kubectl (diff, --dry-run)rsync (--dry-run)Claude Code (plan mode)

Products named for reference only — no affiliation, and the demo above is an original illustration, not a copy of their UI.

For engineersImplementation notes

  • Build tools with a dry-run path that goes through the same code as the real one, and returns the intended change set instead of writing it. A separate "simulate" code path drifts from the real one.
  • Pin the preview to a snapshot id or a read timestamp; on apply, compare each target’s version and mark mismatches as drift.
  • Apply from the change set the user approved, not from a fresh model call; the model should not decide twice.
  • Cap preview size by summarising: counts and top N by risk, with a downloadable full list.

Q&ACommon questions

How is a dry run different from a plan preview?

A plan lists the steps the agent intends to take. A dry run executes those steps in simulation and shows the concrete result: which records, how many, before and after. The plan is the intent; the dry run is the effect on your data.

What if the data changes between the preview and the apply?

Pin the preview to a snapshot, compare each target’s version when applying, and report the ones that differ as drift. For stale previews, re-run or ask for a fresh confirmation instead of applying silently.

Which agent actions cannot be previewed honestly?

Anything with an external effect you cannot read from, such as sending email or charging a card. Show these as "will be sent" with the count and recipients, and do not present them as simulated results.

See alsoRelated patterns

All 40 LLM UX patterns

Does this pattern work in your product?

The AI Trust Audit checks how your product handles this pattern and the other moments where people decide whether to trust the AI. You get 10+ fixes ranked by impact and effort, and your key flow redesigned. 5 working days, $990, credited to a build if we continue. Related case: Atlas, a control room for a fleet of AI agents.

Get the audit · $990Ask a question first

Create bold.
Deliver better.

See our workGet in touch