Recent findings suggest that as highlighted in our announcement post, we remarked that each new model generation lets agents do more on their own. However, the more an agent can reach, the more one bad decision can cost. You've probably seen a few of these in the news lately:.
Because these events produced no system crashes or logging errors, the teams behind these agents had no way to know until the damage occurred.
Agent Anomaly Detection on the Gemini Platform watches for exactly these issues. It reads the traces and logs your agents already produce and flags sessions where an agent goes outside the job it was built for.
Before you point it at your production agents, you'll probably want to see it work in a test environment. In this hands-on guide, weβll walk you step-by-step through setting up Agent Anomaly Detection and using it to capture your very first agent behavior anomaly. By the end of this post, you'll have:.
To get started, open the companion notebook Detect anomalous agent behavior with Agent Anomaly Detection in a separate tab (available on Google Colab or GitHub). As you read through this guide, it will prompt you when to execute notebook cells or interact directly with the Google Cloud console.
If a step can be done in the UI console, this post indicates that path, with screenshots. The notebook does the same thing through the Agent Anomaly Detection API, so by the end you'll also have the code to automate enablement and pull findings into your own tooling.
2. A place to run the notebook: Google Colab, Colab Enterprise, or a local Jupyter environment. The notebook installs the latest ADK for Python itself. Agent Anomaly Detection is compatible with agents running ADK 1.2+, though ADK 2.0+ is preferred for best results.
Sources indicate that 3. A Cloud Logging bucket and an Observability dataset in either US or EU multi-region. (Both resources need to be in the same multi-region).
In a recent development, 4. In the notebook: run the Get started cells. They install the packages, authenticate you, take your project ID, and turn on the four APIs that Agent Anomaly Detection needs.
Sources indicate that first, letβs create a Customer Support Agent called βanomaly-detection-refund-demoβ. Our example agent is responsible for helping customers check their order history and request refunds. However, it has a deliberate flaw: the agent has access to an overprivileged fetch_records tool which can read any table, including a `payroll` table containing sensitive employee data. All three parts of the lethal trifecta are here: the agent can read private data, it takes input from people it can't vet, and it sends what it finds back in its reply. Tool permissions and guardrails should stop most of this, but they only block what someone thought to write down. Agent Anomaly Detection flags the sessions that get past them, usually within a few minutes.
In the notebook: run the Step 1 cells.
Recent findings suggest that the notebook has the full agent. The part that matters is the tool, which never checks the table name against an allowlist:.
