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

推荐订阅源

J
Java Code Geeks
S
SegmentFault 最新的问题
V
Visual Studio Blog
人人都是产品经理
人人都是产品经理
阮一峰的网络日志
阮一峰的网络日志
腾讯CDC
Stack Overflow Blog
Stack Overflow Blog
博客园 - 【当耐特】
Recent Announcements
Recent Announcements
I
InfoQ
U
Unit 42
博客园_首页
GbyAI
GbyAI
Hugging Face - Blog
Hugging Face - Blog
罗磊的独立博客
博客园 - 叶小钗
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
D
DataBreaches.Net
aimingoo的专栏
aimingoo的专栏
月光博客
月光博客
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园 - 聂微东
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
What Happens When Your AI Agent Gets Stuck in Production?
milan · 2026-06-24 · via DEV Community

The most expensive AI agent failures I've seen weren't model failures.

They were silent failures.

The agent looked healthy. The workflow was still running. Tokens were still being consumed.

But the agent had already stopped making meaningful progress.

Over time I ran into the same production issues repeatedly:

  • Infinite loops
  • Retry storms
  • Silent stalls
  • Tool failures hidden behind successful responses
  • Agents drifting away from the original goal
  • No visibility into what the agent was actually doing

A better prompt never fixed these problems.

The solution ended up being a runtime supervision layer around the agents rather than more workflow logic.

The Problem

Most agent frameworks focus on getting agents to run.

Production teams care about different questions:

  • Why is this execution stuck?
  • Is it still making progress?
  • Can I safely pause it?
  • Can I resume it later?
  • Should I terminate it entirely?

Those questions become difficult when the runtime only exposes logs.

Runtime Supervision

One design decision that worked well was separating supervision from agent logic.

Instead of embedding every guardrail directly inside the workflow graph, a dedicated runtime layer observes execution and enforces operational rules.

This keeps agent workflows simple while allowing supervision logic to evolve independently.

The runtime is responsible for:

  • Loop detection
  • Retry management
  • Budget enforcement
  • Pause and resume operations
  • Execution checkpoints
  • Stop reason classification
  • Live telemetry

The result is a system where operational concerns can change without requiring modifications to agent behavior.

Explicit Stop Reasons

One lesson I learned quickly:

"Failed" is not a useful status.

Execution stops should explain themselves.

Examples:

  • LOOP_DETECTED
  • BUDGET_EXCEEDED
  • RETRY_LIMIT_REACHED
  • TOOL_FAILURE
  • TIMEOUT
  • USER_PAUSED
  • USER_KILLED

The recovery path depends on why the execution stopped.

Without that information operators are forced to guess.

Semantic Loop Detection

Most loop detection implementations use step counts.

The problem is that agents can make progress on the wrong objective without technically looping.

An execution might spend twenty steps confidently pursuing a plan that diverged from the original goal.

What worked better was periodically asking:

"Are we meaningfully closer to the goal than we were several steps ago?"

This catches drift before it becomes expensive.

Pause vs Kill

These are not the same operation.

Pause

Pause preserves execution state.

Execution stops, but the runtime keeps the latest checkpoint.

Resume simply loads the last committed state and continues.

Kill

Kill terminates execution completely.

Active state is removed and the execution cannot continue.

The distinction becomes important when debugging long-running workflows.

Checkpoint Before Action

Before every external action:

  • API calls
  • Browser interactions
  • Email delivery
  • Database writes

the runtime creates a checkpoint.

Successful execution clears the checkpoint.

If the process crashes, the next execution immediately knows what was in flight.

This turned silent failures into recoverable failures.

Retry Storm Protection

One failed dependency can create thousands of wasted requests.

The pattern that worked best was:

  • Exponential backoff
  • Retry budgets
  • Circuit breakers

Without all three, agents tend to fail repeatedly and burn tokens while making no progress.

Live Telemetry

Logs tell you what happened.

Operators usually need to know what is happening right now.

The runtime continuously tracks:

  • Current task
  • Current step
  • Active tool
  • Execution status
  • Recent transitions

The goal is to make agent execution observable while it is running, not after the incident has already happened.

Final Thoughts

Building AI agents is becoming easier every month.

Building agents that can survive production failures is still difficult.

The most important lesson I learned is that reliability problems usually appear outside the model.

They appear in retries, checkpoints, tool failures, execution control, and supervision.

What has been the hardest production failure you've encountered while running AI agents?