Introducing The Sweep: OX’s New Live Security Research Series
Register Now
Breaking: The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Read the Report
Are you exposed? Connect your apps in minutes.
Scan your apps free

drift-detection

Latest version: v0.1.1

Overview

Last scanned
28 Nov 2026
Published
28 Nov 2026
PyPI package Publisher: domb
1 Stars
0 Forks
1 Versions
40 Downloads
Python Repo language

Scan summary

drift-detection was last scanned on 28 Nov 2026 at version 0.1.1. Risk score 0 of 100. No malicious behavior was detected.

  • Releases: First and only release on 28 Nov 2026.
  • Findings: No rules fired in version 0.1.1.
  • Downloads: 40 downloads.

Versions

1 version published
Versions and the rules that fired in each
VersionPublishedStatus
0.1.1 LATEST 28 Nov 2026 No rules fired

No rules fired in 0.1.1

Findings

Findings for v0.1.1. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.

The score describes 0.1.1; other versions have their own rules, not their own score.

README

The publisher’s own README, as collected from the registry.

Drift

Python License: MIT

Statistical anomaly detection for AI agent workflows.\ Catch silent failures before they corrupt your data.

pip install drift-detection

Your AI agents are failing silently. A tool call takes 10x longer than usual. The agent calls delete_file when it's never done that before. Output quality gradually degrades over hundreds of runs. Traditional monitoring tools weren't built for non-deterministic systems — Drift is.

What it does

Drift hooks into your agent's execution and applies statistical anomaly detection to the event stream:

  • Latency & token SPC — Flags when a tool call or LLM response takes significantly longer or uses significantly more tokens than its rolling baseline. Catches hung API calls, runaway generation, and upstream provider issues.

  • Sequence anomaly detection — Builds a transition matrix of tool-call sequences and flags when the agent takes a path that's never or rarely been seen. Catches agents going off-script, skipping required steps, or entering novel execution paths.

  • Output drift detection — Tracks output length, vocabulary diversity, and structural patterns over time. Flags when outputs shift significantly from baseline. Catches hallucination drift, prompt injection effects, and gradual quality degradation.

Install

pip install drift-detection

With LangChain support:

pip install "drift-detection[langchain]"

Quickstart

With LangChain
from drift import DriftGuard
from drift.callbacks.langchain import DriftCallbackHandler

guard = DriftGuard(on_anomaly=lambda a: print(f"🚨 {a}"))
handler = DriftCallbackHandler(guard)

# Pass the handler to any LangChain chain or LLM
chain.invoke("your query", config={"callbacks": [handler]})

# See what happened
guard.report()
Standalone (no framework required)
from drift import DriftGuard, AgentEvent, EventType

guard = DriftGuard(on_anomaly=lambda a: print(f"🚨 {a}"))

# Feed events from any source
guard.ingest(AgentEvent(
    event_type=EventType.TOOL_END,
    name="search_web",
    latency_ms=150.0,
    token_count=85,
    output_text="Found 3 results for query...",
))

guard.report()
Run the demo
python examples/demo.py

This simulates normal agent operation, builds baselines, then injects latency spikes, sequence anomalies, and output drift — showing each detector catching real failure modes.

Architecture

drift/
├── core.py              # DriftGuard engine — orchestrates detectors
├── models.py            # AgentEvent, Anomaly, Severity data models
├── detectors/
│   ├── latency.py       # Statistical process control on latency/tokens
│   ├── sequence.py      # Action transition probability anomalies
│   └── output_drift.py  # Output distribution shift detection
└── callbacks/
    └── langchain.py     # LangChain callback integration

Design principles:

  1. Zero-overhead default — Detectors use numpy for fast rolling statistics. No embedding models, no external services, no network calls.
  2. Per-tool baselines — Each tool and model gets its own statistical baseline, so a slow tool won't pollute the baseline for a fast one.
  3. Framework-agnostic core — The detection engine works with raw AgentEvent objects. Framework integrations (LangChain, CrewAI, etc.) are thin adapters that translate framework callbacks into events.
  4. Non-blocking — Drift never throws exceptions that would crash your agent. Detector errors are caught and logged to stderr.

Detectors

Detector What it catches Method
LatencyDetector Hung calls, slow APIs, runaway generation Rolling z-score on latency and token counts
SequenceDetector Off-script behavior, unexpected tool calls First-order Markov transition probabilities
OutputDriftDetector Hallucination drift, prompt injection, quality degradation Output length, vocab diversity, structural pattern tracking

Configuration

Each detector is independently configurable:

from drift import DriftGuard
from drift.detectors.latency import LatencyDetector, LatencyDetectorConfig
from drift.detectors.sequence import SequenceDetector, SequenceDetectorConfig

guard = DriftGuard(detectors=[
    LatencyDetector(LatencyDetectorConfig(
        window_size=100,     # Longer baseline window
        z_threshold=2.5,     # More sensitive
        min_samples=10,      # Require more data before alerting
    )),
    SequenceDetector(SequenceDetectorConfig(
        min_observations=20, # Require more transitions before flagging
    )),
])

Roadmap

  • [ ] CrewAI callback handler
  • [ ] OpenAI Agents SDK integration
  • [ ] Slack / PagerDuty alerting
  • [ ] Persistent baselines (save/load detector state)
  • [ ] Embedding-based output drift (optional dependency)
  • [ ] Web dashboard
  • [ ] Cost anomaly detection (track spend per run)

Contributing

Issues and PRs welcome. Run tests with:

pip install -e ".[dev]"
pytest

License

MIT

OX Radar and Response Center

Find threats in your stack.

OX Radar can check high-priority threats, like critical package CVEs, against your context.

Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.

Where it’s listed

The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).

  • pypi-releases drift-detection

References

The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.

Powered by Read the latest findings

Scan your whole stack

Group 1261154050 1
Group 1261154050
 

From OX Research Newsroom

Critical Apache HTTP Server Flaw Exposes Web Servers to RCE (1)
CVE

CVE-2026-119618: Critical Apache HTTP Server Flaw Exposes Web Servers to Remote Code Execution

CVE

Java4Shell (CVE-2026-114938): Easy to Crash, Hard to Exploit — Less Than 0.12% of JVMs Estimated at Risk of RCE

Copy of Template Design OX Blog (1)
Research

Thousands Of GitHub Accounts Hijacked With wfx-loot CI Secret Stealing Malware Via GitHub Actions & npm

Frame 2085668439 (1)
Group 1261154229