Tools

How to Verify AI Agent Work: Gates for Code and Everything Else

Last updated: April 2026

The defining problem with autonomous agents is not that they cannot do the work. It is that they report having done it either way. Verification is the only thing that closes that gap, and it has to work for more than code.

Quick Answer

Verify agent work with a gate: a real shell command that must pass before the work counts as done. For code that is the project's test or lint command. For work with no test suite, prove the output exists, has substance, and contains no placeholder text. A gate that cannot fail is worse than no gate, because it looks like proof. When a gate fails, feed the actual command output back to the agent as a bounded repair attempt rather than retrying blind.

  • A gate is a command that must pass, not a checklist
  • Non-code work needs gates too: existence, size, freshness, no placeholders
  • A gate that always passes is worse than none
  • Failures should become feedback, not blind retries

Why can't I trust an AI agent's own report?

Hosted autonomous agent platforms have a recurring complaint against them: agents mark tasks complete when they are not. One published review of a hosted platform recorded a user's own tally of 47 tasks, of which 41 were reported completed while 24 had gone out with the wrong name, giving a real success rate around 21%.

The agent is not lying. It genuinely believes it finished. The problem is structural: nothing independent checked.

The instinct in the developer community is already correct. An r/ClaudeAI thread with 390+ upvotes and 180+ comments argues that anyone running Claude Code on a larger project should move to a CI pipeline immediately. Verification is exactly that instinct, applied per task rather than per merge.

What gates should I use for code?

Use the project's real commands. They are stronger evidence than anything generic and they are already the standard the rest of your work is held to.

  • npm test, or go test ./..., or pytest
  • The linter, because a passing test suite with broken style still needs a human
  • A type check, which catches a category of damage tests often miss
  • The build, for anything that compiles

How do I verify work that has no test suite?

This is the part almost nobody writes about, and it is where most non-engineering agent work fails silently. A content or research role still needs proof. The shape changes: instead of a test suite, prove the output exists, has substance, and is not half-finished.

  • Existence and non-emptiness: test -s content/post.md
  • Substance, so a two-line stub does not pass: test $(wc -w < content/post.md) -ge 400
  • Freshness, so a role cannot pass by leaving last week's file alone: grep -q "$(date +%Y-%m-%d)" research/log.md
  • No placeholders left behind: ! grep -rniE "lorem ipsum|TBD|TODO" content/
  • Landed in the right place: test -n "$(ls -A outbox)"

What makes a verification gate useless?

This is the most common mistake and the most dangerous, because the result looks verified.

Commands like true, echo done, git status and git diff --stat all exit zero whether or not any work happened. A role with one of those has a gate in name only, and you will trust its output more than you would have trusted no gate at all.

The test is simple: can you describe a realistic failure that would make this command exit non-zero? If not, it is not a gate.

Should a failed gate trigger a retry or a repair?

A blind retry asks the agent to do the same thing again with the same information. It usually produces the same result.

A repair attempt hands back the failing command, why it failed, and the actual output. That is a materially different prompt and it is why repair works where retry does not. Keep the tail of long output rather than the beginning, because compiler and test output puts the real failure last.

Bound the attempts. Without a ceiling, a permanently broken gate will loop until morning, spending money to fail repeatedly.

Should I tell the agent what its gates are?

Disclosing the gate commands in the agent's instructions changes its behaviour for the better. It runs them itself and fixes problems before finishing, which is cheaper than a repair round.

We observed this directly. Given a role whose gate was go test ./... in a repository with a deliberately broken pre-existing assertion the prompt never mentioned, the agent ran the tests, found the failure, and corrected the wrong assertion before the gate ever executed. It fixed the assertion rather than deleting the test, which is the behaviour that matters.

Pair the disclosure with an explicit instruction not to weaken, skip or disable a check to make it pass. Gates are a safety net, not a guarantee, which is why verified work should still land somewhere reviewable such as a branch.

Method and limitations

The 21% success rate is one user's self-reported tally published in a third-party review of a hosted platform, not a controlled measurement.

Reddit engagement counts are from a reddit-mcp query against r/ClaudeAI over the past year, rounded, and are a snapshot. Quotes are attributed to the subreddit only.

The self-correction example is from our own instrumented test run, a single observation rather than a benchmark.

FAQ

How do I verify AI agent work that has no tests?

Prove the output instead of the behaviour. Check the file exists and is non-empty, that it has substance such as a minimum word count, that it contains today's date if it was supposed to be updated today, and that no placeholder text like TODO or lorem ipsum survived. These are ordinary shell commands and they catch the common failure of a role that produced almost nothing.

Why do autonomous agents mark work complete when it is not?

Because nothing independent checks. The agent reports its own belief about the outcome, and without a verification step that belief becomes the record. One published review of a hosted agent platform captured a user's tally of 47 tasks where 41 were reported complete but only about 21% were actually correct.

What makes a bad verification gate?

Any command that cannot fail. true, echo done, git status and git diff --stat all exit zero regardless of whether work happened. These are worse than having no gate, because they create false confidence. Ask whether you can describe a realistic failure that would make the command exit non-zero.

Should I retry a failed task or repair it?

Repair it. A retry sends the same request with the same information and usually gets the same result. A repair hands the agent the failing command, the reason and the real output, which is a genuinely different prompt. Cap the attempts so a permanently broken gate cannot loop indefinitely.

Was this page helpful?

Related help pages

Ready to Build Your Next Big Idea?

Join thousands of founders using BigIdeasDB to discover validated opportunities and build products people actually want.

Get Started Free