AI/TLDR

Inspect AI

Write and run LLM evaluations with built-in prompting, tools, and model-graded scoring

Evaluation & Red-TeamingOpen source
Language
Python
License
MIT
$pip install inspect-ai

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).

bashbash
pip install inspect-ai

Define 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.

pythonpython
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.

bashbash
inspect eval security_guide.py --model openai/gpt-4o

Commands 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.

ToolStarsWhat it does
Strix★ 61.6kStrix runs autonomous AI agents that act like hackers, dynamically running your code to find vulnerabilities and validate them with real proof-of-concepts.
promptfoo★ 25kA 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.4kA framework and open registry for building and running evaluations of LLMs and LLM-based systems, including prompt chains and tool-using agents.
DeepEval★ 18.2kAn 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.7kAn 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.4kAn 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.2kAn 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.7kWrite and run LLM evaluations with built-in prompting, tools, and model-graded scoring