Agent Workflow in a Minute · intermediate

Workflow in a Minute: Verification loops

A verification loop requires the agent to prove done with an external check—then fix—until the check passes or you stop it.

Last verified: 2026-09-06

In one sentence

A verification loop is edit → run an independent check → read the failure → edit again until the check passes.

Why it matters

Agents can claim success from partial evidence. Loops tied to real commands catch that early and produce smaller, more trustworthy diffs.

How it works

  1. name the check in the task (npm test, cargo test, a smoke script);
  2. require the agent to run it;
  3. require the agent to paste or summarize failing output when red;
  4. forbid “done” while the check is red;
  5. stop after N cycles if stuck and escalate to a human.

Deterministic gates beat vibes. Prefer the same checks CI will run.

Example

Implement the fix.
Run npm test after each attempt.
If red, fix based on the failure output.
Do not mark done until npm test is green.
If still red after 3 attempts, stop and explain.

Agentic coding use

This is the heartbeat of reliable agentic engineering. Planning chooses the path; verification decides whether the path worked.

Watch out

If the agent can edit the test to make green, you do not have a verification loop—you have a collusion loop. Protect invariants or review test diffs carefully.