# Make your AI agent check its work before it says 'done'

- Author: RomanMotion (https://wurk.fun/user/RomanMotion)
- Published: 2026-11-06
- Canonical (HTML): https://wurk.fun/blog/make-your-ai-agent-check-its-work-before-it-says-done
- Cover image: https://ik.imagekit.io/wurk/browser-uploads/f1c626b5c17e7f0a61dfbbe7a20d85ae7b33a20527243aeec2ee1d0a8b87562a/dbae5b34-92cf-4fc0-a34b-0cb3a9fc8c75/cover-selfcheck.jpg?wurkUpload=v1.3k6-S7Lr5NmJluZ0qthl1UNiTX0esqmOiSJYTYmIuzE

---

You gave an agent a job, and it says the work is done. Then you open the deliverable and find that a requirement is missing. A verification step catches checkable problems before the result reaches the client.

Define what “done” means before the agent starts, check the output against those criteria, and report success only when the required checks pass. If something fails, give the agent the specific failure to fix, limit the retries, and report what remains unfinished. Keep a record of the checks so the person receiving the work can see what was actually verified.

## Make “done” checkable before the work starts

An agent’s completion message is a claim about the work. It doesn’t show whether the output exists, whether it opens, or whether it meets the brief.

Turn the brief into acceptance criteria before generating anything. Keep the original wording when it’s precise, and clarify requirements that leave room for different interpretations.

For example, imagine a WURK-style job asks for three captions, each under 100 characters, in English, with a hashtag. A checkable version is:

- The output contains exactly three captions.
- Each caption has fewer than 100 characters, including its hashtag.
- Each caption is in English.
- Each caption contains a hashtag.

The count, length, and hashtag are suitable for code checks. English needs a separate review. If the brief also requires a particular brand voice or factual claim, add that as a criterion instead of assuming a short, correctly formatted caption meets it.

Decide what happens when a requirement is unclear. A missing brand name or an ambiguous instruction may need an answer from the requester, rather than a guess followed by a confident “done.”

## Run the checks code can handle

Use mechanical checks where the requirement can be expressed precisely. They give the agent a specific failure to fix and make the result easier to inspect.

For structured output, validate the required fields and types. JSON Schema, for example, supports checks for [array length](https://json-schema.org/understanding-json-schema/reference/array) and [string length](https://json-schema.org/understanding-json-schema/reference/string).

For a file, check that it exists **and** can be opened with the expected parser or application. For a code change, run the tests named in the acceptance criteria and record which tests ran. A passing test only establishes what that test covers; it doesn’t prove every part of the job works.

For a link, fetch the intended URL and inspect the response. An HTTP 200 status means the request succeeded, [according to MDN](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/200). It doesn’t prove the page contains the requested deliverable. Check the destination and relevant content too, especially if the request redirects to a sign-in page.

For caption length, agree on how characters are counted. Python’s `len()` [returns the length of a string](https://docs.python.org/3/tutorial/introduction.html). If the destination platform uses a different counting rule, validate against that rule instead.

## Use a reviewer for judgment, not as the only gate

Some requirements need judgment: whether a caption is in English, whether a design follows a brand brief, or whether a summary leaves out a key point.

Give a separate reviewer the original acceptance criteria and the output. Ask for a pass, fail, or unclear result for each criterion, with a short reason and the relevant text or detail. “Looks good” isn’t enough to tell you what was checked.

Keep the reviewer away from information it doesn’t need, including private customer data or credentials. If the task includes factual claims, give the reviewer the relevant source material and ask it to identify claims the material doesn’t support.

A review can still be mistaken. Use it alongside code checks, not in place of them. For subjective or consequential work, have a person inspect the result when the brief requires human approval.

When a reviewer returns “unclear,” don’t silently convert that to a pass. Record the uncertainty and either request clarification or report that the relevant criterion remains unverified. A useful completion message distinguishes “the format checks passed” from “the client’s entire brief was satisfied.”

## Retry the failure, then report honestly

When a check fails, send the agent the failure reason and the relevant criterion. “Caption exceeds the length limit” is more useful than “try again.” Include the failing output when it’s safe and necessary for the fix.

Set a retry limit before the loop starts. After each revision, rerun the relevant checks against the new output. If the agent changes the whole deliverable, rerun the full set: fixing one caption can accidentally remove a hashtag from another.

When the limit is reached, stop and report **not done**. Include what passed, what failed or couldn’t be checked, and where the requester can find any partial work. If the job requires a file or a submission, distinguish a locally generated draft from a delivered result.

Be careful with retries that have side effects. A failed confirmation doesn’t necessarily mean a message, payment, or submission failed. Check its status before repeating an action that could create a duplicate.

Log the task or output reference, each check and its result, the time checked, and any remaining failure. Avoid putting passwords, tokens, or unnecessary personal information in the log.

## A small verify-then-report example

This Python function checks the mechanical parts of the caption brief and requires a separate English review. The caller supplies `english_review=True` only after that review passes. The returned `checks` are the record to save with the job.

```python
import re

def verify_then_report(captions, english_review):
    valid_list = isinstance(captions, list)
    text_items = valid_list and all(
        isinstance(c, str) for c in captions
    )

    checks = {
        "count": valid_list and len(captions) == 3,
        "nonempty_and_under_100": text_items and all(
            c.strip() and len(c) < 100 for c in captions
        ),
        "hashtag": text_items and all(
            re.search(r"(?<!\w)#[A-Za-z0-9_]+", c)
            for c in captions
        ),
        "english_reviewed": english_review is True,
    }
    checks = {name: bool(result) for name, result in checks.items()}
    failed = [name for name, passed in checks.items() if not passed]

    return {
        "status": "not done" if failed else "done",
        "checks": checks,
        "failed": failed,
    }
```

This example checks only the criteria shown. Its hashtag pattern is deliberately narrow, and `english_review` records a reviewer’s decision rather than independently proving the language. Add the job’s other checks before using its status as the final completion report.

Copy this checklist into your task setup:

- **Deliverable:** What must exist at the end?
- **Criteria:** What must it contain or do?
- **Code checks:** What can be tested directly?
- **Review checks:** What needs judgment, and who reviews it?
- **Failure path:** What gets retried, and when does the loop stop?
- **Report:** What passed, what failed, and where is the output?

Related on WURK: [Test your LLM prompt with 20 real examples before you ship](https://wurk.fun/blog/test-your-llm-prompt-with-20-real-examples-before-you-ship)

If this guide saved you a headache, a small tip on this post helps keep these guides coming.
