Statistically rigorous behavioral drift detection for AI agents. Agents don't throw errors when they degrade — dedrift catches it.
Project description
dedrift
Agents don't throw errors when they degrade. They keep confidently producing worse outputs. dedrift catches it.
dedrift is an open-source Python package that detects silent behavioral drift in AI agents. It logs agent interactions, runs a frozen canary suite repeatedly, extracts behavioral signatures, and applies statistically rigorous drift detection with config-change attribution ("behavior shifted within 6h of the model version change").
Why dedrift
Model updates, prompt edits, tool-schema changes, RAG index refreshes, and provider-side silent updates all shift agent behavior without throwing a single error. Existing monitoring catches crashes, not character changes.
dedrift's differentiation is statistical correctness:
- Every detector controls its documented false-alarm rate — validated by simulation tests in CI.
- All alerting passes through FDR control (Benjamini–Hochberg). No raw per-test p-values dressed up as alerts.
- Every alert requires both statistical significance and a configurable effect-size (materiality) threshold. Fewer, higher-confidence alerts.
- LLM outputs are stochastic: canaries run N times per cycle and we compare distributions, never single outputs.
- Dual baselines: every check runs against a rolling recent window (sudden breaks) and a frozen golden baseline (boiling-frog drift).
- Honest about power: small N means low detection power, and the docs show you the math instead of hiding it.
Status
Pre-alpha, under active development. Working today: logging schema + store, canary runner (N repetitions per cycle), Tier-1 structural signatures, Tier-2 semantic signatures (pinned embedder, semantic displacement, MMD-RBF with a seeded permutation null and an auto-calibrated materiality floor), the full detector battery (KS/AD/Welch/Levene/bootstrap-P95/two-proportion z, PSI, Page–Hinkley) with BH-FDR and materiality gating, dual baselines, config-change attribution, and deterministic markdown reports — all with calibration and power tests enforced in CI.
Install
pip install dedrift # core: zero ML dependencies
pip install "dedrift[embeddings]" # + semantic signatures (sentence-transformers)
pip install "dedrift[judge]" # + LLM-judge tier
For development: pip install -e ".[dev]".
Quickstart — a full simulated drift incident in five commands
No API keys needed: dedrift sim ships a seeded synthetic agent whose "model
version" is swapped mid-history, shifting output length, refusal rate, and
format validity — the classic silent degradation.
pip install dedrift
mkdir drift-demo && cd drift-demo
dedrift init # create the project
dedrift embedder pin hash # optional: enable Tier-2 semantic signatures
dedrift sim --cycles 8 --change-cycle 7 # 8 canary cycles; model swap at cycle 7
dedrift baseline set cycle-0000 cycle-0001 cycle-0002 # freeze known-good cycles
dedrift check # exits 2: DRIFT DETECTED (both baselines)
dedrift report --out report.md # deterministic markdown report
The report shows what shifted in plain units (e.g. refusal +21 pp, output
variance ratio ~9x), BH-adjusted p-values, and attribution: "nearest config
event: model fingerprint change, 0.0 h before onset." With your own agent,
replace sim with dedrift canary run --suite canaries.yaml --agent yourmodule:agent_fn --model 'provider/model@version' on a schedule.
Detection power: the honest table
Statistical power depends on sample size, and canary suites are small. For a rate signature (e.g. refusal) at a 5% baseline in a family of 30 canaries, two-sided α=0.05 per test (before FDR, which reduces power further), simulated power to detect a shift of the given size:
| Repetitions N | n per window | +2 pp | +5 pp | +10 pp | +15 pp |
|---|---|---|---|---|---|
| 5 | 150 | 0.07 | 0.28 | 0.78 | 0.97 |
| 7 (default) | 210 | 0.11 | 0.42 | 0.91 | 1.00 |
| 10 | 300 | 0.13 | 0.60 | 0.99 | 1.00 |
Read the first column honestly: a 2 pp refusal shift is essentially undetectable at this scale. dedrift's default materiality gate (2 pp) is a floor on what may alert, not a promise of what will be detected. If small rate shifts matter to you, grow the refusal-boundary family or raise N — power comes from samples, not from wishful thresholds.
dedrift Pro
Anytime-valid sequential inference (e-processes), conditional production-traffic drift, and importance weighting are part of a separate commercial tier and are not in this repository.
Contact
Questions, bug reports, or interest in being a design partner: open an issue or email support@dedrift.ai.
License
AGPL-3.0-only. See LICENSE.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dedrift-0.1.0.tar.gz.
File metadata
- Download URL: dedrift-0.1.0.tar.gz
- Upload date:
- Size: 61.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5fb590d2c12fea2305a5b5ce9d51eaf7e9c480820e20d9ee7079ab189b8a9b10
|
|
| MD5 |
f0a21c3ae2273417f8d550022ed6b58c
|
|
| BLAKE2b-256 |
d48d3f79e8689f277aeaa077d5e52248b6c7495411efb0ab080326e32033d90c
|
Provenance
The following attestation bundles were made for dedrift-0.1.0.tar.gz:
Publisher:
release.yml on dedrift/dedrift
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dedrift-0.1.0.tar.gz -
Subject digest:
5fb590d2c12fea2305a5b5ce9d51eaf7e9c480820e20d9ee7079ab189b8a9b10 - Sigstore transparency entry: 2321569028
- Sigstore integration time:
-
Permalink:
dedrift/dedrift@4f62024efdb3d453f5df94778a9674a96ee7c6dc -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/dedrift
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@4f62024efdb3d453f5df94778a9674a96ee7c6dc -
Trigger Event:
push
-
Statement type:
File details
Details for the file dedrift-0.1.0-py3-none-any.whl.
File metadata
- Download URL: dedrift-0.1.0-py3-none-any.whl
- Upload date:
- Size: 60.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc3262bb7465d9552dbc3e28a6288aa4c317b07d9e38c49df44830acd7e6ae7a
|
|
| MD5 |
24266377af590080e14e473ecb1c27ad
|
|
| BLAKE2b-256 |
b96ce313fb6eb0131965cec0b9b016fb8953b0d5bffe89685910c01450a71116
|
Provenance
The following attestation bundles were made for dedrift-0.1.0-py3-none-any.whl:
Publisher:
release.yml on dedrift/dedrift
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dedrift-0.1.0-py3-none-any.whl -
Subject digest:
bc3262bb7465d9552dbc3e28a6288aa4c317b07d9e38c49df44830acd7e6ae7a - Sigstore transparency entry: 2321569096
- Sigstore integration time:
-
Permalink:
dedrift/dedrift@4f62024efdb3d453f5df94778a9674a96ee7c6dc -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/dedrift
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@4f62024efdb3d453f5df94778a9674a96ee7c6dc -
Trigger Event:
push
-
Statement type: