We run AI agents in production. Real agents, handling real conversations with real clients. And we hit a problem nobody talks about out loud.

Agents go insane.

Not metaphorically. Literally. An agent that performed flawlessly at turn 3 becomes a mess by turn 30. It starts spamming tools — one after another, no reporting back. It loops — calling the same tool with the same parameters, hoping for a different result. It burns tokens — generating verbose, repetitive output that costs real money. It loses scope — drifting from the original task into reactive thrashing.

And the worst part: you don't see it happen. The agent doesn't announce "I'm degrading." It just does it. Silently. While you pay for every token.

What others do

Existing approaches fall into two camps. Both treat the symptom, not the cause.

Evaluation frameworks — score the session after it's over. Thanks, tokens already spent. The report says "yes, that session went wrong." Helpful? Absolutely. Too late? Completely.

External guardrails — sit between the agent and the user, filtering or blocking output. The agent keeps degrading, you just don't see the result. It's like unplugging the "check engine" light — the engine is still broken.

Nobody catches degradation while it's happening. Nobody tells the agent to stop.

What we did

A few months ago, we built a cognitive engine for the Viveksha-Avarta system. Not an LLM. Not a neural network. Pure math.

The original task was different — track client behavior in dialogue. But we found scientific work that pointed the way:

  • Cognitive Companion (arXiv 2604.13759) — external monitoring, loop/drift/stuck detection, 52-62% reduction in repetitions
  • Think Before You Act (arXiv 2604.25684) — Pre-Action Governance Loop, 4 layers of rules
  • Metacognition Patterns (Zylos) — Nelson-Narens framework, MAPE-K loop. Key principle: "Governor must not be LLM-sovereign" — the monitor must not be an LLM
  • Reflexion (Shinn, 2023) — Actor + Evaluator + Self-Reflector → 91% pass@1

The principle "Governor must not be LLM-sovereign" became the foundation. An LLM-based monitor is just another LLM that can degrade. The monitor must be math.

How it works

The engine tracks 11 behavioral axes across 8 spaces:

Space Axes
relationship trust
intent curiosity, purchase_intent
resistance price_resistance, visual_quality_concern
readiness timeline_sensitivity, decision_readiness
skepticism skepticism
urgency urgency
authority authority
engagement engagement

Each axis is computed via Exponential Moving Average with adaptive coefficient:

  • α = 0.1 for short messages (under 5 words)
  • α = 0.45 for long messages (over 50 words)
  • α = 0.3 base
  • decay = 0.99

This means: a single spike doesn't dominate, but a sustained pattern accumulates. A client says "too expensive" once — noise. Three times in a row — pattern.

On top of the axes — a health score:

health = GPV×0.3 + entropy×0.2 + loop×0.2 + effort×0.3

Where GPV is Goal Progress Velocity — average change in key axes. Entropy — distribution of scores. Loop risk — 4+ repetitions of one strategy. Effort trend — rising, stable, falling.

All of this — 0 seconds to compute. Not an LLM call. Not an embedding. Math. Counters. A formula.

The result: adequate behavior in dialogue. The engine understands what's happening with the conversation partner in real time — as the conversation unfolds, without delay.

Dialogue is built not on a funnel or a script, but on cognitive analysis of the situation: it detects intent, interest level, objections, emotional tone. Based on the analysis, it selects arguments and prompt injections — not from a template, but through understanding of the current state.

When we realized the agent is the same as the client

The engine ran in production for months. And one day we noticed: our own agent was degrading exactly like the clients.

Spamming tools. Looping. Losing scope. Burning tokens. Same math, same pattern — just directed at the agent, not the human.

We took the engine that tracked 11 axes of client behavior and adapted it to monitor the agent. 7 axes instead of 11. No embeddings, no cosine — simple counters from lifecycle hooks.

We called it DE-Monitor.

DE-Monitor

7 axes of agent behavior:

Axis Weight What it tracks
tool_spam 35% Consecutive tool calls without reporting to operator
rule_violation 25% Repeated delegation without new task, broken rules
loop_risk 20% Same tool + same params 3+ times
token_burn 10% Token usage rising 3 turns in a row
scope_creep 10% Scope expansion beyond request (Phase 2)
context_switch 10% Task switching mid-stream (Phase 2)
approval_bypass 5% Bypassing approval system (Phase 2)

Health score from 0.0 to 1.0. Intervention threshold: 0.65.

When health drops, DE-Monitor injects a stop-signal directly into the agent's context:

STOP. 3 consecutive tool calls. Pause and report.

The agent reads this and stops. Not because it was blocked. Because an LLM responds to text in its context. A stop-signal is just text. But it's text that says: you are degrading, here's why, stop and report.

Core principle: observe, don't block. DE-Monitor never blocks a tool call. Never filters output. It watches, scores, and when something is wrong — tells the agent to stop. In the agent's own context.

Calibrated on real data

DE-Monitor is calibrated against 109 real sessions with 8,862 tool calls. Not simulation. Our own sessions — our mistakes, our degradation, our token bills.

Key findings:

  • tool_spam — dominant degradation mode (avg 0.73, 1052 hot readings) → weight 0.35
  • loop_risk — rare but destructive → weight 0.20
  • token_burn — correlates with long sessions, rarely critical → weight 0.10

This plugin is running right now

We're not theorists. DE-Monitor is a module of the Viveksha ecosystem, extracted from production. The plugin is running right now, on this machine, monitoring the agent that wrote this text. We eat our own dog food.

Open source

DE-Monitor is published under the MIT license:

github.com/logoserg-cmd/de-cogneti

In the repository:

  • Working plugin code (single file, no build step)
  • Architecture document
  • Offline calibrator for session analysis
  • Calibration data (109 sessions, 8862 tool calls)

Why there's nothing like it

We're not aware of any other solution that does this in real time inside the agent lifecycle. Everyone walks around it: guardrails filter output, evaluation assesses after the fact, metrics are computed post-hoc.

Nobody computes the cognitive state of an agent while it's working. Nobody injects a stop-signal into its context.

If you know of an analogue — let us know.


DE-Monitor is a module of the Viveksha ecosystem. MIT license. Authors: Sergey & Fox.