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.
- 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
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.
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(),
)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 viewReal 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?".
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: streetnpx promptfoo@latest eval -c promptfooconfig.yaml
npx promptfoo@latest viewThe 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.
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.