Inspect Toolkit
Reusable building blocks for Inspect AI evaluations: metrics, scorers, solvers, tools, dataset sources, and sandbox helpers that are useful to anyone using Inspect, independent of any particular config system or agent framework.
Features include:
- Metrics for score distributions, threshold accuracy, and AI control safety and usefulness, usable with any scorer
- Scorers for running a repository's tests, searching sandbox files, checking sandbox state and asserting on database changes
- Solvers for repo setup, test running, snapshots, code and database diffs, and eval export/import
- Tools that defer construction until task state exists, and that let an agent score itself mid-trajectory
- Pluggable local and GitHub dataset sources with sparse-checkout caching
- A
FixtureManagerand a ready-to-use default Docker sandbox with composable features - SQLite diffing with a MongoDB-like selector language for asserting on database changes
It depends only on inspect-ai, numpy and pyyaml (plus gitpython, used by the git-diff
helpers vendored from Control Arena), and was extracted from the
refactor-arena evaluation setting.
Documentation
Full documentation, including a user guide and API reference, is available at fastfedora.github.io/inspect-toolkit.
Install
pip install inspect-toolkit
Requires Python 3.12+.
Quick Start
Everything is a plain Inspect component: pass the metrics to any @scorer, and drop the scorers,
solvers and tools into a Task.
from inspect_ai.scorer import mean, scorer, stderr
from inspect_toolkit.metrics import percentile, threshold_accuracy
from inspect_toolkit.scorers import test_runner_scorer
@scorer(metrics=[mean(), stderr(), percentile(target=95), threshold_accuracy(threshold=80)])
def my_scorer():
...
tests = test_runner_scorer("percent-pass") # run the repo's test suite in the sandbox
See the documentation for the full guide and API reference.
Development
uv sync
just test # run the test suite
just lint # ruff + pyright
just docs # preview the docs (Quarto)
License
MIT License. See LICENSE.
Release files for inspect-toolkit 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| inspect_toolkit-1.0.0.tar.gz | 359.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| inspect_toolkit-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 507.1 kB
Release files / inspect_toolkit-1.0.0.tar.gz
| Download URL | inspect_toolkit-1.0.0.tar.gz |
|---|---|
| Size | 359.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
27bbf0b93eb2a70d5d55c21b09ba3e35ca058fdfc739dab111b9e5f77f9e9c4c
|
|
BLAKE2b-256 checksum How to use checksums |
9ab6b16e461e98a4de1e456a8372066f72182abc673483d54a9b17411733e646
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / inspect_toolkit-1.0.0-py3-none-any.whl
| Download URL | inspect_toolkit-1.0.0-py3-none-any.whl |
|---|---|
| Size | 147.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5244349cb4081483d498354476282b18ad0b044b1050c4ae406d04933f4990cd
|
|
BLAKE2b-256 checksum How to use checksums |
8748f604ea359b1d7ff2e521e3de846309c5b593539ef6bf97cc3cb1361826c8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|