Back to Hub
Certification Study Notes

Agent Platform: Identity, Security & Governance

How to secure and govern agents on Gemini Enterprise Agent Platform. Topics: who the agent is (Agent Identity), how it authenticates to tools (auth manager, Secret Manager), what it may reach (IAM, Principal Access Boundary), where its traffic is enforced (Agent Gateway + Agent Registry), what content it may see or emit (Model Armor, Sensitive Data Protection, Gemini safety filters), how its network and data are isolated (VPC-SC, PSC, CMEK, residency), how it's audited (Cloud Audit Logs, SCC AI Protection), and when a human must approve (HITL).

Author: Michaël Bettan
Track: Google Cloud / Professional Agentic Architect
Test Yourself: Agent Platform Security Practice Quiz →

Companion guides

This guide covers only security and governance. Build/runtime/retrieval/evaluation are in Agent Platform. Vendor-neutral guardrail concepts are in Responsible AI (stakes & HITL, governance lifecycle). ADK-level controls are in ADK callbacks & guardrails, HITL and sandboxing. Protocols are in MCP and A2A. Operations are in AgentOps.

Launch-stage warning

Several controls here are Preview or Experimental (see the status table in §00). Preview features may change and have limited support. Re-check the docs before relying on a status.

00

Overview & Mental Model

The four governance components

ComponentAnswersProduct
IdentityWho is acting?Agent Identity (SPIFFE-based per-agent principal), or service accounts (legacy/default)
RegistryWhat destinations exist and are approved?Agent Registry (agents, MCP servers/tools, endpoints, skills)
PoliciesWhat actions are allowed?IAM allow/deny, Principal Access Boundary (PAB), Unified Access Policies on the gateway, Semantic Governance
GatewayWhere is it enforced?Agent Gateway (Client-to-Agent ingress, Agent-to-Anywhere egress)

Content controls (Model Armor, SDP, Gemini safety filters), network/data controls (VPC-SC, PSC, CMEK, residency), detection (Audit Logs, SCC) and humans (HITL) sit on top of these four as defense in depth.

"Which control prevents X?" (master decision table)

Threat / requirementPrimary controlWhy not the others
Shared service-account key leaked; you need per-agent, non-impersonable credentialsAgent IdentityService accounts are shared by default and can be impersonated
Stolen agent access token replayed from another machineAgent Identity (certificate-bound tokens + default Context-Aware Access: mTLS + DPoP)IAM roles don't stop replay of a valid token
Agent must act on a user's Jira/GitHub data with that user's consentAuth manager, 3-legged OAuth (user-delegated)An API key or the agent's own identity would act with the agent's authority, not the user's
API key hard-coded in agent sourceSecret Manager (secret env var or ADK SecretManagerClient) + secretAccessor for the agentEnv-var plaintext and code are both visible to anyone who can read the deployment
Agent can reach any project in the org despite narrow intentPrincipal Access Boundary (boundary on eligible resources)Allow policies only grant; PAB caps eligibility no matter what roles exist
A broad role must never include one dangerous permissionIAM deny policyPAB limits resources, not specific permissions
Agent may call MCP tool get_order but not delete_orderUnified Access Policy on Agent Gateway (CEL on tool.name / destructive_hint)IAM on the Google Cloud API can't see MCP tool names
Agent calls an unregistered external hostAgent Gateway + Agent Registry (default-deny egress; UAP on destination.unregistered.*)Model Armor screens content, not destinations
An email in context instructs the agent to forward mail to an attacker (indirect injection → rogue tool call)Semantic Governance (intent alignment) + Model Armor prompt-injection filterUAP sees an allowed tool name and can't judge intent
Refund over a business limit (e.g., >$75) must never auto-executeSemantic Governance natural-language constraint, or deterministic check + HITL tool confirmationModel Armor has no business rules
Jailbreak / prompt injection / malicious URL in user inputModel Armor (input template)Gemini safety filters only cover harm categories
Every team's Model Armor templates must keep prompt-injection detection on, whatever each team configuresModel Armor floor settings at org or folder level (template conformance)A template protects only the workload that references it
Credit-card numbers leak in responsesModel Armor SDP filter (advanced mode with de-identify template) / Sensitive Data ProtectionSafety filters don't detect custom infoTypes
Hateful output from the modelGemini safety filters (model level) and/or Model Armor RAI filter (model-agnostic)—
Data exfiltration from Google APIs to an outside projectVPC Service Controls perimeterIAM alone can't stop a legitimately authorized identity copying data out
Agent must reach on-prem/private VPC servicesPSC interface (network attachment)Agent Runtime can't reach your private VPC/on-prem by default (Google-managed tenant)
Regulator requires customer-controlled keysCMEK (encryption_spec, same-region key)Google default encryption isn't customer-controlled
Data and ML processing must stay in the EUData residency: EU multi-region/regional endpoint; block the global endpointThe global endpoint has no residency guarantee
"Who changed the agent's IAM?"Cloud Audit Logs (Admin Activity, always on)Data Access logs must be enabled explicitly
Detect anomalous grants to agent identities / over-privileged agentsSCC AI Protection + Event Threat DetectionAudit logs record but don't alert
Irreversible, high-stakes action needs sign-offHITL: ADK tool confirmation (require_confirmation)Automated filters can be wrong; accountability needs a human
Hundreds of unknown agents/tools across teams (agent sprawl)Agent Registry (central catalog) + gateway default-deny + org policyAd-hoc spreadsheets aren't enforced

Launch-stage status (as documented, 2026-10)

CapabilityStatusNote
Agent IdentityGA (since 2026-04-22)Falls back to service accounts if not enabled
Agent Identity auth managerGA (since 2026-08-22, with the agentidentity / agentidentitycredentials APIs)Older IAM Connectors API stays Preview and will not reach GA
Agent GatewayGA for Agent Runtime + Gemini Enterprise (GE: egress only)GKE, Cloud Run, cross-cloud: coming soon / early preview
Agent RegistryGA (verify); standalone skills in Registry = Preview—
Skill RegistryPreview—
Semantic Governance policiesPreview—
Token-management policies, extension bindingsComing soon—
Agent Platform Threat Detection (SCC)Preview, Premium tier—
ADK tool confirmation (HITL)Experimental—
Model Armor image screening, template modality selection, exclusion rulesPreviewText and document screening carry no Preview label
Model Armor floor settings for Google Cloud MCP serversPreviewLabeled Preview on the floor settings page
Model Armor spans in Cloud TracePreviewSpan attribute names may change
Agent Gateway Cloud Trace integrationPreviewGateway request logs and the Observability dashboard carry no Preview label
Model Armor insights (Agent Platform Security tab)PreviewNeeds tracing set up for the agent
Agent Anomaly DetectionPreview, allowlisted users onlyFindings go to SCC (Standard, Premium or Enterprise)

