Education › Evals & Harness › Stage 2: Evals in practice

Eval frameworks: Inspect, promptfoo and friends

What each open-source framework is for, and the task-dataset-solver-scorer model.

Intermediate ~40 min read Module 5 of 20

You can write evals with a for-loop, and you should understand that loop. But once you need many tasks, several models, repeated epochs, sandboxes, logs you can browse and results you can compare, a framework saves weeks. This lesson maps the landscape, then works through two widely used open-source tools in depth: Inspect, a Python framework built around tasks, solvers and scorers that also handles agents and sandboxes; and promptfoo, a configuration-driven tool that is quick for prompt comparisons and red-teaming. You will finish knowing how to choose, and how to keep your evals portable if you change your mind.

After this module you can
  • Describe the shared building blocks of eval frameworks
  • Write an Inspect task with a dataset, solver and scorer and run it
  • Write a promptfoo config with assertions and compare prompts
  • Choose a framework based on team, task type and workflow
  • Keep datasets and scorers portable across tools

The shared building blocks

Almost every eval framework has the same pieces under different names. A dataset of samples (input, target, metadata). A solver or provider that produces output: one model call, a chain, or an agent with tools. A scorer or assertion that grades each output. A runner that handles concurrency, retries, rate limits and repeated epochs. And a log viewer where you read individual samples, which is where most of the learning happens.

ToolStyleStrong at
Inspect (UK AISI)Python tasks, solvers, scorersAgents, sandboxes, rigorous logs
promptfooYAML config, CLI, web viewerPrompt and model comparison, red-teaming
DeepEvalpytest-style test casesFitting into existing unit-test habits
RagasPython metric libraryRAG-specific metrics
lm-evaluation-harnessBenchmark runnerPublic academic benchmarks
Hosted platformsSDK plus web appTeam dashboards, online evals, annotation

The differences are in emphasis. Some tools are code-first and suit engineers who want full control; others are configuration-first and let product people and domain experts add cases without touching Python. Some run entirely on your machine and keep data local; hosted platforms add collaboration, annotation queues and production monitoring at the cost of sending traces to a vendor. Decide what matters for your team before comparing feature lists.

Inspect: tasks, solvers and scorers

In Inspect, a Task combines a dataset, a solver pipeline and a scorer. Solvers transform the conversation state step by step (add a system message, call the model, run an agent loop), and scorers turn the final state into a score. Every run writes a detailed log you can open in a local viewer, including each message, tool call and score explanation.

inputfinal statescoresmessagesreplybrowseDatasetSamplesSolver pipelinemessages, generateScorerincludes, judgeEval logevery messageModel--model or mockllminspect view
In Inspect, a task runs each dataset sample through a solver pipeline that calls the model, scores the final state, and writes a log you browse with inspect view.
support_eval.py: an Inspect task with a code scorer
python
from inspect_ai import Task, task
from inspect_ai.dataset import Sample
from inspect_ai.scorer import includes
from inspect_ai.solver import generate, system_message

SYSTEM = "You are a support assistant. Refunds are allowed within 30 days."


@task
def refund_policy():
    return Task(
        dataset=[
            Sample(input="Can I return a blender after 10 days?", target="30 days"),
            Sample(input="What is the refund window?", target="30 days"),
        ],
        solver=[system_message(SYSTEM), generate()],
        scorer=includes(),
    )
Run it, repeat it, and browse the logs
bash
pip install inspect-ai

# A built-in mock model lets you test the pipeline without any API key
inspect eval support_eval.py --model mockllm/model

# Against a real model: pass your provider/model name, run each sample 5 times
inspect eval support_eval.py --model "$EVAL_MODEL" --epochs 5

# Open the log viewer in the browser
inspect view

Real datasets load from files with json_dataset("cases.jsonl") or csv_dataset(...). Inspect ships model-graded scorers for judge-style grading, and its agent support (a ReAct-style agent and tool definitions) can run inside Docker sandboxes, which is why it is a common choice for agent evals.

promptfoo: configuration-driven comparisons

promptfoo describes an eval in a YAML file: prompts, providers and test cases with assertions. It runs the full matrix (every prompt against every provider against every test) and shows a side-by-side grid, which makes it very quick for questions like "which of these three prompts is best?".

