New Tool Radar

AI Agents & Automation

How to Add an Agent Dry-Run Mode Before Real Writes

Add a dry-run mode to an agent so it shows the planned writes before any real change happens.

Schematic with three steps: Replace write tools with plan-recording versions in; Run the test task and read the; Run live only when the plan matches.

A dry run is a rehearsal: the agent does the read-only work, plans the writes, and shows them to you, but changes nothing. It is the cheapest way to catch a wrong plan, because a bad write caught in dry-run mode costs nothing and a bad write caught after it runs costs a cleanup. Build it as a mode, not a hope: when dry-run is on, every write tool is replaced by a version that records the planned change and returns a success message, while the rest of the run works exactly as it would live. Review the plan, then run it for real only when the plan is right.

What you need

  • An agent with at least one write tool, such as create, update or send
  • A way to switch the agent into dry-run mode, such as a flag or a separate run
  • One test task with a known correct set of writes

Step 1: Replace write tools with plan-recording versions in dry-run mode

In dry-run mode, swap each write tool for one that writes the planned change to a list and reports success, without touching the real system. Read tools stay exactly the same.

Step 2: Run the test task and read the plan

Run the test task in dry-run mode and read the planned writes as a checklist: every change, its target, and its values. Compare it with the known correct set before running anything live.

Step 3: Run live only when the plan matches

When the dry-run plan matches the expected writes, run the same task live. If the plan is wrong, fix the instructions or the tools and dry-run again; never run live to find out.

Worked example: synthetic dry-run check

The table below is a synthetic example. It shows the expected result of dry-run mode; no write was made.

Check Expected Result
Dry run changes nothing 0 writes Pass
Plan lists all 3 writes Yes Pass
Plan matches the expected set Yes Pass
Live run follows the same plan Yes Pass

Expected result (UNTESTED). the dry run lists all three planned writes, changes nothing, and the live run follows the same plan. This check was not run live; the table shows the expected result for the synthetic example.

Limits

  • A dry run proves the plan, not the writes: a write can still fail live for reasons the dry run cannot see.
  • A write tool with no dry-run replacement must be blocked in dry-run mode, or the mode is a lie.
  • The plan can go stale between the dry run and the live run if the underlying data changes.
  • Dry-run mode adds a second code path, so test it as carefully as the live path.

Sources

See all