Skip to main content

Detect when your AI agents get dumber. Open-source quality drift monitoring.

Project description

AgentDrift

CI PyPI version Python License: MIT

Detect when your AI agents get dumber.

Open-source quality drift monitoring for AI agents. Track agent outputs over time, detect quality degradation, and get alerts before your agents go off the rails.

The Problem

AI agents degrade over time. Context pollution, error accumulation, prompt drift, and model updates silently erode output quality. By the time you notice, your users already have.

Research shows 42% of long-running agents experience quality drift, causing a 3.2x increase in human intervention.

Quick Start

pip install agentdrift
from agentdrift import track_agent

@track_agent("my-agent")
def my_agent(query: str) -> str:
    return llm.call(query)

Check drift status:

agentdrift status
┌──────────────────────────────────────┐
│         Agent Drift Status           │
├──────────┬──────────┬───────┬───────┤
│ Agent    │ Status   │ Score │ Change│
├──────────┼──────────┼───────┼───────┤
│ my-agent │ STABLE   │ 0.847 │ +2.1% │
│ qa-bot   │ DRIFTING │ 0.612 │-18.3% │
└──────────┴──────────┴───────┴───────┘

Features

  • 1-line integration - Decorator or manual logging
  • Quality scoring - LLM-as-Judge auto-scoring (Anthropic / OpenAI)
  • Drift detection - Baseline vs recent quality comparison
  • CLI dashboard - Quick status checks from terminal
  • Golden tests - Regression testing for agents (coming soon)
  • Alerts - Slack/Discord/Email webhooks (coming soon)

How It Works

Agent Call → Log Trace → Score Quality → Detect Drift → Alert
  1. Track: Log every agent input/output with the SDK
  2. Score: LLM-as-Judge rates output quality (0.0-1.0)
  3. Compare: Recent scores vs baseline period
  4. Alert: Notify when quality drops below threshold

Manual Logging

from agentdrift import AgentTracker

tracker = AgentTracker("my-agent")

result = my_agent(query)
tracker.log(
    input=query,
    output=result,
    tokens_in=100,
    tokens_out=50,
    latency_ms=1200,
)

Drift Detection

from agentdrift import DriftDetector

detector = DriftDetector(
    baseline_window=50,   # first N traces as baseline
    recent_window=20,     # last N traces to compare
    threshold_pct=10.0,   # alert if quality drops 10%+
)

report = detector.check("my-agent")
print(report.message)
# "DRIFT DETECTED: my-agent quality dropped 18.3% (baseline: 0.847 -> current: 0.612)"

Examples

See the examples/ directory:

Roadmap

  • Agent call tracking (SDK)
  • Quality scoring (LLM-as-Judge)
  • Drift detection
  • CLI dashboard
  • Web dashboard
  • Golden test suite (agentdrift test init / agentdrift test run)
  • Alert webhooks (Slack, Discord, Email)
  • Multi-agent interaction tracing
  • OpenTelemetry export
  • Managed cloud service

Contributing

See CONTRIBUTING.md for development setup and guidelines.

License

MIT

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

agentdrift-0.1.0.tar.gz (58.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agentdrift-0.1.0-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file agentdrift-0.1.0.tar.gz.

File metadata

  • Download URL: agentdrift-0.1.0.tar.gz
  • Upload date:
  • Size: 58.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for agentdrift-0.1.0.tar.gz
Algorithm Hash digest
SHA256 288dc77aae4cd769bcec98ae1f5e009f4fda5695b8fbb2d38d780754323faabd
MD5 96f83694a83c41714bbad9861dca1e54
BLAKE2b-256 5efc8efe183ec18275b6acb77b6af1fadcdb9864e1725f6c3b70b8ffc24aed87

See more details on using hashes here.

Provenance

The following attestation bundles were made for agentdrift-0.1.0.tar.gz:

Publisher: publish.yml on agentdrift-ai/agentdrift

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file agentdrift-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: agentdrift-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for agentdrift-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f49056de607486b834c06969060612f0c67de08e4eddeab514440fe2fdcfaf5d
MD5 52e838dac4d0d98d10a41e7c727f0574
BLAKE2b-256 ee7953f0c3b0b7e3f031d6c14de8ed4ddadfb21039c5f7dd2012675ee897f4c5

See more details on using hashes here.

Provenance

The following attestation bundles were made for agentdrift-0.1.0-py3-none-any.whl:

Publisher: publish.yml on agentdrift-ai/agentdrift

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page