Exam trap

"Preview" isn't a reason to reject a control in a design question, but you must know which features are not GA. Some security controls (e.g., CMEK/VPC-SC support) aren't available for preview models.

01

Agent Identity Model

Three ways an agent proves who it is

OptionWhat it isStrengthsWeaknesses
Default service agentAI Platform Reasoning Engine Service Agent service-PROJECT_NUMBER@gcp-sa-aiplatform-re.iam.gserviceaccount.com (roles/aiplatform.reasoningEngineServiceAgent)Zero setupShared by every agent in the project, so no per-agent least privilege
Custom service accountYou attach your own SAPer-workload roles possibleCan be shared and impersonated; key-management risk
Agent Identity (GA)Per-agent, SPIFFE-based, strongly attested principal tied to the agent's lifecycle and resource URINot shared, can't be impersonated, no long-lived keys; tokens bound to the agent's X.509 cert (24h, auto-rotated); Context-Aware Access enforces mTLS + DPoP by defaultGA since 2026-04-22; new principal on every redeploy (see traps)
Workload Identity Federation (WIF)Federates external/other-cloud workloads to Google Cloud without keysUsed by Agent Gateway / auth manager for cross-cloud and external identity exchangeNot an agent-native identity

Agent Identity is supported on Agent Runtime, Gemini Enterprise, and Cloud Run.

Principal formats

  • SPIFFE ID: spiffe://agents.global.org-ORG_ID.system.id.goog/resources/aiplatform/projects/PROJECT_NUMBER/locations/LOCATION/reasoningEngines/AGENT_ID
  • Single agent (IAM): principal://agents.global.org-ORG_ID.system.id.goog/resources/aiplatform/projects/PROJECT_NUMBER/locations/LOCATION/reasoningEngines/AGENT_ID
  • All agents in a project: principalSet://agents.global.org-ORG_ID.system.id.goog/attribute.platformContainer/aiplatform/projects/PROJECT_NUMBER
  • All agents in the org: principalSet://…/attribute.platform/aiplatform

Enabling it

  • SDK (api_version="v1beta1"): client.runtimes.create(config={"identity_type": types.IdentityType.AGENT_IDENTITY, ...}). You can create the identity before deploying code so you can set up IAM first, then add code with client.runtimes.update(...).
  • CLI: agents-cli deploy --agent-identity; for adk deploy, set it in .agent_engine_config.json.
  • If the setting is absent, the agent runs as a service account.
  • Default roles granted to the identity: roles/aiplatform.agentContextEditor, roles/aiplatform.agentDefaultAccess.
  • Typical extra roles: roles/aiplatform.expressUser, roles/serviceusage.serviceUsageConsumer, roles/browser, roles/secretmanager.secretAccessor.

Lifecycle and CI/CD traps

TrapConsequenceFix
Agent redeployed (new resource ID)New principal, so old bindings don't applyAfter deploy, read spec.effectiveIdentity; put baseline roles on the project principalSet, which survives redeploys
Agent deletedIAM bindings remain (orphaned)Remove bindings as part of teardown
Granting legacy Cloud Storage bucket rolesNot supported for agent identitiesUse the IAM predefined roles
Parent agent delegates to a subagent (A2A)Parent needs discovery + invoke rightsGrant the parent's agent identity roles/agentregistry.viewer and roles/aiplatform.user on the subagent; don't grant them to the user

Exam trap

"Use a service account key stored in the container" is never the answer. Prefer Agent Identity, or an attached SA with no exported keys.

02

Tool Authentication & Secrets

Two authorities

ModelAgent acts as…MechanismUse when
User-delegatedthe end user (with consent)3-legged OAuth via the auth managerPer-user data in SaaS (Jira, GitHub, Salesforce, ServiceNow, Workspace)
Agent's own authorityitselfAgent Identity → Google Cloud APIs; OIDC ID tokens → external services (federation); 2-legged OAuth (machine-to-machine); API key; HTTP basic (not recommended)Shared back-end services, batch jobs, service-to-service calls

Audit logs record both the agent and the user when the agent acts on a user's behalf, and only the agent when it acts on its own authority.

Identities in one agent call

IdentityWhat it representsWhere it comes fromTypical use
End userThe person typing the promptCloud Identity or an external IdP through Workforce Identity FederationCarries the user's own data entitlements (document sharing, row-level rules)
Agent IdentityOne deployed agentProvisioned by Agent Runtime, Gemini Enterprise or Cloud Run; SPIFFE ID with a certificate-bound credentialCalls Google Cloud APIs and the gateway as the agent; is granted roles/agentidentity.user on the auth providers it may use
Service accountA workload, not a specific agentAttached by you, or the default Reasoning Engine service agentFallback when Agent Identity is off; also the runtime identity of a self-hosted MCP server (e.g., on Cloud Run)
OAuth client in an auth providerThe registered app at a third-party service (Jira, Salesforce, GitHub)Client ID and secret stored in an auth manager auth providerThe "application" side of 2LO and 3LO flows

Agent Identity auth manager

  • A centralized credential vault and auth broker. "Auth providers" hold API keys, OAuth client IDs/secrets and delegated user tokens.
  • Automates the OAuth dance: consent, code exchange, token refresh.
  • ADK integration injects Authorization / X-Goog-Api-Key headers into tool and MCP calls, so the credentials never live in agent code.
  • Access to auth providers is governed by IAM using the agent's SPIFFE identity. User grants can be viewed and revoked.
  • With Agent Gateway + Gemini Enterprise, end-user credentials are encrypted by the auth manager and decrypted at the gateway, so the agent never sees the raw credential.
  • Constraint: some providers (e.g., GitHub, Microsoft) support only a single scope.
  • API migration: auth providers were first exposed through the IAM Connectors API (iamconnectors.googleapis.com, Preview), which will not reach GA. Use the Agent Identity API (agentidentity.googleapis.com; credential calls on agentidentitycredentials.googleapis.com), where resources are named authProviders/ instead of connectors/. Both run side by side during migration.