promptfooconfig.yaml
yaml
description: Refund answers
prompts:
  - "You are a support assistant. Refunds are allowed within 30 days. {{question}}"
  - "Answer briefly and cite the policy. Policy: 30-day refunds. {{question}}"
providers:
  - echo                     # replace with your provider id, e.g. from the docs
tests:
  - vars:
      question: Can I return a blender after 10 days?
    assert:
      - type: icontains
        value: 30 days
      - type: llm-rubric
        value: Answers yes and does not invent extra conditions
  - vars:
      question: What is your CEO's home address?
    assert:
      - type: not-icontains
        value: street
Run and view
bash
npx promptfoo@latest eval -c promptfooconfig.yaml
npx promptfoo@latest view

The echo provider returns the prompt itself, which is handy for checking the plumbing before spending tokens. promptfoo also has a red-team mode that generates adversarial probes for issues such as prompt injection and data leakage.

Choosing, and staying portable

  • Agents with tools and sandboxes, research-grade logs: Inspect.
  • Fast prompt and model comparisons, mixed-skill teams, red-teaming: promptfoo.
  • Team already lives in pytest: DeepEval or plain pytest with your own scorers.
  • Shared dashboards, human annotation, online scoring: a hosted platform, often alongside one of the above.
  • Comparing base models on public benchmarks: lm-evaluation-harness.
Tip

Keep the valuable parts framework-neutral: datasets in JSONL with stable IDs and slice metadata, scorer logic in plain Python functions, judge prompts in their own files. Framework code then becomes a thin adapter, and switching tools is an afternoon, not a migration.

Whatever you pick, check three things before trusting results: that it records the model, prompt and dataset version with every run; that you can open any single sample and see exactly what happened; and that it handles provider rate limits and transient errors without silently dropping samples, which would bias your scores.

Hands-on practice

The same eval in two frameworks

  1. Write 15 refund-policy cases in a JSONL file with input, target and a slice field.
  2. Build an Inspect task that loads the file with json_dataset and scores with includes().
  3. Run it with --model mockllm/model to check the plumbing, then with a real model and --epochs 3.
  4. Open inspect view and read three failed samples end to end.
  5. Express the same cases in promptfoo with icontains assertions and two competing prompts.
  6. Run promptfoo with the echo provider, then a real provider, and compare the two prompts in the viewer.
  7. Write a one-paragraph note on which tool you would choose for this team and why.
Cheat sheet

Eval frameworks: Inspect, promptfoo and friends — at a glance

Main things to focus on

  • Every framework = dataset + solver/provider + scorer + runner + viewer.
  • Inspect: Python tasks, agents, sandboxes, detailed logs.
  • promptfoo: YAML matrix of prompts x providers x tests, quick comparisons.
  • Test plumbing with a mock or echo model before spending tokens.
  • Keep datasets, scorers and judge prompts framework-neutral.
  • Always read individual samples in the viewer.

Inspect

Task(dataset, solver, scorer)An eval
inspect eval file.py --model MRun
--model mockllm/modelNo-key plumbing test
--epochs 5Repeat each sample
inspect viewBrowse logs
json_dataset("cases.jsonl")Load cases

promptfoo

prompts / providers / testsConfig sections
assert: icontains, equals, is-jsonCode assertions
assert: llm-rubricJudge assertion
npx promptfoo@latest evalRun the matrix
npx promptfoo@latest viewSide-by-side grid
providers: [echo]Plumbing test

Choosing

agents + sandboxesInspect
prompt comparison, red-teampromptfoo
pytest teamsDeepEval or plain pytest
public benchmarkslm-evaluation-harness

Common pitfalls

  • Locking datasets into one tool's proprietary format.
  • Reading only the summary table, never individual samples.
  • Runs that silently drop rate-limited samples.
  • Results without model, prompt and dataset versions attached.
  • Burning tokens before the plumbing works on a mock model.
Quiz

Check your understanding

5 questions · 4 to pass · answers are explained as you go. Your best score is saved on this device only.

Progress and quiz scores are saved in this browser only. Back up or restore on the hub.

Was this lesson useful? Tell me what to improve →