Agentic Workflows: Plan, Act, Verify

Prompt agents to work in a plan-act-verify loop with scope limits and a feedback signal so they self-correct instead of drifting.

TL;DR

  1. Agents work best in a loop: plan, act, then verify against a real signal like tests.
  2. Give the agent a way to check itself (tests, type-check, lint) so it self-corrects.
  3. Set scope and a stopping condition, then review the final diff before accepting.

The Loop

    Plan

    Have the agent lay out its approach before it acts.

    "Plan the steps and files first;
    wait for my go."
    Act

    It edits files and runs commands to execute the plan.

    Agent edits + runs build/tests.
    Verify

    It checks the result against a signal and iterates if needed.

    "Run tests; if red, fix and
    repeat until green."

Give It A Signal

    Tests

    A test suite is the clearest pass/fail feedback.

    "pnpm test must pass before you
    call it done."
    Types & Lint

    Type-check and lint catch invented APIs and style drift.

    "tsc --noEmit and lint must be
    clean."
    Run It

    For UI or scripts, actually running it is the real check.

    "Start the app; confirm the route
    renders without errors."

Bound The Agent

    Scope

    Name the files or directories it may change.

    "Only edit src/export/**.
    Do not touch config or CI."
    Stop Condition

    State exactly when the task is complete.

    "Stop when the 4 acceptance tests
    pass."
    Pause For Risk

    Have it check in before destructive or irreversible actions.

    "Ask before deleting files or
    running migrations."

Close It Out

    Review The Diff

    Read the full change for correctness and scope creep.

    git diff  # is this minimal and
    correct?
    Check The Gaps

    Look at what the tests did not cover before trusting green.

    Green != complete. What's untested?
    Summarize

    Ask the agent what it changed and why, as a record.

    "Summarize the changes and any
    assumptions you made."

Tips

  1. Tell the agent to run the test suite after each change and keep iterating until it is green.
  2. Bound the blast radius: name the directories it may touch and forbid the rest.

Warnings

  1. Without a verification signal, an agent declares success on code that does not work.
  2. An unscoped agent wanders across the repo and makes sweeping, hard-to-review changes.

In Practice

FAQ