---
title: "Securing Your Agents: A Hands-On Guide to Agent Anomaly Detection"
description: "Agent Anomaly Detection on the Gemini Platform monitors agent traces and logs to flag sessions where an agent acts outside its intended purpose, catching issues that produce no system crashes or logging errors. This guide walks through deploying a deliberately over-permissive customer support agent whose fetch_records tool accepts any table name without an allowlist. After enabling telemetry and setting up Agent Anomaly Detection, the guide sends one normal refund conversation and one out-of-scope session where a user extracts payroll data. The detection system flags the anomalous session with a Tool misuse finding at High severity and 95% probability, providing a recommended fix to restrict the tool’s table access. Alerting can be configured through Cloud Monitoring metrics and Security Command Center findings, and the setup takes about 30 minutes with automatic monitoring of new agents."
---

# Securing Your Agents: A Hands-On Guide to Agent Anomaly Detection

[Google](https://yomu.fyi/company/google) · Achuth Narayan Rajagopal, Derek Luan · Nov 16, 2026

**Type:** Tutorial

## Summary

Agent Anomaly Detection on the Gemini Platform monitors agent traces and logs to flag sessions where an agent acts outside its intended purpose, catching issues that produce no system crashes or logging errors. This guide walks through deploying a deliberately over-permissive customer support agent whose fetch\_records tool accepts any table name without an allowlist. After enabling telemetry and setting up Agent Anomaly Detection, the guide sends one normal refund conversation and one out-of-scope session where a user extracts payroll data. The detection system flags the anomalous session with a Tool misuse finding at High severity and 95% probability, providing a recommended fix to restrict the tool’s table access. Alerting can be configured through Cloud Monitoring metrics and Security Command Center findings, and the setup takes about 30 minutes with automatic monitoring of new agents.

## Context

The post is a step-by-step guide for setting up Agent Anomaly Detection on the Gemini Platform. It uses a deliberately flawed customer support agent to demonstrate detection of out-of-scope behavior. The guide covers deployment, configuration, sending test sessions, reading findings, and setting up alerting. It is part of a series following an announcement post.

## Approach / What changed

Deploy a sample agent with telemetry enabled via environment variables, enable Agent Anomaly Detection through the console or API, send benign and anomalous conversations, then review findings and configure alerting through Cloud Monitoring and Security Command Center.

## Takeaways

- Agent Anomaly Detection reads traces and logs from agents already producing telemetry and flags sessions where an agent goes outside its intended job, catching issues that produce no system crashes or logging errors.
- The sample agent’s fetch\_records tool is deliberately over-permissive, accepting any table name without an allowlist, which allows a user to extract payroll data by asking for nonexistent tables to learn available tables.
- The detection system provides a detail view with each detector that fired, its severity, probability, why it fired, and recommendations, and findings are published as AGENT\_SESSION\_ANOMALY in Security Command Center.

## FAQ

### How long does Agent Anomaly Detection setup take?

Setup takes around 30 minutes. Once completed, the agent shows as Active under Monitored agents, and sessions that started earlier are not analyzed.

### How quickly are anomalous sessions flagged?

Anomaly Detection scans sessions within 5 minutes. The landing page shows processed sessions and any detected anomalies.

### What alerting options are available?

Agent Anomaly Detection publishes two metrics in Cloud Monitoring: Detected events and Monitored agents. Anomalies are also published as AGENT\_SESSION\_ANOMALY findings in Security Command Center if enabled.

**Tags:** [Agent Anomaly Detection](https://yomu.fyi/topic/agent-anomaly-detection), [Agents](https://yomu.fyi/topic/agents), [Gemini](https://yomu.fyi/topic/gemini), [Google Cloud](https://yomu.fyi/topic/gcp), [Security](https://yomu.fyi/topic/security)

- Source: [Google](https://developers.googleblog.com/securing-your-agents-a-hands-on-guide-to-agent-anomaly-detection)
- Source URL: https://developers.googleblog.com/securing-your-agents-a-hands-on-guide-to-agent-anomaly-detection
- Ingested by Yomu: 2026-11-16T21:00:17.923Z

[Read original post](https://developers.googleblog.com/securing-your-agents-a-hands-on-guide-to-agent-anomaly-detection)
