Inspect AI
MIT-licensed Python framework from the UK AI Security Institute for evaluating LLMs and AI agents, with tool use, sandboxed agent runs, a log viewer and 200+ ready-made evals in Inspect Evals.
What it is
Inspect AI is an open-source Python framework for evaluating large language models and AI agents. The UK AI Security Institute builds it together with Meridian Labs. You describe an evaluation as a task made of a dataset, one or more solvers (plain generation, multi-turn prompting, tool use or full agents) and a scorer. Inspect then runs that task against any supported model and records every message, tool call and score in a structured log.
It is aimed at AI safety researchers, red teams, ML engineers and security teams who need repeatable benchmarks rather than ad-hoc prompting. Typical uses include measuring jailbreak resistance, agent tool-use safety and offensive-cyber capability. The companion Inspect Evals collection gives you more than 200 ready-made benchmarks.
Key features
- Task, solver and scorer building blocks, including model-graded scoring, multiple-choice and pattern matching
- One eval runs against more than 20 model providers plus local inference (Hugging Face, vLLM, SGLang) by changing
--model - Agents: a built-in ReAct agent, multi-agent setups, custom agents, human baselining, and an agent bridge for external agents
- Tools: bash, python, text editor, web search, computer use, MCP servers and your own
@toolfunctions, with an approval layer - Sandboxes for untrusted actions: Docker, Kubernetes, Modal, Proxmox, Vagrant and more through an extension API
- Eval sets with retry and resume, parallelism, caching, and time, message, token and cost limits
- Log viewer (
inspect view), a VS Code extension, and Pandas dataframes (evals_df,samples_df) for analysis
Install
All platforms (Python 3.11 or newer):
pip install inspect-ai
Add the SDK for the provider you want to test and set its key, for example:
pip install openai
export OPENAI_API_KEY=your-key
Other providers follow the same pattern (pip install anthropic, pip install google-genai, or pip install torch transformers for local Hugging Face models). The Inspect VS Code extension is optional but recommended. To get the benchmark collection:
pip install inspect-evals
Getting started
Save a minimal task as simpleqa.py. This one is adapted from the official tutorial:
from inspect_ai import Task, task
from inspect_ai.dataset import FieldSpec, hf_dataset
from inspect_ai.scorer import model_graded_qa
from inspect_ai.solver import generate
@task
def simpleqa():
return Task(
dataset=hf_dataset("codelion/SimpleQA-Verified", split="train",
sample_fields=FieldSpec(input="problem", target="answer")),
solver=generate(),
scorer=model_graded_qa(),
)
Run a small sample first to keep cost down, then open the viewer:
inspect eval simpleqa.py --model openai/gpt-5-nano --limit 20
inspect view
The terminal prints a progress summary and the final accuracy. inspect view opens a browser UI over ./logs, where you can step through each sample's prompt, answer and grader reasoning. A ready-made benchmark runs the same way, for example inspect eval inspect_evals/arc_easy --model openai/gpt-5-nano.
Good to know
- Licence: MIT and free. You pay only for the model API calls your evals make, and large benchmarks can get expensive, so use
--limitwhile you experiment. - Still pre-1.0 (0.3.x, released almost weekly). Recent releases included breaking changes, such as Docker
read_file()now using the container's default user. Pin a version for reproducible results. - Agentic and cyber evals should always run in a sandbox. Docker must be installed and the user must be allowed to run containers.
- The full Inspect Evals install takes about 10 GB, and its README recommends 35 GB of free disk space for datasets and caches.
- Offensive-capability evals are for authorised research. Keep their outputs and sandboxes isolated from production networks.
Alternatives
- OpenAI Evals: a simpler registry-style framework if you mainly test OpenAI models.
- EleutherAI lm-evaluation-harness: pick it for classic academic benchmarks on open-weight models.
- promptfoo: better for CI-style prompt regression tests and red-teaming of LLM apps, configured in YAML.
