Answers from the documentation; checking which model is on duty
Hi - I answer from the OpenSmartRoute documentation: routing, the API, plans and quotas, self-hosting. Ask away, or open a support ticket if you need a person.
Grounded in the docs - follow a source before acting on it.
Google AI detects token misuse in agents with new anomaly system - OpenSmartRoute
Google AI detects token misuse in agents with new anomaly system
Google AI introduced a Token Misuse detector in Agent Anomaly Detection, now in Private Preview, to identify wasteful or abusive sessions without flagging honest work.
Key points
The detector improves abuse detection recall from 29% to 76%.
Precision of abuse detection rose from 94% to 98%.
Runs in the background with a two-minute delay.
Enabled by default on Gemini Enterprise Agent Platform.
Why it matters: Reducing wasted tokens saves costs and improves agent safety by preventing abuse without impacting honest users.
By OpenSmartRoute editorial · written through the router by llm-small
Introduction - what was announced and why it matters
Google AI has introduced a new feature called the Token Misuse detector. It is part of Agent Anomaly Detection, now available in Private Preview. This system helps identify sessions where tokens are wasted or abused. It aims to prevent unnecessary costs without flagging honest work. This change matters because tokens cost money, and misuse can inflate bills without any errors showing up. It allows teams to better control their AI expenses and improve security.
The detector looks at how sessions behave, not just how many tokens are used. It can spot patterns of abuse that simple token limits cannot catch. This helps teams distinguish between legitimate heavy use and wasteful or malicious activity. The new system runs in the background and adds no extra delay to agent responses. It is designed to improve abuse detection accuracy while avoiding false positives on honest users.
Token misuse patterns - common abusive behaviors identified
Certain behaviors tend to indicate token misuse. One common pattern is a token spike. This happens when a user asks for more output than anyone could reasonably read. For example, requesting a final output that exceeds a large number of words. Such requests suggest the user is trying to generate excessive content, often wastefully.
Another pattern is recursive meta-summary. This occurs when each turn reworks the previous answer instead of going back to source documents. The user might summarize, expand, then summarize again repeatedly. This pattern can be used to generate large amounts of output without delivering anything new or useful.
The third pattern is an infinite loop. Here, the user keeps asking for variations or follow-ups without ever reaching a final goal. The session produces endless output, with no deliverable. These behaviors are typical of abuse or wasteful use, as they consume tokens without producing value.
Limitations of token count caps - why they are insufficient
Many teams try to limit token waste by setting caps on tokens per session or per user. This approach seems simple and straightforward. However, it has significant limitations. A token cap can flag honest users who need many tokens for legitimate work. For example, an attorney drafting a lengthy memo may use as many tokens as an abusive user.
Elastic emphasizes data retrieval over model improvements, integrating search technology into AI agent workflows to improve data access and security.
Token count alone does not reveal whether the output is useful or impactful. Heavy, honest work can look identical to abuse if only token numbers are considered. This means that setting a flat token limit risks penalizing good users and missing actual abuse. It also does not address the core problem of wasteful behavior, which is about how tokens are used, not how many.
Therefore, relying solely on token caps can lead to false positives and false negatives. It cannot reliably distinguish between legitimate heavy use and abuse. This is why a behavior-based detection approach is necessary. It looks at patterns of activity rather than just raw token counts.
Behavior-based detection approach - how the detector works
The Token Misuse detector uses a behavior-based approach. Instead of counting tokens, it analyzes how a session behaves over time. It looks at patterns such as rapid token escalation, repetitive reworking, or endless follow-ups. These patterns are more indicative of abuse than raw token numbers.
The detector works in two stages. First, it performs a quick statistical check on all sessions. This check looks for signs like token escalation, where token counts grow rapidly across calls. Sessions that show these signs are flagged for further review. This first pass is fast and runs in the background.
Sessions flagged as suspicious then undergo a deeper analysis. An AI model reads the full session trace and logs. It evaluates whether the behavior matches known abuse patterns. If so, it flags the session as misuse. This two-stage process balances speed and accuracy. It avoids wasting resources on honest sessions while catching abuse effectively.
Two-stage detection pipeline - statistical check and full analysis
The detection pipeline has two steps. The first step is a statistical check. It quickly scans all sessions for signs of misuse. One key check is token escalation. This measures how token counts grow across multiple calls. If token counts spike unexpectedly, the session is flagged for review.
Only sessions that show potential abuse are sent to the second step. In this step, a full session analysis is performed. An AI reads the entire trace, logs, and context. It looks for behaviors like recursive summaries or infinite loops. Based on this review, it decides if the session is misuse or just heavy, honest work.
This pipeline runs about two minutes behind the agent. It does not slow down the agent or interfere with normal operation. The two-stage process improves detection accuracy while keeping performance impact minimal. It ensures that only sessions with suspicious patterns are examined in detail.
Testing results - improvements in abuse detection metrics
The new detector was tested on simulated traffic. The tests included everyday use, heavy work, and abuse scenarios. Heavy work sessions are important because they can look like abuse if only token counts are used. The tests measured how well the detector identified abuse.
In a seven-hour test, the system was applied to six simulated agents. It included over 100 abuse sessions with runaway tokens. Results showed a significant improvement. The detection rate for abuse increased from 29% to 76%. This means the system caught more abuse sessions.
At the same time, the precision improved from 94% to 98%. This indicates fewer false alarms on honest users. The system did not produce false positives on legitimate heavy users. Overall, the tests showed that the behavior-based detector is more accurate and reliable.
Implementation details - default settings and setup
The Token Misuse detector is enabled by default in Agent Anomaly Detection. It is available in Private Preview for teams using the Gemini Enterprise Agent Platform. To activate it, teams need ADK version 2.1.0 or later. The setup involves a simple, one-click process documented in the official materials.
Once enabled, the detector runs automatically in the background. It analyzes sessions and produces findings with severity levels, probability scores, and plain-language explanations. Teams can review these findings to identify and address misuse. The detector also provides recommended fixes, such as limiting follow-up turns or output length.
The detection process is designed to be seamless. It adds no latency to agent responses and works continuously. For longer sessions or infinite loops, teams can set up callbacks to check for findings via API. This allows stopping sessions before they run too long or cause excessive token waste.
Practical recommendations - how to use findings effectively
Teams should use the findings from the Token Misuse detector to set guardrails. Instead of flat token caps, consider limiting single-turn output length or follow-up turns that do not add new source material. These measures help prevent wasteful sessions without penalizing honest users.
It is also helpful to monitor the severity and probability scores of findings. High scores indicate clear abuse, while lower scores may require further review. Teams can adjust their policies based on these insights. For example, they might automatically stop sessions with high-severity findings or alert operators for manual review.
Since detection runs about two minutes behind, it is possible to set up automated checks. These can stop sessions before they produce excessive output. Combining behavior-based detection with session management improves overall control and reduces costs. Teams should regularly review findings and refine their guardrails accordingly.
How OpenSmartRoute helps - integrating detection with routing
OpenSmartRoute is an open-source router for AI requests. It directs each request to the best-fit model, agent, tool, or skill from a team-defined catalog. It scores each candidate based on quality, cost, speed, and safety. Teams set the importance of each factor for every request.
OpenSmartRoute can help teams implement detection insights. For example, it can enforce guardrails like maximum input length or restrict certain models for high-cost requests. It also tracks the cost of each routed request, helping teams manage budgets. If abuse is detected, the router can reroute or block requests automatically.
By integrating with the Token Misuse detection system, OpenSmartRoute can prevent wasteful sessions from running long. It can stop sessions before they generate excessive tokens or flag suspicious activity for review. This combination improves cost control and security while maintaining high-quality responses. Teams can set rules that pin prompt data on-premises or within regions, ensuring compliance and safety.
OpenSmartRoute’s ability to learn from outcomes and adjust traffic based on model performance further enhances abuse prevention. It can prioritize honest, high-quality sessions and reduce traffic to models showing signs of misuse. This makes managing large-scale AI deployments more efficient and cost-effective.
How it compares - what existed before, what this changes and what stays the same
Before the Token Misuse detector, teams relied mainly on simple token count limits. These limits set a maximum number of tokens per session or user. They were easy to implement but often flagged honest users as abuse. For example, a lawyer drafting a long document might hit the token limit, even though their work is legitimate.
The new detector changes this by analyzing session behavior. It looks at how tokens grow over time and identifies patterns that suggest waste. It does not just count tokens. Instead, it evaluates whether a session is productive or abusive based on behavior.
What stays the same is the need to control costs. Teams still want to prevent sessions that waste tokens. They also still need to allow honest, high-value work. The difference is that now, they can do this more precisely. The detector flags only sessions that show clear signs of misuse, not those that simply use many tokens.
This approach reduces false positives. It helps teams avoid stopping good sessions while catching abuse more reliably. It also runs in the background, adding minimal overhead. The detector uses a two-stage pipeline: a quick statistical check and a deeper review by an AI model. This makes it efficient and scalable.
Overall, this new system improves cost control without hurting user productivity. It shifts from simple limits to intelligent behavior analysis. Teams can better balance safety, quality, and cost.
Questions this leaves open - what the source does not say and how a reader can check it
The source does not specify how well the detector works on different types of sessions beyond simulated legal document review. It mentions code-generation and data-pipeline agents but does not give detailed results. Teams may want to test the detector on their own workflows to see if it performs well.
It also does not describe how to tune the detector’s sensitivity. For example, how to set thresholds for different environments or use cases. Teams might need to experiment with their own data to find the best settings.
The source does not explain how the detector handles false negatives, such as sophisticated abuse patterns that do not show typical signs. It is unclear whether some abuse might slip through. Teams should monitor their logs and review flagged sessions regularly.
Another open question is how the detector integrates with existing monitoring and alerting systems. The source mentions API callbacks and session stopping, but does not detail how to automate responses or escalate findings.
Finally, the source does not specify how to verify whether flagged sessions are truly abuse. Teams can manually review sessions flagged by the detector to confirm abuse patterns. They can also compare detection results with their own logs and user reports.
To check the detector’s effectiveness, teams should run their own tests. They can simulate abuse scenarios and measure recall and precision. They can also review honest sessions to ensure they are not flagged unnecessarily. Regular evaluation helps maintain a good balance between safety and user experience.