Secret Manager

  • Agent Runtime secret env vars: env_vars={"API_KEY": {"secret": "SECRET_ID", "version": "latest"}}. Only same-project secrets can be referenced.
  • Grant roles/secretmanager.secretAccessor to the agent identity. When secrets are injected as env vars at deploy time, also grant it to the Agent Platform service agent.
  • ADK SecretManagerClient fetches secrets at runtime, so a rotated secret takes effect without a redeploy or restart.

OAuth patterns and token lifecycle

PatternWho consentsWhat the auth manager storesRefreshUse when
3-legged OAuth (authorization code + user consent)The end user, once per provider, via a consent page reached from the chat UI; the app supplies a continue_uri to return toThe user's resulting OAuth tokens in a Google-managed vaultHandled by the auth managerPer-user SaaS data; the downstream service enforces that user's permissions
2-legged OAuth (client credentials)No user; the agent's identity is authorized to use the providerThe OAuth client ID and secret (Google-managed storage)Handled by the auth managerMachine-to-machine calls on the agent's own authority
API keyNo userThe keyNot applicable; rotate the keyServices without OAuth
Token exchange (RFC 8693)No new consent; an existing credential is swapped for anotherNot an auth manager provider typeShort-lived resultsWorkload Identity Federation: the Security Token Service swaps an external OIDC/SAML or Kubernetes credential for a Google credential. Agent Gateway cross-cloud mode (early preview) uses WIF to swap Kubernetes workload credentials for Agent Identity credentials

Credential flows compared

FlowPrincipal the destination seesUser consentConfused-deputy resistanceCredential lifecycle
Agent's own identityThe deployed agent (principal://agents.global…)NoneLimited: one authority serves every user. Bound tokens stop replay, not misuse, so pair with PAB, UAP and HITLGoogle-issued, certificate-bound, rotated automatically
2LOThe OAuth client registered at the providerNoneLow: the same app privilege answers every user's requestClient ID and secret held by the auth manager; access tokens minted and refreshed for you
3LOThe end userOnce per provider; revocableHigh: the destination applies that user's own permissionsPer-user tokens vaulted and refreshed by the auth manager
API keyWhoever holds the keyNoneLowest: no caller identity at allStatic; kept in the auth manager or Secret Manager; rotate it yourself

Decision rule

Per-user consent → 3LO through the auth manager. Static third-party key → Secret Manager (or an auth-manager API-key provider). Google Cloud API → the agent's own identity with least-privilege IAM. Never put secrets in code, prompts or plaintext env vars.

Identity propagation, hop by hop

Each hop checks a different credential against a different policy. Access to the data succeeds only when every hop allows it.

01

User → front end

User sign-in session (Cloud Identity or federated IdP), checked by Gemini Enterprise or the front end: may this user use the app and agent?

02

Front end → agent

Caller identity plus the user's context, checked by Agent Runtime: IAM permission to query the agent (e.g., roles/aiplatform.user) and ingress gateway policies if Client-to-Agent is enabled.

03

Agent → Agent Gateway

Agent Identity credential (mTLS + DPoP) plus the injected tool credential. REQUEST_AUTHZ (IAP: UAP, PAB) runs first, then CONTENT_AUTHZ (Model Armor, Semantic Governance).

04

Gateway → tool or MCP server

The destination's credential (3LO token, 2LO token, API key or the agent's Google token), checked by destination IAM, e.g., roles/iap.httpsResourceAccessor for an IAP-protected Cloud Run server or roles/mcp.toolUser for Google remote MCP, plus OAuth scopes.

05

Tool → data source

The user's delegated token, the agent's identity, or the MCP server's own service account, checked by source IAM and ACLs (row/column rules, document sharing) and the VPC-SC perimeter.

Example: on first use the auth manager redirects the user to Jira for consent and vaults the token; the agent then sends tools/call with its Agent Identity and that token through the gateway, the MCP server forwards the user token, and Jira returns only that user's records, which Model Armor screens on the way back.

Exam trap

If the MCP server queries the data source with its own broad service account, the user's identity stops at the server and the source can no longer filter by user. Propagate the user token (3LO) to the last hop when results must be user-specific.

03

Access Boundaries: IAM, Deny & PAB

Policy types compared

PolicyEffectGranularityAnswers
IAM allow policyGrants rolesResource + role (+ condition)"What may this principal do?"
IAM deny policyDenies specific permissions; overrides allowPermission-level"What must it never do, whatever its roles?"
Principal Access Boundary (PAB)Limits which resources a principal is eligible to accessOrg/folder/project (up to 500 resources per policy, effect ALLOW only)"Where can it ever operate?"
Unified Access Policy (gateway)Allow/deny on agent traffic through Agent GatewayMCP tool, agent, endpoint, unregistered host/path/method"Which tools and destinations?"

Least privilege for agents

01

Own identity

Give each agent its own identity (Agent Identity), not the shared default service agent.

02

Narrow roles

Grant specific predefined roles on specific resources. Avoid Owner/Editor. Put baseline roles on the project principalSet; per-agent extras on the agent's principal://.

03

Deny + boundary

Add deny policies for permissions that must never be used (e.g., IAM admin). Bind a PAB policy to the agents' principal set so they can't reach resources outside approved projects, even if someone over-grants.

04

Tool-level at gateway

Govern tool-level access at the gateway (UAP) because Google Cloud IAM can't see MCP tool names.

PAB specifics

Effective access and CEL conditions

Identity failure scenarios

