Skip to main content

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 +m
    • REGRESSION -- 95% CI sits entirely below -m
    • EQUIVALENT -- 95% CI lies within +/-m
    • INCONCLUSIVE -- 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-attrib never 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.md files, 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.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agent-attrib 0.1.0
File Size Uploaded Provenance Actions
agent_attrib-0.1.0.tar.gz 17.3 kB Without provenance Details for agent_attrib-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for agent-attrib 0.1.0
File Interpreter ABI Platform Actions
agent_attrib-0.1.0-py3-none-any.whl Python 3 none any Details for agent_attrib-0.1.0-py3-none-any.whl

Total release size: 38.2 kB

Release files / agent_attrib-0.1.0.tar.gz

Download URL agent_attrib-0.1.0.tar.gz
Size 17.3 kB
Tags Source
SHA-256 checksum
How to use checksums
eb59dfede7275135404d8ec1c1a3478ac91b8037ac83eb7bb9838974031c4f64
BLAKE2b-256 checksum
How to use checksums
a4b34f0b8bc4b2e50bb6b4f3d90444047d3fb344433be3405d41c41e337672ab
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.0-py3-none-any.whl

Download URL agent_attrib-0.1.0-py3-none-any.whl
Size 20.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d403994dd483ed51b4a632105a2fee441a20436da2ab24f69e098f5d5a1ace61
BLAKE2b-256 checksum
How to use checksums
c3319eb0fc9a09c47e020e304f4752fed1a2ceb99bfd294f8a7bfeecf21112c1
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.0

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page