Skip to content
    All guides

    Test the work and its limits

    How to evaluate an AI agent before it starts doing client work

    AI agent evaluation checks whether a system completes the right job, uses acceptable evidence and stays within its authority. Test the steps and actions as well as the final answer. A good evaluation includes requests the agent should decline, tools that fail and information that disagrees.

    The starting point

    Use expected results for complete jobs and exceptions, then inspect the evidence and actions behind each result.

    Define acceptable behaviour before testing

    Choose one job and state its useful result. Include permitted sources, actions requiring approval, actions the system must never take and the conditions that should stop it. Give a reviewer enough information to judge the result.

    Separate different failure types. A correctly written answer from the wrong client’s record is an access failure. A correct citation supporting the wrong claim is an evidence failure. A useful draft that was sent before approval is an action failure.

    What to inspect
    AreaQuestion
    TaskDid the system complete the agreed job?
    EvidenceDo the selected records actually support the result?
    AuthorityWere every tool and action permitted?
    UncertaintyDid it stop or escalate when required?
    OperationsWhat happened after an outage, retry or repeated event?
    PeopleCould the reviewer make the decision with the information supplied?

    Build tests from actual work and known exceptions

    Begin with approved or anonymised examples of the current process. Include ordinary requests, incomplete inputs, changed requirements and unusual but legitimate cases. Keep some examples outside the development set so you can test behaviour on work the system was not tuned against.

    For each example, record the expected result and the evidence needed to justify it. A precise expectation might be “return unknown and request the account owner’s decision because two current budget records disagree”. Avoid “give a good answer”.

    Use synthetic examples when access or a known exception makes them useful, and label them. They help exercise a rule but do not demonstrate how often the condition occurs in live client work.

    Try a small set of evidence checks yourself

    The AI knowledge-base tutorial includes downloadable code with 12 tests. They cover current sources, client boundaries, missing and expired records, future dates, contradictions, incomplete provenance, false citations, unsupported answers and model-response failures.

    node --test demo.test.mjs
    node demo.mjs client-a budget-approved account-a 2026-10-01

    The second command returns unknown because the two invented budget sources disagree. The sample holds the decision for a person. Run the tests in the unzipped knowledge-base example folder.

    Review the route as well as the answer

    Said describes provenance as central to our current build. Each trace needs a reviewable baseline or deterministic element. If the system cannot expose the required evidence for review, it must acknowledge that it does not know.

    Inspect tool inputs and results, selected record IDs, their dates and the decisions that followed. Check whether a valid source is relevant to the actual claim. A citation that exists is only the beginning of that check.

    If the agent can act, use a test environment and a controlled adapter before giving it live authority. Test duplicate events and partial failures. Include a budget for model calls, time and retries, so an incomplete job cannot keep trying indefinitely.

    Make a release decision for the tested job

    Record failures by their consequences, and decide which block rollout. A private-data leak or unapproved external action should not disappear inside a high average score. Report the test coverage and unresolved gaps alongside any overall result.

    Retest after changes to the model, prompt, tools, retrieval, source schema or business rules. Use monitored early jobs and a named owner for corrections. Reviewed human decisions can update the business records; that is different from automatically training model weights.

    Worked example

    A conflicting budget test

    Invented teaching example. No client outcome is claimed.

    EXPECTED

    Client A has two authorised current budget records with opposite values.

    Return unknown and request a human decision.

    OBSERVATION IN THE SAMPLE

    The retrieval rule detects different values and returns unknown.

    No optional model call is needed to resolve the conflict.

    LIMIT

    This demonstrates one deterministic rule on synthetic facts. It is not a test of a live client agent.

    Further reading

    Written by Said Lopez, founder of LeverageAI and author of Lean AI. Our guides draw on the method in the book and our work with clients.

    The next conversation

    What could your
    business do next?

    Bring your bigger goal to the AI Strategy Workshop. We help your team choose where to start, compare the likely returns and see how the first project supports what comes next.

    Discuss your AI workshop

    Start with a free 15-minute fit call. We discuss pricing there.