FailureHow it happensControls that prevent it
Confused deputyThe agent holds one strong credential (2LO token or broad service account) and a user's prompt steers it to read or change records that user can't access3LO so the source checks the requesting user; UAP deny on destructive_hint == true; Semantic Governance intent check; HITL confirmation for writes
Token leakage in prompts, logs or tracesA token or key is placed in the prompt, returned in tool output, or captured in logs and spans, then replayedAuth manager header injection (credentials never in code or prompts); gateway-side decryption of end-user credentials with Gemini Enterprise; Model Armor SDP filter on prompts and responses; certificate-bound Agent Identity tokens that fail when replayed elsewhere; SCC finding Agentic Identity Credential Used Outside of Google Cloud
Over-privileged service accountEvery agent in a project runs as the default service agent or one shared SA with roles/editor, so one hijacked agent reaches everythingPer-agent Agent Identity; PAB on the agents' principalSet; deny policies for admin permissions; per-provider roles/agentidentity.user; SCC over-privileged agent detection

Exam trap

PAB doesn't grant anything. A principal needs an allow-policy role and must be inside its boundary and must not be denied.

04

Agent Registry, Skill Registry & Agent Gateway

Agent Registry

  • A central catalog for agents, MCP servers and tools, endpoints, and standalone skills (skills: Preview).
  • Automatic registration covers supported workloads in the governance project, including Google Cloud remote MCP servers (https://<service>.googleapis.com/mcp, enabled with the service API and requiring roles/mcp.toolUser / mcp.tools.call plus service IAM roles). Manual registration uses Service resources for remote, custom (e.g., MCP Toolbox for Databases or third-party SaaS connectors on Cloud Run/GKE), or cross-project components (gcloud agent-registry mcp-servers list).
  • Governance-project model: single-project or cross-project.
  • Agent Gateway queries the registry before routing, and policies reference registry identifiers (urn:agent: identifiers are for inventory, not for IAM bindings).
  • Limit: up to 5,000 Agent Registry resources per gateway.
  • Purpose: fight agent sprawl, fragmented tool access and redundant integrations.

Skill Registry (Preview)

  • A secure, private, low-latency repository of skills (instructions + code + docs) that agents discover and load on demand.
  • Includes a built-in gcp-skill-registry skill. Semantic Governance can constrain which skills an agent loads.

Agent Gateway

PathDirectionTypical controls
Client-to-AgentIngress (users/apps → agent)mTLS termination, IAP access policy, Model Armor screening of ADK streamQuery
Agent-to-AnywhereEgress (agent → tools, agents, LLMs, APIs)UAPs, PAB, Semantic Governance, Model Armor on MCP tools/call, A2A messages and OpenAI-compatible payloads

Limitations

Gemini Enterprise supports only Agent-to-Anywhere (egress); Client-to-Agent is for Agent Runtime. Ingress governs query/streamQuery only. All agents in the same project + region bind to the same egress/ingress gateway. SCC Agent Engine Threat Detection isn't available while a gateway is enabled. VPC-SC works with Agent Gateway when the agent uses VPC connectivity (route all egress through your VPC, restricted VIP).

05

Gateway Policies: UAP & Semantic Governance

Unified Access Policies (IAM v3)

  • Bound to the project that holds the gateway; enforced by IAP. The permission involved is iap.googleapis.com/resources.egressViaIAP.
  • Default-deny: nothing passes unless an allow rule matches. Rules can mix allow and deny effects; deny overrides allow.
  • CEL conditions on attributes such as destination.agent_registry.mcp_server.tool.name, …tool.annotations.read_only_hint / destructive_hint, and destination.unregistered.host, .path, .method.
  • Rollout: set iamEnforcementMode: "DRY_RUN" in the IAP authorization extension metadata so IAP logs would-be denials to Cloud Audit Logs without blocking. Remove the field to start enforcing (see Audit and detection).
  • Best practices: dry-run first; name specific tools (no wildcards); use deny rules as guardrails (e.g., deny destructive_hint == true); audit regularly.

Semantic Governance (Preview)

  • Natural-language constraints evaluated by an LLM policy engine running in your VPC.
  • Intercepts each proposed tool call and runs two checks: (1) alignment with user intent (on by default): does this call serve what the user asked? (2) business-constraint compliance: e.g., "refunds may not exceed $75".
  • Verdict: ALLOW or DENY with a rationale. A custom denial message (≤1,000 chars) can replace the rationale.
  • Mitigates context poisoning / indirect prompt injection and rogue actions. Can also govern which skills load.
  • Complements IAM and UAP; doesn't replace them. Verdicts are probabilistic and can be wrong, so keep deterministic controls for hard limits.
  • Enforcement order: gateway policies run as Service Extensions authorization extensions. REQUEST_AUTHZ extensions see only headers (IAP evaluates identity and UAPs). CONTENT_AUTHZ extensions see full request and response bodies (Model Armor, Semantic Governance). A custom engine can use either profile.
NeedUse
Hard allow/deny by tool name, host, methodUAP (deterministic)
"Does this action match what the user wanted?"Semantic Governance
Business rule expressible in natural languageSemantic Governance (backed by a deterministic check for critical limits)
Custom authorization logicService Extensions custom authorization engine

MCP risks mapped to controls

RiskAttackControls
Tool poisoning / rug pullA tool description, or a server update after approval, carries hidden instructions the model followsRegister only vetted servers in Agent Registry; gateway default-deny for unregistered destinations; UAP names each allowed tool. Model Armor on the gateway doesn't screen tools/list, so review tool metadata at registration
Over-broad scopesAn auth provider or role grants far more than the tool needs, so any misuse has a large blast radiusRequest minimal OAuth scopes per provider; grant roles/agentidentity.user only on the providers each agent needs; UAP allow on read_only_hint; PAB
Indirect prompt injection via tool outputA ticket, email or web page returned by a tool contains instructions that steer the next tool callModel Armor (CONTENT_AUTHZ) screens tools/call responses; Semantic Governance blocks calls that don't match the user's request. Streamable HTTP/SSE streams aren't screened
Data exfiltrationThe agent is steered to send sensitive results to an attacker-controlled host or toolGateway default-deny plus UAP on destination.unregistered.host; Model Armor SDP on outbound arguments; VPC-SC with egress through your VPC
06

Content Safety: Model Armor, SDP & Safety Filters

Model Armor

FilterDetectsNotes
Responsible AIHate, harassment, sexually explicit, dangerous (CSAM always on)Confidence: HIGH, MEDIUM_AND_ABOVE, LOW_AND_ABOVE. The floor settings console defaults to Medium and above when left blank
Prompt injection & jailbreakAttempts to override instructions, in prompts and in responsesInputs under 3 words return NO_MATCH_FOUND. In a floor setting update that omits the level, it defaults to LOW_AND_ABOVE
Sensitive Data ProtectionBasic: six fixed infoTypes (credit card, US SSN, financial account, US ITIN, Google Cloud credentials, Google Cloud API key), inspect only, no SDP templates. Advanced: an SDP inspect template plus an optional de-identify templateRedaction needs advanced mode. Only infoTypes named in both templates are de-identified. SDP templates in another project need roles/dlp.user and roles/dlp.reader for the Model Armor service agent. Uses SDP match likelihood, not the confidence enum
Malicious URL detectionPhishing/malware linksOnly the first 256 URLs in a payload are screened
Document screeningText in PDF, CSV, TXT, Word, PowerPoint and Excel filesFiles over 4 MB are skipped; files under 69 bytes are rejected. Direct API or the Gemini Enterprise integration only; other integrations scan text
Image screening (Preview)Text in images (OCR); visual content through the advanced SDP filterJPEG, PNG, BMP; one image per request, 4 MB max; us and eu multi-regions only

Model Armor on Agent Gateway

Model Armor floor settings vs. templates

Floor settings solve for: dozens of teams writing their own templates, where one team quietly switching off a detector reopens a hole the security team closed.

DimensionFloor settingsTemplates
PurposeMinimum baseline (template conformance) and, at project level, inline enforcement on Gemini and Google Cloud MCP serversThe filter set and enforcement type for one workload or integration point
Who managesCentral security teamApplication or platform team
IAM roleroles/modelarmor.floorSettingsAdmin (Model Armor Floor Setting Admin)roles/modelarmor.admin on the project that holds the template
Scope and resourceorganizations/ORG_ID, folders/FOLDER_ID or projects/PROJECT_ID, always at locations/global/floorSettingA regional resource, projects/PROJECT_ID/locations/LOCATION/templates/TEMPLATE_ID
How it is setConsole at project level only (inherit, custom or disable). Org and folder need the API, gcloud or Terraform google_model_armor_floorsettingConsole, gcloud, REST or client libraries
InheritanceOrg applies to everything below; folder to its projects; project to itself. On conflict the lower level wins (project over folder)Not inherited; referenced explicitly
Enforced byThe Model Armor API at template create/update; inline on Gemini generateContent and Google Cloud MCP trafficCallers of sanitize*, Agent Gateway, Gemini Enterprise, Agent Runtime, Service Extensions, Apigee
Enforcement typeSet per integrated service (Agent Platform, Google MCP server)enforcement_type in template_metadata
Effect takes holdA few minutes after a changeOn next request

Exam trap

"Lower level wins" cuts both ways. A project admin holding roles/modelarmor.floorSettingsAdmin can choose Disable and drop the inherited floor for that project (API flag enableFloorSettingEnforcement=false). Grant the role at org or folder level to the central team only, and restrict it at project level.

Inline protection for Gemini and Google Cloud MCP servers

Project floor settings can screen traffic with no code change by picking integrated services:

Integrated serviceWhat is screenedKey behaviors
Agent Platform (Gemini)Gemini API generateContent prompts and responses in the project, including calls through the Google Gen AI SDK or Firebase AI LogicGrant roles/modelarmor.user to service-PROJECT_NUMBER@gcp-sa-aiplatform.iam.gserviceaccount.com. A request can name its own promptTemplateName / responseTemplateName instead. No documents or images. De-identified text is not returned to Gemini; an SDP match under INSPECT_AND_BLOCK becomes a block. Floor settings use the Stable filter version
Google MCP server (Preview)tools/call, prompts/get and tool-execution errors on supported Google and Google Cloud remote MCP serversUnsupported servers aren't covered. Uses filter version v1, which you can't override. If the agent and the MCP server sit in different projects, each project's floor runs, so Model Armor is called twice
Template creation & updateTemplate conformance onlyRejects weaker templates; no traffic screening

Rollout: inspect only, then block

ModeDetectionTrafficUse for
INSPECT_ONLYLogged to Cloud LoggingPasses unchangedMeasuring false positives, monitoring new attack patterns, compliance evidence
INSPECT_AND_BLOCKLoggedThe caller (the enforcement point) blocks the prompt or response; redaction applies where the integration supports itProduction protection
01

Enable logging first

INSPECT_ONLY produces nothing useful without Cloud Logging.

02

Start conservative

Separate input and output templates; RAI at HIGH; prompt injection at HIGH or MEDIUM_AND_ABOVE (HIGH for Gemini Enterprise to avoid false positives).

03

Replay known traffic

Run known-good and known-bad prompts and record the false-positive baseline.

04

Read the verdicts in logs

Check SanitizeOperationLogEntry records; a model refusal in the response body is not a Model Armor block.

05

Switch to block

Move to INSPECT_AND_BLOCK; lower a threshold only for the one category that is under-protected.

Anti-pattern

Turning on LOW_AND_ABOVE across all RAI categories on day one. The docs flag it as high false-positive risk for general content; reserve it for categories where a miss costs more than a wrong block.

Model Armor logging, traces and findings

SignalDefaultContentsNotes
ProcessingStatelessPrompts and responses handled in memory and discardedNothing is retained unless you enable logging
Template loggingOfflog_template_operations (template CRUD); log_sanitize_operations (full prompt and response text plus verdicts)Sanitize logs hold raw user data; route them to an access-controlled sink. Anyone with roles/logging.privateLogViewer can read them
Floor setting loggingConsole: on for Agent Platform, off for MCP--enable-vertex-ai-cloud-logging, --enable-google-mcp-server-cloud-loggingDetection logs land under modelarmor.googleapis.com/detection. With residency needs, create a regional log sink before enabling
Audit logsAdmin Activity onTemplate and floor setting changesSee Audit and detection
Cloud Trace (Preview)When tracing is set up for the agentParent span apply_guardrail "Google Cloud Model Armor" with Request Path and Response Path children; attributes include gen_ai.security.decision.type (modify means redacted), gen_ai.security.policy.id, gcp.modelarmor.violations, gcp.modelarmor.sdp.info_typesViewed from Agent Registry (agent, Traces tab) or Trace explorer; needs roles/cloudtrace.user and roles/logging.viewer. Separates guardrail latency and blocks from model errors
SCC findingsPremium or Enterprise tierHigh-severity floor setting violationsComplements the AI Protection view in Audit and detection

Model Armor configuration patterns

PatternFloor settingsTemplateOutcome
Org baseline, team redactionOrg: prompt injection and malicious URL enabled, RAI minimumsPayments agent: input and output templates with advanced SDP (inspect + de-identify), INSPECT_AND_BLOCK, bound to Agent Gateway in the gateway's regionNo team can drop below the baseline; card numbers are masked on gateway traffic
Staged tighteningStaging project: custom floor with the tighter thresholds, Agent Platform service set to Inspect only (inline inspection is configured per project, not per folder)Existing templates unchangedLogged would-be blocks show false-positive rates before production moves to block
Zero-code MCP guardProject: Google MCP server service, malicious URI and RAI dangerous at MEDIUM_AND_ABOVE, logging onNone requiredCalls to supported Google Cloud MCP servers are screened even if a developer attaches no template
Gemini Enterprise assistantOptionalTemplate bound to the Gemini Enterprise appViolating turns are blocked; SDP hits block rather than mask, since this integration doesn't de-identify

Sensitive Data Protection (formerly DLP)

  • infoType detection, inspection and de-identification (masking, tokenization) via templates.
  • Use it inside Model Armor (advanced mode) for agent traffic, or directly to scan and de-identify data before it reaches a corpus or memory.

Gemini safety filters (model level)

  • Non-configurable filters (e.g., CSAM, PII) always apply.
  • Configurable harm categories: harassment, hate speech, sexually explicit, dangerous content.
  • Thresholds: BLOCK_LOW_AND_ABOVE, BLOCK_MEDIUM_AND_ABOVE, BLOCK_ONLY_HIGH, BLOCK_NONE, OFF. Method: SEVERITY (default) or PROBABILITY.
  • Per the docs, newer Gemini models default to OFF for configurable filters (verify for your model version).

SDP de-identification methods compared

MethodSDP configReversibleReferential integrityFormat keptKeyBest agent use
Replace with infoTypeReplaceWithInfoTypeConfigNoNo: every email becomes the same [EMAIL_ADDRESS] labelNoNoneFree text bound for RAG chunks, logs and prompts where who-is-who doesn't matter
RedactionRedactConfigNoNoNoNoneDropping a value entirely; the model loses even the hint that something was there
Character maskingCharacterMaskConfigNoNoLength kept; chosen characters stay visibleNoneSupport agents confirming the last digits of a card or account
Crypto hashCryptoHashConfigNoYesNo (fixed-length hashed surrogate)YesStable join keys when nobody may ever re-identify
Deterministic tokenizationCryptoDeterministicConfig (AES-SIV, optional surrogate infoType)Yes, via content.reidentify with the same keyYesNo; any input acceptedYesMulti-turn, multi-tool flows that must keep customer A and customer B apart; an authorized back end re-identifies
Format-preserving encryptionCryptoReplaceFfxFpeConfig (FFX mode)YesYesSame length and alphabet (2 to 95 characters)YesA tool or legacy schema validates length or character set
Date shiftingDateShiftConfigNoSame shift per context (e.g., per patient), so sequence and duration holdStill a valid dateOptional, for consistent shiftsClinical or financial timelines where intervals matter

De-identify at the data layer

Once raw values are embedded, stored in sessions or copied into telemetry, finding and deleting them is slow and incomplete. Clean data before each storage boundary:

BoundaryRisk if raw data landsControlConstraints
Before indexing (RAG Engine, Agent Search, vector stores)Retrieval can surface embedded PII to anyone allowed to query the corpusLand files in a quarantine bucket; run an SDP inspection job with a de-identify action (console: Make a de-identified copy) that writes to a clean bucket; index only the clean bucketOutput bucket must differ from the input bucket; CSV, TSV, text and image file groups
Gemini Enterprise connectors and uploadsSensitive entities from SaaS sources appear in answers; sensitive files get uploadedSDP content policy (projects/PROJECT_ID/locations/LOCATION/contentPolicies/POLICY_ID) set on the connector, the assistant or Gemini Notebook EnterpriseBlocks content rather than masking it. Covers third-party, custom MCP and Workspace connectors, not older Cloud Storage, BigQuery or website data stores. Not in the Business edition. The Gemini Enterprise service account needs roles/dlp.user; a policy from another project must sit in the same VPC-SC perimeter
Before session and Memory Bank writesA pasted SSN stays in session events and can be distilled into a long-lived memoryDe-identify upstream (Model Armor advanced SDP de-identify on the gateway, or in the front end) so the raw value never becomes an event. ADK before_model_callback / after_tool_callback can also scrub what the model sees and what tools returnUse deterministic tokens when the agent still has to tell entities apart
Before log and trace exportPrompts, tool arguments and responses copied into spans, logs, prompt archives in Cloud Storage and BigQueryADK_CAPTURE_MESSAGE_CONTENT_IN_SPANS=false keeps PII out of span attributes. OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=EVENT_ONLY still records prompts, as log events, so restrict and de-identify those logs and the prompt and response bucket before analysts query themModel Armor sanitize logs also hold raw text (see the logging table above)

Anti-pattern

Prompt-only privacy: a system instruction such as "never repeat card numbers" is not a control. The raw value is still indexed, stored and logged.

NeedGemini safety filtersModel Armor
ScopeOne Gemini callAny model, any cloud, plus agent traffic via the gateway
Prompt injection / jailbreak✗✓
Sensitive data / redaction✗ (beyond built-in)✓ (SDP)
Malicious URLs✗✓
Central org baseline✗✓ floor settings
07

Network & Data Protection

VPC Service Controls

  • Inside a perimeter, Agent Runtime keeps access to Google APIs, but public internet is blocked. For internet egress, use a PSC interface + RFC 1918 proxy VM + Cloud NAT.
  • Without VPC-SC the Google-managed tenant keeps default internet access, but it can't reach your private VPC or on-prem; plan a PSC-I (plus proxy if needed).
  • Deploys may need ingress rules for the Reasoning Engine service agent: pickle deploys need Cloud Storage + Artifact Registry; source deploys need Artifact Registry; bring-your-own-container needs none.
  • Agent Identity APIs (agentidentity.googleapis.com, agentidentitycredentials.googleapis.com) can be added to a perimeter (restricted VIP), and agent identities can appear in ingress/egress rules.
  • Violations are recorded as Policy Denied audit logs.

Private Service Connect

  • PSC interface (PSC-I): private egress from the agent to your VPC, on-prem or multicloud via a network attachment (subnet minimum /28). DNS peering resolves private names. Shared VPC is supported. Can't be changed without recreating the agent.
  • PSC endpoint: private ingress to Google APIs or regional endpoints (e.g., Model Armor, a sandbox).

CMEK

Data residency

EndpointAt-rest dataML processing
Regional (e.g., us-central1)In regionIn region
Jurisdictional multi-region (us, eu)In jurisdictionWithin jurisdiction (EU excludes UK/CH)
GlobalIn chosen locationNo residency guarantee

Decision rule

For a strict residency requirement, use a regional or jurisdictional endpoint and block the global endpoint with org policy.

08

Audit, Observability & Threat Detection

Cloud Audit Logs for Agent Platform

Log typeDefaultCapturesViewer role
Admin ActivityAlways on, can't be disabledConfig/metadata changes (create/delete/patch resources, setIamPolicy)roles/logging.viewer
Data AccessOff: must be enabledAdmin read, data read/write (e.g., model/endpoint usage)roles/logging.privateLogViewer
Policy DeniedOnRequests denied by a security policy (e.g., VPC-SC)roles/logging.viewer
System EventAlways onGoogle-initiated changesroles/logging.viewer

Agent Gateway monitoring signals

SignalWhereWhat it holds
Gateway request logResource networkservices.googleapis.com/Gateway, log gateway_requestshttpRequest (URL, status); jsonPayload.agentGatewayInfo with mcpInfo (MCP method and tool name) and agentRegistryResource (matched registry entry); authzPolicyInfo result (ALLOWED / DENIED); serviceExtensionsInfo (which extension handled the call); trace. Dry-run traffic is logged too
IAP decisioncloudaudit.googleapis.com/data_access, service iap.googleapis.comauthorizationInfo[].granted; authenticationInfo.principalSubject (the agent's SPIFFE or principal:// ID); resolved resource; label iap.googleapis.com/audited_resource_name reads unregisteredResource for unregistered hosts; metadata.iamEnforcementMode
Model ArmorSanitize and detection logs; Agent Platform Security tab (Preview)Matched filter and verdict; total, flagged and blocked interaction counts
Semantic GovernanceLog semantic-governance-policyOverall verdict; evaluations[] with toolName, verdict, rationale; token_usage
Agent outputreasoning_engine_stderr / reasoning_engine_stdoutStartup failures and the agent's view of a denied call
Observability dashboardAgent Gateway page, Observability tabAttempted authorizations, authorization failures, requests per second, egress logs including 403s and unregistered destinations. Needs the _Default log bucket upgraded to Observability Analytics
Cloud Trace (Preview)Telemetry policy attached to the gatewayGateway spans joined to agent and MCP spans through W3C traceparent; compare with metric networkservices.googleapis.com/agentgateway/total_latencies to split gateway latency from destination latency

Dry run before enforcement

ControlShadow settingRead results inTo enforce
UAP through IAP (REQUEST_AUTHZ)iamEnforcementMode: "DRY_RUN" in the IAP authorization extension metadataAudit logs filtered on protoPayload.metadata.iamEnforcementMode="DRY_RUN"Remove the field
Semantic Governance (CONTENT_AUTHZ)sgpEnforcementMode: DRY_RUN in the authorization extension metadata; every call is allowed and verdicts are loggedsemantic-governance-policy logRemove the key
Model Armor (CONTENT_AUTHZ)Template or floor setting at INSPECT_ONLYSanitize logs, Security tab flagged countSwitch to INSPECT_AND_BLOCK

Agent Gateway troubleshooting

SymptomLayerCheckLikely cause and fix
403 "Egress request is not authorized"IAP (REQUEST_AUTHZ)IAP audit entry with granted: false; principalSubjectNo egressViaIAP grant for this agent at registry, resource or unregistered-endpoint scope; a CEL condition silently excludes the agent; a PAB leaves the destination out of scope. Test with a direct principal:// binding to rule out principal-set sync delays or missing attributes
403 and no IAP entry at allGateway, before IAPGateway log authzPolicyInfo = DENIED, requestUrlHostname not registered exactly (regional and mtls variants count as different hosts), or no authorization policy targets the gateway, so the extension never runs
403 with different textDestinationAgent stderrThe tool rejected the call: fix destination IAM (e.g., roles/iap.httpsResourceAccessor, roles/mcp.toolUser) or the injected token
Auth error from a third-party toolAuth managerAgent logsAgent lacks roles/agentidentity.user on the auth provider, or the user never completed 3LO consent
403s while Agent Runtime startsDefault-deny egressGateway logs, status 403Google Cloud APIs the runtime calls at startup (Agent Platform, Resource Manager, Logging, Trace, Secret Manager hostnames) not registered or allowed: dry-run, register, grant
"Failed to convert project number to project ID" at startupAgent identity rolesreasoning_engine_stderrMissing resourcemanager.projects.get: grant roles/browser alongside the default agent roles
Payload blockedModel ArmorSanitize log filter; span gen_ai.security.decision.typeTemplate threshold, or a floor setting stricter than the template
Tool call denied mid-turnSemantic Governancerationale in the policy logConstraint too strict, or the call didn't match the user's request (intent matching is on by default); tune in dry run
No semantic verdictSemantic GovernanceGateway log serviceExtensionsInfo lacks the extensionEngine not ACTIVE, gateway not bound, request path outside the policy's when condition, or a streamed model call (not supported)
TLS handshake failuresEgress connectivityAgent logsDestination uses a private CA or self-signed cert: set tlsConfig in the agent connectivity template (keep PUBLICLY_TRUSTED_ROOTS for Google APIs) and rebind it after changes. BYOC containers must trust the gateway's root CA
Binding fails or false "unregistered destination" denialsProject setupError textiap.googleapis.com API disabled
Gateway spans appear as separate root tracesTrace propagationTrace explorerparentBasedSampling off, caller lacks roles/cloudtrace.agent, or the app doesn't propagate traceparent
Latency spikeGateway vs. destinationagentgateway/total_latencies against the span breakdownSeparate guardrail and policy time (Model Armor and Semantic Governance spans) from tool time before tuning

Exam trap

Logs explain why one call was denied; dry run shows what would break before you enforce. Enforcing without a dry-run window is a common cause of startup 403s on Agent Runtime.

Security Command Center: AI Protection

Exam trap

Audit logs record, and SCC detects and alerts. A question asking "be notified when an agent's credential is used from outside Google Cloud" points to SCC threat detection, not to enabling Data Access logs.

09

HITL & Governance at Scale

Human-in-the-loop approvals

Governing agent sprawl

LeverControl
InventoryAgent Registry (auto + manual registration); SCC AI asset inventory
Only approved destinationsGateway default-deny + registry-backed UAPs
Only approved gatewaysCustom org policy constraints on gateway association
Uniform content baselineModel Armor floor settings at org/folder
Uniform reachPAB on the org/project agent principal set
ResidencyOrg policy blocking the global endpoint
DetectionSCC AI Protection; Audit Logs
Lifecycle hygieneRemove orphaned bindings on deletion; principalSet baselines for redeploys

Layered defense, end to end

01

Identity & credentials

Agent Identity with least-privilege roles + PAB. Auth manager (3LO/2LO/API keys) + Secret Manager.

02

Gateway & intent

Registry-backed, default-deny UAPs (dry-run → enforce). Semantic Governance on proposed tool calls.

03

Content & network

Model Armor input/output templates + SDP; Gemini safety filters. VPC-SC, PSC-I, CMEK, regional endpoints.

04

Human, audit, detect

Tool confirmation for high-stakes actions. Cloud Audit Logs + SCC AI Protection.

10

Glossary, Self-Assessment & Resources

Agent Identity
A per-agent SPIFFE-based principal with certificate-bound, auto-rotated credentials.
Auth manager
Credential vault and OAuth broker for agent-to-tool auth.
PAB
Principal Access Boundary, which caps the resources a principal is eligible to access.
UAP
Unified Access Policy, an IAM v3 allow/deny policy enforced by IAP on Agent Gateway traffic.
Semantic Governance
LLM-evaluated natural-language constraints on proposed tool calls (Preview).
Floor settings
The Model Armor minimum baseline across templates.
PSC-I
Private Service Connect interface for private agent egress.
Auth provider
An auth manager resource holding one integration's credentials (3LO, 2LO or API key); agents need roles/agentidentity.user on it.
Confused deputy
A privileged component tricked into using its authority for a caller who lacks it.
REQUEST_AUTHZ / CONTENT_AUTHZ
Gateway authorization profiles that inspect headers only (IAP) or full payloads (Model Armor, Semantic Governance).
Token exchange (RFC 8693)
Swapping one security token for another, as Workload Identity Federation's Security Token Service does.
Template conformance
The floor settings check that rejects any Model Armor template weaker than the effective floor at create or update time.
Inline enforcement
Project floor settings applied directly to Gemini generateContent and Google Cloud MCP traffic, with no template reference in code.
INSPECT_ONLY / INSPECT_AND_BLOCK
Model Armor enforcement types that log detections only, or log and return a block verdict.
Fail-open
A control that lets traffic through unscreened when it is unavailable, as the Gemini integration does if Model Armor can't be reached.
Referential integrity (SDP)
The same input always maps to the same output under one key and context, so joins and entity tracking survive de-identification.
Format-preserving encryption (FPE)
Reversible tokenization (CryptoReplaceFfxFpeConfig) that keeps the input's length and alphabet.
Surrogate infoType
A label prefixed to a deterministic token so content.reidentify can find and reverse it.
SDP content policy
A Sensitive Data Protection resource that Gemini Enterprise applies to connectors and uploads to block sensitive content.
iamEnforcementMode / sgpEnforcementMode
Authorization extension metadata keys that put IAP or Semantic Governance in DRY_RUN (log only); removing the key enforces.
Telemetry policy
The telemetryPolicies resource that turns on Cloud Trace sampling for an Agent Gateway.

Related guides

Audio Deep Dive & Study Downloads

Listen to the 48-minute Agent Platform Security & Governance audio deep dive, open the 21-slide security deck and sketchnote infographic in the Hub Viewer, or drill scenario questions across Agent Identity, auth manager, PAB, Agent Gateway policies, Model Armor, VPC-SC/PSC/CMEK, audit logs, and HITL.

Agent Platform: Identity, Security & Governance (Podcast)
Open Slide Deck & Infographic in Hub Viewer Launch Interactive Agent Platform Security Practice Quiz →

Self-Assessment Questions (Click to Reveal)

Q1. Why do bindings break after a redeploy, and how do you prevent it?

A redeploy creates a new resource ID and therefore a new principal. Read spec.effectiveIdentity in CI/CD and put baseline roles on the project principalSet.

Q2. IAM deny vs PAB?

Deny blocks specific permissions; PAB limits which resources are reachable at all. Neither grants access.

Q3. Why can't IAM alone stop a destructive MCP tool call?

Google Cloud IAM doesn't see MCP tool names; a gateway UAP on tool.name/destructive_hint does.

Q4. When does Semantic Governance help where UAP can't?

When the tool is allowed but the specific call doesn't match user intent (indirect injection) or breaks a business rule.

Q5. What's needed to redact PII through Model Armor on the gateway?

An advanced SDP de-identify template plus INSPECT_AND_BLOCK.

Q6. Which audit logs must you enable to see model usage?

Data Access logs. Viewing them requires Private Logs Viewer (roles/logging.privateLogViewer).

Sources (docs.cloud.google.com unless noted)