Overview
Inspect is a Python framework for evaluating large language models, built by the UK AI Security Institute (AISI). You define an evaluation as a task that pairs a dataset with a solver (how the model is prompted or run) and a scorer (how its answers are judged), then run it against any supported model from the command line or Python.
It is aimed at researchers and engineers who need repeatable, structured evals rather than one-off prompt tests. The framework ships built-in components for prompt engineering, tool use, multi-turn dialog, and model-graded scoring, and can be extended by other Python packages to add new elicitation or scoring techniques.
As an eval framework, Inspect gives you a common harness for measuring model behavior across providers. It also includes a collection of over 200 pre-built evaluations you can run on any model, so you can start from existing benchmarks instead of writing everything from scratch.
What it does
- Tasks composed of a dataset, a solver, and a scorer, defined in plain Python with the @task decorator
- Built-in support for prompt engineering, tool usage, and multi-turn dialog
- Model-graded scoring (for example model_graded_fact) for judging open-ended answers
- Over 200 pre-built evaluations ready to run on any supported model
- Run evals from the CLI with inspect eval against models from different providers
- Extensible through other Python packages for new scoring and elicitation techniques
Getting started
Install the package, define a task that pairs a dataset, solver, and scorer, then run it from the command line against your chosen model.
Install Inspect
Install the package from PyPI into your Python environment (Python 3.10 or newer).
pip install inspect-aiDefine an evaluation task
Create a task that combines a dataset, a solver that generates model responses, and a scorer that grades them. Save this as security_guide.py.
from inspect_ai import Task, task
from inspect_ai.dataset import example_dataset
from inspect_ai.scorer import model_graded_fact
from inspect_ai.solver import generate
@task
def security_guide():
return Task(
dataset=example_dataset("security_guide"),
solver=generate(),
scorer=model_graded_fact()
)Run the eval
Run the task from the command line against a model, passing the provider-prefixed model name. Set the relevant provider API key in your environment first.
inspect eval security_guide.py --model openai/gpt-4oCommands and code are distilled from the project's own documentation — always check the official repo for the latest.
When to use it
- Measuring how a model performs on a benchmark by running one of the 200+ pre-built evaluations
- Building a custom eval for your own task with a dataset, solver, and model-graded scorer
- Comparing models across providers on the same task using a single harness
- Testing tool use and multi-turn agent behavior in a structured, repeatable way
How Inspect AI compares
Inspect AI alongside other open-source evaluation & red-teaming tools AI/TLDR tracks, ranked by GitHub stars.
| Tool | Stars | What it does |
|---|---|---|
| Strix | ★ 61.6k | Strix runs autonomous AI agents that act like hackers, dynamically running your code to find vulnerabilities and validate them with real proof-of-concepts. |
| promptfoo | ★ 25k | A developer-first CLI and library for testing and comparing prompts and models, with red-teaming probes for prompt injection, PII leaks, and other vulnerabilities. |
| OpenAI Evals | ★ 19.4k | A framework and open registry for building and running evaluations of LLMs and LLM-based systems, including prompt chains and tool-using agents. |
| DeepEval | ★ 18.2k | An open-source Python framework that tests LLM apps like unit tests, with 50+ metrics for RAG, agents, chatbots, and safety, and a Pytest integration for CI/CD. |
| Ragas | ★ 15.7k | An evaluation toolkit focused on retrieval-augmented generation that scores answer faithfulness, context precision/recall, and relevancy, often without needing ground-truth labels. |
| Arize Phoenix | ★ 11.4k | An open-source observability and evaluation tool for tracing LLM and agent behavior, running evals on traces, and troubleshooting issues in development and production. |
| garak | ★ 9.2k | An LLM vulnerability scanner from NVIDIA with 100+ attack probes that test models for prompt injection, data leakage, jailbreaks, and other security weaknesses. |
| Inspect AI | ★ 2.7k | Write and run LLM evaluations with built-in prompting, tools, and model-graded scoring |
