Chat about this article with your favourite AI tool
Google Cloud’s forward deployed engineering team has published a guide to keeping consumer-facing AI agents brand-safe after launch. It centres on a three-tier sampling system that decides which conversations humans should review, plus a companion notebook on GitHub.
The authors, Casey Justus and Defne Yazicioglu, said they build and launch customer-facing agents with enterprise clients and keep running into the same problems across industries. Their advice comes down to three points: agree on priority risks at the start of a project, accept that safety controls have limits, and plan for the delay each safety layer adds.

Layers for the predictable, monitoring for the rest
Google Cloud said effective protection combines several layers. Programmatic checks are fast and deterministic, catching known attacks and obvious policy violations. Generative logic handles nuance, domain-specific limits and structured output for each application. Customizable controls, such as fine-tuned classifiers and human review, cover specific operational risks.
The team said deterministic controls enforce explicit rules, while instruction-based controls only lower the probability of failure, so guardrails should be paired with an incident response plan. Because every safety layer sits on the request path, classifiers and filters also need to be sized for traffic spikes.
Three-tier stratified sampling
Reviewing every interaction is impractical at enterprise scale, and simple random sampling wastes reviewers’ time on routine chats. Google Cloud proposes sorting traffic into tiers based on automated risk signals, each with its own review rate:
- Tier 1 (critical): Model Armor flags and jailbreak attempts, reviewed at 100%.
- Tier 2 (nuanced): “sensitive” flags from a small classifier or low sentiment scores, reviewed at 50% to assess safe but off-brand responses.
- Tier 3 (baseline): no triggers and high quality scores, sampled at 1–5% to surface unknown weaknesses and drift.
Finding outliers with embeddings
To catch rare edge cases, the engineers suggest mapping user queries into an embedding space and grouping them with unsupervised clustering such as K-Means. The clusters set baseline behaviour for validated use cases.
Each new interaction is then scored by cosine distance and local outlier factor against those baselines. Anything beyond three standard deviations goes straight to Tier 1 for full review.
Sizing the human review
For Tier 3, the guide gives a formula for how many reviews are needed. If p is the smallest failure rate a team wants to detect and n is the sample size, the chance of catching at least one failure is 1 − (1 − p)ⁿ.
At 95% confidence, Google Cloud’s examples are:
- 0.1% risk appetite: about 3,000 reviews, suited to high-stakes, public-facing agents.
- 0.5%: about 600 reviews, a standard operational posture.
- 1.0%: about 300 reviews, for moderated content environments.
- 5.0%: about 60 reviews, for internal or low-impact chatbots.
The team added that a 95% confidence interval on the observed failure rate can drive automated drift alerts when the upper bound crosses a set threshold.
Closing the feedback loop
Google Cloud describes two checkpoints. Before deployment, prompt changes and model updates in CI/CD are tested against a golden dataset using adaptive rubrics, safety and grounding rubrics, and computation-based metrics. After deployment, online monitors score sampled production interactions and send alerts to Cloud Monitoring when quality or safety metrics fall.
Confirmed anomalies are added to the golden dataset, so production incidents become regression tests for later releases.
Getting started
“Passing pre-launch testing is the starting line, not the finish line,” the authors wrote. They point developers to a three-tier anomaly detection notebook on GitHub that uses Vector Search and Gemini to build brand-safe baselines, set thresholds and route confirmed threats to human review.
The company also recommends its documentation on agent evaluation and continuous evaluation with online monitors, and suggests setting up Model Armor and aligning with Google’s Secure AI Framework (SAIF).
Source: Google Cloud Blog

