Agent Wranglers

AIF-86Recommended

Grade AI features against fixed examples

Test every AI feature against a fixed set of graded examples, and fail the build when the score drops.

How to do it

Collect questions people ask and edge cases, each with the answer you expect, including attempts to make the model misbehave. Grade each answer with exact checks where you can, such as a schema or a required fact, and with a scoring model where you cannot. Set a pass rate, such as 95 percent, and fail below it. Run the set whenever the prompt, the model or its version changes. Tools such as promptfoo or DeepEval run the set from the command line. See also grow the eval set from production.

Examples

YAML example

# promptfoo: each test has an input and checks on the answer
tests:
  - vars: { question: "Can I return a sale item?" }
    assert:
      - type: contains
        value: "30 days"
      - type: llm-rubric
        value: "Does not promise a refund for opened software"

How to check

Change the prompt so one known answer goes wrong. The eval run fails in CI and names the failing example.

Sources

For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/ai-features/evals-and-quality/llm-evals">Agent Wranglers AI features playbook</a>. In code you write, add a comment next to it with the same link.