agent-attrib
A Python package for attributing metric changes across simultaneous agent release changes using factorial design of experiments.
The problem: You shipped a release that changed the prompt, the model, and the retriever at once. Your eval pass rate moved. Which change caused it, and by how much?
The solution: Design a factorial experiment, run your agent on the configurations it specifies, and let agent-attrib decompose the effects with confidence intervals.
pip install agent-attrib
60-second demo
agent-attrib demo
No LLM calls, no cost. Generates synthetic runs with planted effects and reports which factors are responsible.
Usage
1. Design the experiment
agent-attrib plan --factors prompt,model,retriever --tasks 30 --trials 2 -o design.csv
Design type : 2^3 full factorial
Resolution : full
Factors : prompt, model, retriever
Tasks : 30
Trials/config: 2
Configurations: 8
Total runs : 480
Seed : 42
MDE (success, α=0.05, power=0.8): 0.1283
For 5-7 factors, a fractional factorial is used automatically (resolution IV by default).
2. Run your agent
For each row in design.csv, set each factor to the specified level (baseline or candidate) and run your agent on the task. Write one line per run:
{"run_id": "r001", "task_id": "t0001", "trial": 1,
"factors": {"prompt": "candidate", "model": "baseline", "retriever": "candidate"},
"metrics": {"success": 1, "cost_usd": 0.042, "latency_s": 11.3}}
3. Analyze
agent-attrib analyze runs.jsonl --metric success --metric cost_usd --margin 0.05
Python API
from agent_attrib import plan, analyze, load_runs
design = plan(factors=["prompt", "model", "retriever"], tasks=30, trials=2, seed=7)
print(design.summary())
runset = load_runs("runs.jsonl")
result = analyze(runset, metrics=["success", "cost_usd"], margin=0.05)
print(result.to_markdown())
Input format
JSONL (one object per run):
{"run_id": "r001", "task_id": "t07", "trial": 1,
"factors": {"prompt": "candidate", "model": "baseline", "retriever": "candidate"},
"metrics": {"success": 1, "cost_usd": 0.042, "latency_s": 11.3}}
CSV with columns run_id, task_id, trial, f_<factor>..., m_<metric>...:
run_id,task_id,trial,f_prompt,f_model,m_success,m_cost_usd
r001,t07,1,candidate,baseline,1,0.042
Factor levels must be exactly baseline or candidate. Metrics must be numeric.
Method
For each metric, analyze fits OLS with task fixed effects:
metric ~ task fixed effects + main effects + estimable two-factor interactions
- Binary
success: linear probability model. Effects are in percentage points. Not logistic regression: effects stay directly interpretable as probability differences. - Cost and latency:
log(metric)model. Effects reported as percent change. - Standard errors: cluster-robust, clustered by task.
- Multiple testing: Holm step-down correction across all effects within a metric.
- Verdicts (given an equivalence margin
m):IMPROVEMENT-- 95% CI sits entirely above +mREGRESSION-- 95% CI sits entirely below -mEQUIVALENT-- 95% CI lies within +/-mINCONCLUSIVE-- CI straddles a boundary; includes approximate tasks needed to resolve
- Effect convention: switching a factor from baseline to candidate (= 2*beta under +/-1 coding).
Designs
| Factors | Design | Runs (30 tasks, 2 trials) |
|---|---|---|
| 1-4 | 2^k full factorial | 60-480 |
| 5 | 2^(5-1) res IV | 960 |
| 6 | 2^(6-2) res IV | 960 |
| 7 | 2^(7-3) res IV | 960 |
Fractional designs print their alias structure. Use --resolution V to request resolution V (more runs, no 2FI aliasing).
Limitations
- Results apply to this task suite and model versions only.
- Attribution requires designed runs -- not observational production logs.
- Maximum 7 factors in v0.1.
- Two levels per factor only (baseline vs candidate).
- No LLM-as-judge;
agent-attribnever calls any LLM.
Prior art
- agentstats, AgentAssay, deltagate: proper A/B statistics for a single pair. Do not decompose changes across multiple simultaneous factors.
- ablate-cli: per-section ablation of
CLAUDE.mdfiles, for coding agents, runs Claude Code itself. Borrowed two ideas: four-way verdicts and printing the minimum detectable effect before any spend. - Research papers: factorial ablations over agent components exist as one-off scripts.
agent-attrib's niche: framework-agnostic, multi-factor, interaction-aware attribution for arbitrary release changes, decoupled from execution.
Development
git clone https://github.com/agent-attrib/agent-attrib
cd agent-attrib
uv sync --all-groups
uv run pytest -m "not slow" # fast tests (~seconds)
uv run pytest # all tests including calibration (~minutes)
uv run ruff check src tests
uv run mypy src
License
MIT
Metadata
Release files for agent-attrib 0.1.1
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 |
|---|---|---|---|---|
| agent_attrib-0.1.1.tar.gz | 17.3 kB | Without provenance | Details for agent_attrib-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| agent_attrib-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for agent_attrib-0.1.1-py3-none-any.whl |
Total release size: 38.3 kB
Release files / agent_attrib-0.1.1.tar.gz
| Download URL | agent_attrib-0.1.1.tar.gz |
|---|---|
| Size | 17.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e47a5a38f656456f17c4d7b06b1438228237c05e4117a55b8a28b1deb10ff1cf
|
|
BLAKE2b-256 checksum How to use checksums |
fbcb2f8b83660f8e52b74c9487bf99b4d03f9d3745d5eb204508330c7d4b9a06
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / agent_attrib-0.1.1-py3-none-any.whl
| Download URL | agent_attrib-0.1.1-py3-none-any.whl |
|---|---|
| Size | 20.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fe3621616c715337fdc9dc570d19746ffaefab66dbe3bd1628ef91670873a653
|
|
BLAKE2b-256 checksum How to use checksums |
d54fcdbdd552afd5658770f48a45be31bccec38b2e261fe2f24b6e33caafe9b0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for agent-attrib 0.1.1
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.