Catch token misuse with Agent Anomaly Detection
Kevin Islas · Google · 2026-12-03

Two equally expensive sessions

An attorney asks an agent to read several contracts. Each turn brings in new clauses and the session ends with a review memo. Another user repeatedly asks the agent to rewrite its previous answer and never reaches a deliverable. Both sessions can consume many tokens while every model call succeeds. The evidence lies between turns. Did the user supply new material? Is the output moving toward the requested deliverable? Is there a plausible stopping point? A flat session cap can interrupt both kinds of work.

Google added a Token Misuse detector for ADK agents in the private preview of Gemini Enterprise Agent Platform. The author describes three behaviors it targets. A user requests much more text than a person could read, recursively expands and compresses previous summaries, or continually demands another variation. Legitimate high-volume review is an essential control because its token consumption can overlap with that of abuse.

An inexpensive first pass for every trace

Reading every session with another large model would make the detection bill scale with all traffic. The first stage takes ADK traces and logs and applies statistical checks to every session. One signal is escalation in token counts across calls. Only sessions with leading indicators go to Gemini for a full read. A complete trace can reveal the new document that motivated a long response, or a sequence of turns devoted entirely to transforming previous output.

All sessions receive a statistical check. Flagged sessions go to Gemini for contextual review.View original ↗

All sessions receive a statistical check. Flagged sessions go to Gemini for contextual review.

A finding carries severity, a probability score, an explanation and suggested actions. Both stages operate off the request path, about two minutes behind the session. The lag leaves time to intervene in long loops, while a short session may finish before a finding arrives. For a long-running loop, an application can check existing findings in an ADK callback before the next turn. The application owns any interruption. The detector evaluation counts findings.

Recall is measured on 106 simulated abuse sessions

The team constructed everyday, legitimate heavy-use and abusive legal-review sessions. The seven-hour A/B test covered six simulated agents and included 106 runaway-token sessions. It compared the existing detector suite with the suite augmented by the new detector. Recall on runaway sessions rose from 29% to 76%, and the proportion of findings that were true positives rose from 94% to 98%. Adding the detector produced no additional false positives on honest heavy users. Precision and recall held steady on five other anomaly scenarios.

The test measures the value of behavioral context when useful work also consumes many tokens. At 76% recall, about a quarter of simulated runaway sessions still escaped detection. The report gives no stage-specific miss counts, fraction of traffic escalated or cost per judgment, so this A/B test cannot establish net production savings. Legal review has identifiable source documents and deliverables. A coding agent might legitimately revisit the same text after a failing test, a different pattern from the workflow used for tuning and evaluation.