cat-experiments
Agnostic experiment runner for LLM applications that you can take to any server stack.
Most experiment frameworks are glued to a specific hosted platform, forcing you to swap libraries when you switch servers. cat-experiments keeps the core experiment loop (data model, runner, evaluators) identical whether you are running locally or wiring into Phoenix, CAT Cafe, or another backend. That gives teams a common starting point for new projects while still letting them plug into whichever server platform fits the deployment.
Features
- CLI-First Design: Define experiments as Python files and run them with
cat-experiments run - Flexible Data Models: Support any dataset structure with dictionary-based input/output
- Deterministic Preview Runs: Limit execution to an exact number of examples with
--dry-run - Explicit Repetitions: Run each example multiple times with
--repetitions - Comprehensive Evaluators: Built-in evaluators for tool call correctness and more
- Modern Python: Targets Python 3.10+ with modern typing features
- Async Support: Full async/await support for evaluation pipelines
- Tool Call Evaluation: Advanced matching algorithms for tool call correctness
Install
# from PyPI
pip install cat-experiments # core package
pip install "cat-experiments[cat-cafe]" # add extras for CAT Cafe
pip install "cat-experiments[phoenix]" # add extras for Phoenix
CLI via Homebrew
The standalone Go CLI is also distributed via a Homebrew tap:
brew tap thisisartium/tap
brew install cat-experiments
Released for macOS (arm64, x86_64) and Linux (arm64, x86_64). Released independently of the Python and Node SDKs — see cli-v* tags on GitHub Releases.
.NET SDK via NuGet
dotnet add package CatExperiments
See dotnet/CatExperiments/README.md for the canonical project shape.
Quick Start
Create an experiment file:
# my_experiment.py
from cat.experiments.protocol import TaskInput, TaskOutput, EvalInput, EvalOutput
from cat.experiments.sdk import task, evaluator
@task
async def my_task(input: TaskInput) -> TaskOutput:
"""The system under test."""
question = input.input.get("question", "")
# In a real experiment, you'd call your LLM here
return TaskOutput(output={"answer": question.upper()})
@evaluator
def exact_match(input: EvalInput) -> EvalOutput:
"""Check if actual matches expected."""
expected = input.expected_output.get("answer", "") if input.expected_output else ""
actual = input.actual_output.get("answer", "") if input.actual_output else ""
score = 1.0 if expected == actual else 0.0
return EvalOutput(
score=score,
label="match" if score == 1.0 else "mismatch",
)
Run it:
# With a local JSON/JSONL dataset
cat-experiments run my_experiment.py --dataset data.jsonl
# With dry-run mode (run only N examples, no persistence)
cat-experiments run my_experiment.py --dataset data.jsonl --dry-run 5
# With multiple repetitions
cat-experiments run my_experiment.py --dataset data.jsonl --repetitions 3
# With parallel workers
cat-experiments run my_experiment.py --dataset data.jsonl --max-workers 10
# Stream results to Phoenix
cat-experiments run my_experiment.py --dataset my-dataset --backend phoenix
# Stream results to CAT Cafe
cat-experiments run my_experiment.py --dataset my-dataset --backend cat-cafe
Dataset Format
Datasets are JSON or JSONL files with examples containing input, output, and optional metadata:
{"input": {"question": "How do I reset my password?"}, "output": {"answer": "Visit settings."}, "metadata": {"category": "support"}}
{"input": {"question": "Can I upgrade mid-cycle?"}, "output": {"answer": "Yes, prorated."}, "metadata": {"category": "billing"}}
Writing Experiments
Task Function
The @task decorator marks your system under test. It receives a TaskInput with the example data and returns the output:
from cat.experiments.protocol import TaskInput, TaskOutput
from cat.experiments.sdk import task
@task
async def my_llm_task(input: TaskInput) -> TaskOutput:
"""Call your LLM or agent here."""
question = input.input.get("question", "")
params = input.params # Access experiment params (e.g., model name)
# Your LLM call here
response = await call_my_llm(question, model=params.get("model"))
return TaskOutput(
output={"answer": response},
metadata={"tokens": 150}, # Optional metadata
)
# Module-level config (optional)
params = {"model": "gpt-4o-mini"}
name = "My Experiment"
Evaluator Functions
The @evaluator decorator marks evaluation functions. They receive an EvalInput with both expected and actual outputs:
from cat.experiments.protocol import EvalInput, EvalOutput
from cat.experiments.sdk import evaluator
@evaluator
def accuracy(input: EvalInput) -> EvalOutput:
"""Check if the answer is correct."""
expected = input.expected_output.get("answer", "") if input.expected_output else ""
actual = input.actual_output.get("answer", "") if input.actual_output else ""
score = 1.0 if expected.lower() == actual.lower() else 0.0
return EvalOutput(score=score, label="correct" if score else "incorrect")
@evaluator
async def llm_judge(input: EvalInput) -> EvalOutput:
"""Use an LLM to judge quality (async evaluators supported)."""
# Your LLM judge call here
judgment = await call_judge_llm(input.actual_output)
return EvalOutput(score=judgment.score, metadata={"reasoning": judgment.reason})
Storage Backends
Select a backend with --backend (or backend: in a config file). Flags apply
to the selected backend, and are equivalent to setting backends.<name>.<key>
in a config file.
Local Storage (default)
Results are written to a directory:
cat-experiments run my_experiment.py --dataset data.jsonl --output-dir ./results
Each experiment gets its own directory under --output-dir, and that directory
name is the ID --resume takes.
Phoenix Integration
Stream results to Phoenix. --dataset is a dataset name or ID on the server:
# --url defaults to $PHOENIX_BASE_URL, then http://localhost:6006
cat-experiments run my_experiment.py --dataset my-dataset \
--backend phoenix \
--url http://localhost:6006
CAT Cafe Integration
Stream results to CAT Cafe (v0.7.0 or later):
# --url defaults to $CAT_BASE_URL, then http://localhost:8000
cat-experiments run my_experiment.py --dataset my-dataset \
--backend cat-cafe \
--url http://localhost:8000
Backend Plugins
A backend can also run as a separate executable, so one can be written and
shipped independently of the CLI. Name it under command in a config file; the
CLI launches it and hands it every other key in its section:
backend: my-backend
backends:
my-backend:
command: ["/usr/local/bin/my-backend-plugin"]
checksum: "sha256:<digest>" # optional; the CLI refuses a binary that does not match
url: https://example.invalid # passed to the plugin
See Writing a Backend Plugin to build one, and Backend Protocol for the design.
Resuming
--resume <experiment-id> continues an interrupted experiment, running only
what did not finish. For the local backend the ID is the experiment's directory
name; for Phoenix and CAT Cafe it is the ID the server assigned, printed in the
run summary as Backend experiment ID. An ID the backend does not know is an error rather than a fresh
start.
CLI Options
cat-experiments run <experiment> [OPTIONS]
Dataset Options:
-d, --dataset REF Local file (JSON/JSONL), or a dataset name or ID on a remote backend
--dataset-version V Dataset version (Phoenix)
Storage Options:
-b, --backend NAME local, phoenix, cat-cafe, or a configured plugin (default: local)
-o, --output-dir DIR Output directory (local backend)
--url URL Backend URL (phoenix, cat-cafe)
-c, --config PATH Config file (YAML)
Experiment Options:
--param KEY=VALUE Override params (can be repeated)
--max-workers N Parallel workers (default: 5)
--repetitions N Repetitions per example (default: 1)
--dry-run N Run N examples without persisting
--resume EXPERIMENT_ID Resume a previous experiment
Output Options:
--output FORMAT Output format: text, json (default: text)
Run cat-experiments run --help for the full list, including tracing options.
Built-in Tool Call Evaluators
The package includes tool call correctness evaluators for agent evaluation:
from cat.experiments.sdk import match_tool_calls, ToolCallMatch, ToolCallMatchingResult
# Match expected vs actual tool calls
result: ToolCallMatchingResult = match_tool_calls(
expected_calls=[{"name": "search", "arguments": {"query": "weather"}}],
actual_calls=[{"name": "search", "arguments": {"query": "weather today"}}],
)
print(result.precision, result.recall, result.f1_score)
Architecture
┌─────────────────────────────────────────────────────────┐
│ CLI / Orchestrator │
│ - Dataset loading │
│ - Parallel execution (windowed dispatch) │
│ - Storage backends (Local, Phoenix, Cat Cafe) │
│ - Progress reporting │
└───────────────────────┬─────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────┐
│ Executor │
│ - Loads experiment file │
│ - Runs @task and @evaluator functions │
│ - Returns results │
└─────────────────────────────────────────────────────────┘
The package uses an executor protocol that separates orchestration from execution, enabling future support for:
- Multi-language experiments (TypeScript, etc.)
- Distributed execution
- Custom execution backends
Metadata
Release files for cat-experiments 0.0.13
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cat_experiments-0.0.13.tar.gz | 478.9 kB | Without provenance | Details for cat_experiments-0.0.13.tar.gz |
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| cat_experiments-0.0.13-py3-none-win_amd64.whl | Python 3 | none | Windows x86-64 | Details for cat_experiments-0.0.13-py3-none-win_amd64.whl |
| cat_experiments-0.0.13-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | Python 3 | none | Linux glibc 2.17+ x86-64 | Details for cat_experiments-0.0.13-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
| cat_experiments-0.0.13-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl | Python 3 | none | Linux glibc 2.17+ ARM64 | Details for cat_experiments-0.0.13-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
| cat_experiments-0.0.13-py3-none-macosx_11_0_arm64.whl | Python 3 | none | macOS 11.0+ ARM64 | Details for cat_experiments-0.0.13-py3-none-macosx_11_0_arm64.whl |
| cat_experiments-0.0.13-py3-none-macosx_10_12_x86_64.whl | Python 3 | none | macOS 10.12+ x86-64 | Details for cat_experiments-0.0.13-py3-none-macosx_10_12_x86_64.whl |
Total release size: 33.2 MB
Release files / cat_experiments-0.0.13.tar.gz
| Download URL | cat_experiments-0.0.13.tar.gz |
|---|---|
| Size | 478.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
52ee2a5ed7c0cb348a9d0f11bc702ecba5598beaadb9667a0c9685a6ebd416e7
|
|
BLAKE2b-256 checksum How to use checksums |
6ed908e253e26bc3e123e565a4e5e827e95f57fabb0fcee50ba1625f7ed70db1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.4 {"installer":{"name":"uv","version":"0.13.4","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 / cat_experiments-0.0.13-py3-none-win_amd64.whl
| Download URL | cat_experiments-0.0.13-py3-none-win_amd64.whl |
|---|---|
| Size | 6.8 MB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
85829f0c9d04ccd037f4cc78b7a9d8c284663fc7b634898ca3c8b3b0df387bbb
|
|
BLAKE2b-256 checksum How to use checksums |
88cccd2dc6265da5dea9c5d24b7a05458fb8440ce75f96111651e3ad0c41d62c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.4 {"installer":{"name":"uv","version":"0.13.4","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 / cat_experiments-0.0.13-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | cat_experiments-0.0.13-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 6.7 MB |
| Tags | Linux glibc 2.17+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
8695ce5df17064b0a565bdd83c3c804fd1393506aa9ff2bfd7afecf0aca339f6
|
|
BLAKE2b-256 checksum How to use checksums |
d79db13e53926906c4fbfc0bef181234b53a00062f6807b5fc38ddab0ac443da
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.4 {"installer":{"name":"uv","version":"0.13.4","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 / cat_experiments-0.0.13-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | cat_experiments-0.0.13-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 6.0 MB |
| Tags | Linux glibc 2.17+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
dcfdb454205f28e8e0d4945a0b97093d556cbeaf69cdbeab6273c441bf39fca6
|
|
BLAKE2b-256 checksum How to use checksums |
2a0f01b4422a9fd98bd499e403a648045e8a37cf78b750a9ac56b60d61903a81
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.4 {"installer":{"name":"uv","version":"0.13.4","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 / cat_experiments-0.0.13-py3-none-macosx_11_0_arm64.whl
| Download URL | cat_experiments-0.0.13-py3-none-macosx_11_0_arm64.whl |
|---|---|
| Size | 6.4 MB |
| Tags | Python 3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
ec4c699519c7cb4499c709212ec4d731e08fc8b488561ed0d679ba6925ca51b3
|
|
BLAKE2b-256 checksum How to use checksums |
527708e5c188c1c4a5eced0b98b1c1b1be7316bb082eaf0a4bc958949f1162df
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.4 {"installer":{"name":"uv","version":"0.13.4","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 / cat_experiments-0.0.13-py3-none-macosx_10_12_x86_64.whl
| Download URL | cat_experiments-0.0.13-py3-none-macosx_10_12_x86_64.whl |
|---|---|
| Size | 6.9 MB |
| Tags | Python 3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
d8a83177bb45a0c4584807d004d9ec3d2da4fe0541147cfcd87322c2de7c22b1
|
|
BLAKE2b-256 checksum How to use checksums |
234ea306fa1fead1a19d8b3b2ea29de72e1ebb666e71c8997649db69c3b0d6d3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.4 {"installer":{"name":"uv","version":"0.13.4","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}
|
Security for cat-experiments 0.0.13
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.