惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
MongoDB | Blog
MongoDB | Blog
博客园_首页
博客园 - 三生石上(FineUI控件)
博客园 - 聂微东
B
Blog RSS Feed
D
Docker
IT之家
IT之家
大猫的无限游戏
大猫的无限游戏
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
阮一峰的网络日志
阮一峰的网络日志
罗磊的独立博客
Recent Announcements
Recent Announcements
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
A
About on SuperTechFans
The GitHub Blog
The GitHub Blog
G
Google Developers Blog
V
V2EX
量子位
雷峰网
雷峰网
月光博客
月光博客
云风的 BLOG
云风的 BLOG
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
T
Tailwind CSS Blog

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Your AI Agents Are Failing Silently — Here's How to Catch It
Dominic Peters · 2026-06-14 · via DEV Community

Last month I ran hundreds of LangChain agent calls in production. Some of them silently failed by using wrong tool sequences, latency spikes, or even hallucinated outputs. My logs showed zero errors. No exceptions. No warnings.
The agent just did the wrong thing, quietly.

Traditional monitoring tools weren't built for this. Datadog can tell you a function threw an exception. It can't tell you your agent called delete_file when it's never done that before, or that your LLM is suddenly generating 10x more tokens than usual, or that output quality has been slowly degrading over the last 500 runs.

So I built Drift.

What Drift Does

Drift hooks into your agent's execution and applies statistical anomaly detection to the event stream in real time. Three detectors run simultaneously:

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

Sequence anomaly detection — Builds a Markov 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 making dangerous tool calls they've never made before.

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.

Three Lines to Add It

bash
pip install drift-detection

python
`from drift import DriftGuard
from drift.callbacks.langchain import DriftCallbackHandler

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

Add to any LangChain agent, chain, or LLM

agent.run("your query", callbacks=[handler])

guard.report()`

What It Looks Like in Action

DRIFT DEMO — Agent Anomaly Detection

[Phase 1] Building baseline with 20 normal agent runs...
✓ 120 events processed, 0 anomalies

[Phase 2] Injecting anomalies...

--- Injecting: Latency spike on 'search_web' ---
🚨 [CRITICAL] latency_spike: 'search_web' latency is 2500.0ms,
76.3σ above mean (200.7ms ± 30.1)

--- Injecting: Novel tool sequence (search_web → delete_file) ---
🚨 [HIGH] sequence_anomaly: Novel transition: 'search_web' → 'delete_file'
(never observed; known transitions: ['parse_document'])

--- Injecting: Output drift on 'write_response' ---
🚨 [CRITICAL] token_anomaly: 'write_response' token_count is 2000 tokens,
66.5σ above mean (107.8 ± 28.5)
🚨 [HIGH] output_drift: output_length is 3014 chars, 43.3σ above baseline
🚨 [MEDIUM] output_drift: novel structure 'code_block' (seen: ['plain_text'])`

The latency spike at 76σ. The delete_file call never seen before. The token count 18x baseline. All caught automatically.

Design Decisions

  • Zero external dependencies — core only requires numpy, no embedding models or network calls
  • Per-tool baselines — each tool gets its own statistical baseline
  • Non-blocking — never crashes your agent, errors go to stderr
  • Framework-agnostic core — thin adapters for each framework, LangChain first

What's Coming

  • CrewAI and OpenAI Agents SDK support
  • Persistent baselines across runs
  • Slack / PagerDuty alerting
  • Hosted dashboard for teams

Try It

bashpip install drift-detection

GitHub: GitHub: dombinic/Drift

Star it if it's useful. Open an issue if you want a feature — I read everything.