TOOL WIKI · EVALUATION & TESTING

promptfoo

Runs configurable evaluations and adversarial tests for model applications.

Download example files Code + setup + checks in a ZIP
Jump to a section 10 sections

EXAMPLE USE CASE

Compare known and missing order responses in a test matrix

A developer needs repeatable cases and explicit grading before changing a prompt, model or agent implementation.

Input
A custom local provider and two YAML exact-match fixtures.
Expected output
Two assertion results from promptfoo eval.
  • Success check: Both exact-match fixtures pass with no model API call.
  • Try a failure: Make the provider return packed for every order; the missing-order test must fail.

Example scope: Actual evaluation framework without model calls; replace the provider adapter to evaluate your application.

Official reference · promptfoo

WHAT IT ISEvaluation and red-team toolkit
WHERE IT FITSEvaluation & testing
SEE HOW THE SYSTEM FITS TOGETHERSELECT A COMPONENT
executeobservationsresultsreviewimproveRepresentative datasetNormal + boundary casesCandidate systemPinned configurationpromptfooEvaluation and red-teamtoolkitFailure examplesConcrete observationsRelease gateQuality + cost limitsProduction feedbackNew regression cases
  1. Keep fixtures and expected outcomes separate from candidate inputs.

  2. Record code, prompts, model settings, and tool schemas for this run.

    observationsTo 03 · promptfoo
  3. Comparing prompts and agent configurations on a repeatable dataset. Keep test fixtures and judge configuration versioned with the candidate.

  4. Inspect the failing task and trace rather than relying only on an aggregate score.

  5. Block a release on critical permission failures and unacceptable task regression.

    Result or stopping point
  6. Convert confirmed production failures into reviewed, versioned fixtures.

promptfoo

Comparing prompts and agent configurations on a repeatable dataset. Keep test fixtures and judge configuration versioned with the candidate.

Follow the arrows, then select a component to inspect its responsibility. On mobile, downward arrows connect the next step; bent arrows identify branches and return paths. Select a destination to jump to that component.

When to consider it

  • Comparing prompts and agent configurations on a repeatable dataset.

A design decision to make

  • Keep test fixtures and judge configuration versioned with the candidate.

Prerequisites and setup

  • Node.js 22+. The custom local provider isolates evaluation mechanics before connecting a model.
Shell
npm init -y
npm install --save-dev promptfoo

Try a small integration

provider.cjs

JavaScript · provider.cjs
module.exports = class OrderFixture {
  id() { return 'order-fixture'; }
  async callApi(prompt) {
    const order = prompt.trim();
    return {output:order==='A104'?'packed':'not_found'};
  }
};

promptfooconfig.yaml

YAML · promptfooconfig.yaml
prompts: ['{{order}}']
providers: [file://provider.cjs]
tests:
  - vars: {order: A104}
    assert: [{type: equals, value: packed}]
  - vars: {order: A999}
    assert: [{type: equals, value: not_found}]

Run and check the result

Shell
npx promptfoo eval --config promptfooconfig.yaml --no-cache
  • Both exact-match fixtures pass with no model API call.
  • Change the provider to return packed for every order: the unknown-order case must fail.

Common failures

  • A passing score on one fixture is not evidence of general reliability; include missing-data, permission and adversarial cases.
  • A judge timeout or parser error must be reported separately from a low-quality answer.

Production decisions

  • Version the dataset, prompt, model, tool schema and scorer together; keep a held-out set separate from tuning examples.
  • Gate releases on critical failures as well as aggregate quality, latency and cost. Review false positives and grader disagreement.

Keep exploring

AI agent evaluation: frameworks, tools and an exampleAn evaluation gate for agent releases

Explore the same layer

garakRagasDeepEvalInspect AI

Compare candidates on your own workload. This entry describes a product’s role; it is not a claim that products in the category are interchangeable.