Agent Platform Troubleshooting
GoogleOfficialPublished by Google
- Skill
- Review and audit
- Software development
- Apache-2.0
- No issues found
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
This skill provides a structured diagnostic framework for identifying and resolving complex issues within the Google Cloud Gemini Enterprise Agent Platform. It covers the entire stack, including Agent Gateway, Agent Connectivity Templates (ACT), Agent Registry, Identity-Aware Proxy (IAP), Model Armor, Semantic Governance Policies (SGP), and network-level configurations like DNS peering and proxy architectures. The skill enforces a strict, rule-based diagnostic flow to ensure efficient troubleshooting while preventing common misconfigurations, such as incorrect IAM assignments or unsupported multi-region registrations.
What it does
- Analyzes Agent Platform logs to identify root causes for 401, 403, 404, 498, 500, and 503 errors.
- Validates Agent Gateway, ACT, and registry configurations against platform best practices.
- Provides specific remediation steps for IAP, Model Armor, and SGP policy enforcement issues.
- Troubleshoots complex network egress scenarios including SWP, explicit proxies, and VPC-SC perimeters.
- Generates a standardized diagnostic report with findings and actionable recommendations.
- Enforces strict operational safety rules to prevent unauthorized mutations or excessive resource consumption.
When to use it
- When agent requests fail with HTTP status codes like 403 (Egress not authorized) or 404 (HTTP CONNECT failure).
- When Agent Runtime instances crash on startup due to connectivity or policy validation errors.
- When troubleshooting configuration mismatches in Agent Gateway, ACT, or registry services.
- When diagnosing VPC-SC perimeter blocks or issues with DNS peering and Private CA TrustConfig.
- When investigating Model Armor or SGP verdict rationales for blocked requests.
Advantages
- Reduces mean time to resolution by following a proven, rule-based diagnostic hierarchy.
- Prevents common configuration pitfalls through mandatory pre-flight checks and strict usage rules.
- Provides clear, actionable remediation steps tailored to the specific failure mode.
- Ensures consistent diagnostic output across different project environments.
- Maintains operational security by requiring the user to own all mutations.
Usage examples
- “My agent is getting a 403 Egress request is not authorized error when calling an external API.”
- The agent will initiate the diagnostic flow, checking IAP egressor bindings on the registry entry and verifying the relevant AuthzPolicy.
- “Why is my Agent Gateway stuck in PROVISIONING state?”
- The agent will check for PSC subnet IP exhaustion and provide guidance on expanding the CIDR range if necessary.
- “My Agent Runtime crashes on startup with connection errors to telemetry.mtls.googleapis.com.”
- The agent will verify if the required telemetry endpoints are registered and suggest updating the AuthorizationPolicy to allow access.
Install
Download the skill as a ZIP:
https://mp-staging.autogineer.com/agent-skills/google/agent-platform-troubleshooting/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip agent-platform-troubleshooting.zip -d .agents/skills
Documentation by Google
Agent Platform Troubleshooting
Important: You MUST ONLY use the reference files located in this skill's
references/directory (references/field-manual.md,references/known-issues.md,references/agent-gateway.md,references/policies.md,references/agent-registry.md,references/agent-identity.md). Do NOT search for or read external playbooks outside this directory.
Diagnose issues across the Google Cloud Gemini Enterprise Agent Platform: Agent Gateway, Agent Connectivity Templates (ACT), Agent Registry (Services, Agents, MCP Servers, Endpoints), Agent Identity, IAP/UAP policies, Model Armor, Semantic Governance Policies (SGP), explicit/transparent proxies, and tracing. This skill produces a diagnostic report — findings and fix recommendations. It does not apply fixes; the user owns all mutations.
Usage Attribution
MUST READ: Before executing any gcloud, REST API, or MCP command, you
MUST read and follow Usage Attribution. Prefix
direct terminal gcloud calls (never generated scripts, Terraform, or user
code) with
CLOUDSDK_METRICS_REQUEST_ATTRIBUTION="agent-skills/1.0 (skill:agent-platform-troubleshooting)"
and append agent-skills/1.0 (skill:agent-platform-troubleshooting) to direct
HTTP/REST/MCP User-Agent headers.
MANDATORY PRE-FLIGHT CHECKLIST (CHECK BEFORE RESPONDING OR CALLING TOOLS)
CRITICAL: Before generating ANY response or calling any tools, evaluate the user's prompt against Rules 1–14. When a Turn-0 rule matches, execute its directive immediately and STOP.
Rule 1: Out-of-Scope GCP IAM / GCS Queries
If the prompt asks about Compute Engine (GCE), Cloud Storage (GCS) buckets, or generic GCP IAM permissions unrelated to the Agent Platform stack:
IMMEDIATELY DECLINE ON TURN 0. DO NOT CALL ANY TOOLS OR GIVE IAM GUIDES.
Respond: "I decline to troubleshoot generic GCP IAM or GCS access issues, as they are out of scope for the Agent Platform Troubleshooting skill."
Rule 2: Strict Prohibition on Custom Discovery Scripts
If asked to write, generate, compile, or execute a custom Python or bash script to discover resources (e.g., active Agent Runtime instances):
DO NOT CALL ANY TOOLS OR WRITE/RUN ANY SCRIPTS.
RESPOND ON TURN 0: "I cannot write or execute custom Python or bash scripts for resource discovery. Custom discovery scripts are prohibited as they consume excessive turns and cause timeouts. Instead, use standard gcloud CLI commands (see Google Cloud SDK Installation) or curl REST API calls with application default credentials:
gcloud agent-registry agents list --location=us-central1orcurl -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" "https://us-central1-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/reasoningEngines""
Rule 3: Consolidated Registry for Google APIs / Design Queries
If asked about registering multiple Agent Runtime, Cloud Resource Manager, or Google API interfaces, or structuring services in Agent Registry:
DO NOT CALL ANY TOOLS. RESPOND ON TURN 0 WITH:
Consolidate ALL Google APIs under a single
googleapisservice entry in Agent Registry viagcloud agent-registry services create googleapis --endpoint-spec-type=no-spec.Explicitly state: "Do NOT register each Google API as a separate registry service entry, as separate entries cause resource clutter, complicate IAM policy management, and risk hitting registry quota limits."
List all 8 required base FQDN interfaces (plus global
https://aiplatform.googleapis.comwhen calling global Gemini models):https://agentregistry.googleapis.comhttps://aiplatform.mtls.googleapis.comhttps://cloudresourcemanager.mtls.googleapis.comhttps://iamcredentials.mtls.googleapis.comhttps://telemetry.mtls.googleapis.comhttps://{region}-aiplatform.mtls.googleapis.comhttps://{region}-aiplatform.googleapis.comhttps://aiplatform.{region}.rep.googleapis.com
Refer to
references/agent-registry.md§2 for the full command.
Rule 4: Cloud Run / Cloud Functions Egress 401/403 (OIDC vs IAP MCP)
If an agent gets a 401 or 403 egress error calling an MCP server or tool on
Cloud Run or Cloud Functions:
DO NOT RUN LOG TOOLS. RESPOND ON TURN 0 WITH:
Explain that direct Agent Identity (
principalSet://.../principal://...) to standard Cloud Run OIDC authentication is not natively supported.Recommend Service Account impersonation in agent code to obtain an OIDC ID token, granting
roles/iam.serviceAccountTokenCreatorto the Agent Identity on the target SA (androles/run.invokerto that SA on Cloud Run).Note that for Preview IAP-enabled Cloud Run MCP servers (
--iap --functional-type=mcp-server,run.appshort URL), authorize via IAP/UAP instead ofroles/run.invoker(seereferences/known-issues.mdBKI 21 andreferences/agent-identity.md).
Rule 5: Telemetry & Monitoring Endpoint Blocks on Startup
If Agent Runtime startup crashes (set_up()) with connection resets or
handshake errors reaching telemetry.mtls.googleapis.com:
Evidence: Explicitly check whether all 4 monitoring/tracing endpoints are registered as Endpoints in Agent Registry (
gcloud agent-registry endpoints list):telemetry.mtls.googleapis.com,monitoring.googleapis.com,trace.mtls.googleapis.com, andcloudtrace.googleapis.com.Recommended Fix:
Register missing telemetry/tracing interfaces via
gcloud agent-registry services create --endpoint-spec-type=no-spec(which projects read-only Endpoints in Agent Registry fortelemetry.mtls.googleapis.com,monitoring.googleapis.com,trace.mtls.googleapis.com, andcloudtrace.googleapis.com).Create or update an
AuthorizationPolicy(AuthzPolicy/ IAP / UAP) bound to the Gateway that allows the agent's principal set (identity) to access the telemetry endpoints (seereferences/known-issues.mdBKI 23).
Rule 6: IAP Denial Troubleshooting (403 / Egress request is not authorized)
When logs or symptoms show 403 / Egress request is not authorized via IAP:
Check IAP Egressor bindings on the registry entry FIRST (
roles/iap.egressorviagcloud iap web get-iam-policy --resource-type=agent-registrybound to the server-generated child UUID fromregistryResource, notSERVICE_NAME).Create a registry entry (
gcloud agent-registry services create) if none exists for the exact target hostname.Grant
roles/iap.egressoron the registry entry (IAM v1 —set-iam-policyrequires top-level{"bindings": [...]}JSON without a"policy"wrapper) or verify UAPAccessPolicy+ CRMPolicyBinding(iapPolicyVersion: "V2",iap.googleapis.com/resources.egressViaIAP; seereferences/policies.md§2).Check IAP audit logs (
protoPayload.serviceName="iap.googleapis.com") and verify anAuthorizationPolicy(AuthzPolicy) is bound to the Gateway.Explicitly warn: "Do NOT use
roles/iap.tunnelResourceAccessor(which is for classic IAP TCP tunneling to GCE VMs, not Agent Gateway egress) and do NOT bypass IAP authentication."
Rule 7: PSC Subnet Exhaustion Speed Rule (PROVISIONING Hang)
When diagnosing gateway provisioning stuck or failing on subnet IP exhaustion:
DO NOT loop across regions. Run ONLY in the target region (default
us-central1):gcloud network-services agent-gateways list --location=us-central1gcloud network-services agent-gateways describe <GW> --location=us-central1gcloud compute network-attachments describe <NA> --region=us-central1gcloud compute networks subnets describe <SUBNET> --region=us-central1
Check free IP count (
Usable - Allocated = Free) before recommending any Network Attachment deletion; flag that a/28subnet is easily exhausted and recommend expanding the CIDR range to at least/26(known-issues.mdBKI 19).
Rule 8: Multi-Region Manual Registration Prohibition (us / eu)
If asked about manually registering endpoints or services in us or eu:
DO NOT CALL ANY TOOLS. RESPOND ON TURN 0:
"Manual endpoint/service registration is NOT supported in
usoreumulti-region locations (usandeuare read-only roll-up locations for auto-discovered resources)." (Explicitly name BOTHusandeu.)"Register manually in a specific region (e.g.,
us-central1) orglobal."
Rule 9: VPC Service Controls (VPC-SC) Perimeter & ACT ALL_TRAFFIC
When diagnosing VPC-SC perimeter blocks or external API hangs under VPC-SC:
Identify a VPC Service Controls perimeter block / boundary enforcement.
Check that the Agent Connectivity Template (ACT) sets
vpcEgress: ALL_TRAFFIC(native VPC-SC creation works out of the box since Sept 8, 2026 whenvpcEgress: ALL_TRAFFICis set) and that Cloud NAT is configured on the consumer VPC's PSC-I network attachment subnet.For legacy or strict custom perimeters blocking Google actuation identities, recommend creating ingress policies allowing:
Explicitly state: "Do NOT disable VPC Service Controls or delete perimeters." Refer to
references/known-issues.mdBKI 18 & 28.
Rule 10: UAP Policy Binding Org Policy Blocker & Blanket DENY Crash
CUSTOM_ORG_POLICY_VIOLATIONongcloud iam policy-bindings create: Caused byconstraints/iam.managed.disableAccessPolicyBinding(note: some docs misspell this plural). Apply an Org Policy override (enforce: false) at the target resource and wait 30 to 60 seconds for IAM propagation (BKI 24).Startup crash after UAP
destination.is_registered == falseDENY: Explain that the blanketDENYblocked internal/unauthenticated SDK bootstrap and metadata calls (such as Cloud Resource Manager project lookups) during Reasoning Engine init; remove or scope the blanketDENYrule (BKI 5).
Rule 11: Agent Gateway Dual-Registry & Jurisdiction Invariants
When configuring or validating registries on an Agent Gateway:
An Agent Gateway supports a maximum of two registries.
When two registries are configured, exactly one must be
globaland the other must beregionalormulti-regional.Binding two regional registries (e.g.,
us-central1+europe-west1), two multi-regionals, two globals, or a mismatched jurisdiction (e.g.,us-central1gateway +euregistry) is invalid and rejected with an HTTP 400 validation error (references/agent-gateway.md§4, BKI 26).
Rule 12: Cross-Project Runtime-to-Gateway Binding Diagnosis
When Reasoning Engine in Project 1 fails to bind to a Gateway in Project 2:
Deploying Identity: Needs
networkservices.agentGateways.useandnetworkservices.agentGateways.get(orroles/networkservices.viewer) in Project 2.Vertex AI Service Agent: Grant
roles/networkservices.vieweror custom roleae_agw_cross_project_sa(aliasar_agw_cross_project_sa) toservice-PROJECT_1_NUMBER@gcp-sa-aiplatform.iam.gserviceaccount.comin Project 2.Regional Colocation: Verify both runtime and gateway are in the same region.
CAA Opt-Out: Set
GOOGLE_API_PREVENT_AGENT_TOKEN_SHARING_FOR_GCP_SERVICEStoFalse(references/known-issues.mdBKI 10,references/agent-gateway.md§11).
Rule 13: Downstream SWP + PBR vs. Explicit Forward HTTPS Proxy
Distinguish the two supported consumer-VPC proxy architectures:
Pattern A — Transparent Next-Hop SWP + PBR (no client
HTTPS_PROXYneeded):Explain that PSC endpoints cannot be route next-hops, SWP behind PSC Service Attachments only supports explicit proxy mode (not transparent next-hop mode), and static routes cannot be used because Network Attachments cannot have VM network tags.
Deploy SWP directly in the consumer VPC with
type: SECURE_WEB_GATEWAYandroutingMode: NEXT_HOP_ROUTING_MODEon an internal IP on the PSC-I subnet (e.g.,10.20.1.250), with a/26REGIONAL_MANAGED_PROXYACTIVEsubnet.Configure Policy-Based Routing (PBR) matching source CIDR
10.20.1.0/24to--next-hop-ilb-ip=10.20.1.250(priority 200) + fallback PBR (1000).Create Cloud NAT with
ENDPOINT_TYPE_SWG(nats create ... --endpoint-types=ENDPOINT_TYPE_VM,ENDPOINT_TYPE_SWG), and allowlist<region>-aiplatform.mtls.googleapis.comin SWP CEL (BKI 33).
Pattern B — Explicit Forward HTTPS Proxy (
HTTPS_PROXY+ L4AuthzPolicy):Without L4 bypass,
HTTPS_PROXY=https://proxy.corp.internal:443fails onHTTP CONNECTwith HTTP404because Agent Gateway's L7 HTTP manager terminates TLS and rejects nestedCONNECT.Import a
v1beta1L4AuthzPolicyviagcloud beta network-security authz-policies importwithaction: ALLOWandnetworkRulesmatchingto.operations[].snis(omittarget.loadBalancingSchemeandports; max 5 rules; omitfromor include7.0.0.0/8+ PSC-I CIDR infrom.sources[].ipBlocks).Listen with TLS on
:443, allow the consumer PSC-I subnet CIDR on VPC firewall/proxy ACLs (never7.0.0.0/8), setNO_PROXY/no_proxyto.googleapis.com,googleapis.com,metadata.google.internal,169.254.169.254,localhost,127.0.0.1, bundleagentGatewayCard.rootCertificates+ Private CA in container env vars (SSL_CERT_FILE,REQUESTS_CA_BUNDLE), and warn L4ALLOWbypasses L7 IAP/UAP, Model Armor, SGP, andhttpRulesfor matched SNIs (BKI 34).
Rule 14: DNS Peering, TrustConfig, Model Armor, SGP, MCP, Identity, & Lifecycle
DNS Peering & Service Agent: Public FQDNs resolve via public recursive DNS. Private DNS requires
dnsPeeringConfig(domainsarray with trailing.; ACT uses stringtargetNetworkonly, whereas inlineAgentGateway.networkConfig.dnsPeeringConfigalso requirestargetProject). Cloud DNS caps total peering hops at 2 (Gateway consumes Hop 1 → max 1 consumer peering hop; a 2nd hop fails preflight or returnsSERVFAIL→503, BKI 35). Grantroles/dns.peer,roles/dns.reader,roles/compute.networkViewer, androles/compute.networkUsertoservice-GATEWAY_PROJECT_NUMBER@gcp-sa-agentgateway.iam.gserviceaccount.com(andcompute.networkAttachments.useto caller, BKI 9). Never use authoritative"."private root zones ("."requires a Cloud DNS Private Forwarding Zone).Private CA
TrustConfig& Immutable ACT: SetegressNetworkConfig.tlsConfig.trustConfigwithadditionalRoots: PUBLICLY_TRUSTED_ROOTS(omitting breaks*.googleapis.com). ACT fields are immutable — create a new ACT and rebind viaPATCHwithupdateMask=agentConnectivityTemplate(BKI 6).Model Armor (
CONTENT_AUTHZ): Ingress (CLIENT_TO_AGENT, max 1, ADKstreamQueryonly) usesservice-AGENT_PROJECT_NUMBER@gcp-sa-aiplatform-re.iam.gserviceaccount.com; Egress (AGENT_TO_ANYWHERE, max 4) usesservice-GATEWAY_PROJECT_NUMBER@gcp-sa-dep.iam.gserviceaccount.com. ScopehttpRuleswhento exclude gRPC and streams >60 seconds (Stream removed, BKI 13).Semantic Governance Policies (SGP): Uses
gcp-sa-aiplatform, non-streaming LLM calls only,.contains()+!request.headers['content-type'].startsWith('application/grpc')inwhen, and full-map updates onPATCH ?updateMask=metadatasosgpEnforcementMode: "DRY_RUN"andsgpUserIntentMatchingare preserved (BKI 38).Native MCP, Identity, Trace, & Teardown: Set
baseProtocolMethodsOption: MATCH_BASE_PROTOCOL_METHODSon MCPALLOWrules (BKI 39). Orgless trust domains useagents.global.proj-PROJECT_NUMBER.system.id.goog(proj-, neverproject-); never grantroles/aiplatform.expressUseror project-wideroles/aiplatform.userto Agent Identities. For Cloud Trace (TelemetryPolicy), always recommend enablingcloudtrace.googleapis.com(gcloud services enable cloudtrace.googleapis.com) and grantingroles/cloudtrace.agenttocompute-system,gcp-sa-networksecurity, andgcp-sa-agentgateway(seereferences/agent-gateway.md§8.3 andreferences/field-manual.mdStep 14.4). Tear down in strict 7-step order (workloads → UAP bindings →AuthzPolicy→ extensions →AgentGateway→ ACT → VPC) and use unique gateway IDs if deletion tombstones collide (BKIs 25, 30).
Quick Symptom Triage Matrix
| Symptom / Error | Primary Suspect | Reference |
|---|---|---|
403 / Egress request is not authorized | Unregistered FQDN, missing roles/iap.egressor / UAP binding, or PAB | Rules 4, 6; references/policies.md §2; BKIs 4, 7, 8, 15 |
HTTP 404 on HTTP CONNECT (HTTPS_PROXY) | Missing gcloud beta L4 AuthzPolicy (networkRules snis) | Rule 13B; references/agent-gateway.md §6.3; BKI 34 |
HTTP 498 immediately after binding runtime | Enforcing gateway bound before allowlisting essential platform APIs | references/agent-gateway.md §2; BKI 37 |
500 / PERMISSION_DENIED / Stream removed | Model Armor SA roles (gcp-sa-dep vs gcp-sa-aiplatform-re) or 60s stream cap | Rule 14; references/policies.md §12; BKI 13 |
503 / NXDOMAIN / SERVFAIL on private host | >2-hop DNS peering, authoritative "." zone, Packet Intercept, or SWP | Rules 13A, 14; references/agent-gateway.md §3, §6; BKIs 33, 35, 36 |
Config validation failed / PERMISSION_DENIED on import | Disabled agentregistry.googleapis.com, missing caller/gcp-sa-agentgateway IAM, or bad NA URI | Rule 14; BKIs 9, 20, 26 |
HTTP 409 ABORTED / 400 already being used | Active control-plane LRO mutex (~2 min), tombstone collision, or reverse teardown | references/agent-gateway.md §9, §10; BKIs 25, 29, 30 |
Startup crash (reasoning_engine_stderr) | Blocked telemetry/CRM bootstrap, UAP blanket DENY, or SGP gRPC interception | Rules 5, 10, 14; BKIs 1, 5, 17, 23, 38 |
When to use this skill
Trigger on Agent Gateway, Agent Connectivity Templates (ACT), Agent Registry,
Agent Identity, IAP/UAP policies, Model Armor, Semantic Governance Policies
(SGP), SWP/Explicit Proxy egress, Private CA TrustConfig, Cloud DNS peering,
Cloud Trace TelemetryPolicy, or Gemini Enterprise / Agent Runtime / GKE /
Cloud Run gateway bindings. Do not use for generic Google Cloud IAM, GCS,
GCE, or networking issues unrelated to the Agent Platform stack.
Required context & Hypothesis Rules
Gather PROJECT_ID, PROJECT_NUMBER, LOCATION (default us-central1),
AGENT_ID, AGENT_GATEWAY_NAME, Agent Identity (principal:// or
principalSet://), exact error + timestamp, and target destination. If missing,
ask or state unknowns using placeholders — never scan across projects or loop
over regions. Before Step 1 queries, formulate at most 3 hypotheses anchored
to "Why did it start failing now?" (e.g., recent Terraform/config changes).
Diagnostic flow
Follow in order (copy-paste commands in references/field-manual.md):
Step 0 — Pre-Flight & Access: Evaluate Rules 1–14. Verify project access (
gcloud projects describe $PROJECT_ID).Step 1 — Agent & Startup Logs: Classify error (
403,404 CONNECT,498,500,503, crash, timeout). Check PSC subnet IPs, ACTALL_TRAFFIC+ Cloud NAT, andagentGatewayCard.rootCertificatesCA trust.Step 2 — Gateway Logs: Query
networkservices.googleapis.com/Gateway(filtering-httpRequest.requestMethod="CONNECT"when inspecting L7 requests) to find the exact failing SNI/hostname andserviceExtensionsInfo.Step 3 — IAP / Model Armor / SGP Logs: Check
iapPolicyVersion(V1vsV2),DRY_RUNvs enforced, Model Armor callout status, orlogs/semantic-governance-policyverdicts and rationales.Step 4 — Registry State: Verify exact hostname permutations in
gcloud agent-registry {services,endpoints,mcp-servers,agents} listand confirm dual-registry + jurisdiction rules.Step 5 — Identity & Policies: Check
roles/iap.egressorvia--resource-type=agent-registryon the child UUID (V1), UAPAccessPolicy/PolicyBinding+constraints/iam.managed.disableAccessPolicyBinding(V2), PAB overrides, and least-privilege Agent Identity roles (proj-for orgless).Step 6 — AuthzPolicy & Extensions: Verify L4
networkRulesvs L7httpRules, MCPMATCH_BASE_PROTOCOL_METHODS, Model Armor / SGPwhenexclusions,ExtensionBindingscope, and policy caps (max 4 egress, max 1 ingressCONTENT_AUTHZ).Step 7 — Connectivity, DNS, & TLS: Verify ACT
TrustConfig(PUBLICLY_TRUSTED_ROOTS),gcp-sa-agentgatewayIAM, <=2 DNS peering hops, no Packet Intercept on the consumer VPC, and SWP/Explicit Proxy settings.Step 8 — PrincipalSet & Trace Verification: Test 1:1
principal://binding ifprincipalSet://lags; for Cloud Trace, enablecloudtrace.googleapis.com, verifyv1beta1TelemetryPolicy(telemetryTargetreferencingagentGateways/*and objectparentBasedSampling: {enabled: true, samplingRate: 1.0}, never stringENABLED), and grantroles/cloudtrace.agenttoservice-<PROJECT_NUMBER>@compute-system.iam.gserviceaccount.com,service-<PROJECT_NUMBER>@gcp-sa-networksecurity.iam.gserviceaccount.com, andservice-<PROJECT_NUMBER>@gcp-sa-agentgateway.iam.gserviceaccount.com.
Tools & Layered References
Use mcp__gcloud__run_gcloud_command (or gcloud --quiet),
mcp__gcloud-observability__list_log_entries (or gcloud logging read),
mcp__google-dev-knowledge__search_documents / get_documents / answer_query,
and curl REST GETs, plus bundled references (load only the smallest set needed):
references/field-manual.md — read first for operational commands & log queries
references/known-issues.md — BKIs #1–#13, #15–#39 for fast pattern matches
references/agent-gateway.md — topologies, ACT, DNS, TLS, SWP/Explicit Proxy, Trace, teardown
references/policies.md — L4/L7
AuthzPolicy, MCP, UAP v3beta, Model Armor, SGPreferences/agent-registry.md —
servicesvs projectedendpoints, 9 API families, jurisdictionsreferences/agent-identity.md — 3-identity delegation, Cloud Run OIDC vs IAP MCP, WIF
Output report
Always produce a read-only diagnostic report using this exact structure:
# Agent Platform Diagnostic — <one-line summary>
## Context
- Project: <id> (<number>) | Location: <region>
- Agent: <agent_id> | Gateway: <gateway_name>
- Symptom: <exact error message and when it started>
## Evidence gathered
- Agent log query: <filter, summary>
- Gateway log query: <filter, exact failing hostname / extension status>
- IAP / Policy log query: <filter, decision + enforcement mode>
- Registry & Policy state: <entries, AuthzPolicy bindings, roles/iap.egressor or UAP>
## Root cause hypothesis
<ranked root cause(s)>
## Why this fits the evidence
<connect log/config evidence to root cause>
## Recommended fix
<ordered gcloud / curl / YAML / Terraform changes for the user to apply>
## What to verify after the fix
<verification queries>
## Open questions / unknowns
<missing context or unverified items>
## Appendix: Raw Logs & Verified Links
- **Cloud Logging Filter**: <exact copy-pasteable filter or deep link>
- **Raw Logs**: <untruncated Agent, Gateway, and IAP/Policy log entries>Principles
Exact hostname match first: Compare gateway log hostnames directly against Agent Registry.
Layered default-deny: Registry → Gateway
AuthzPolicy→ Extension → IAP/UAP/Model Armor/SGP → PAB (PAB overrides IAM Allow).L4 bypass vs L7 governance: L4
networkRulesenablesHTTP CONNECTexplicit proxies (:443) but bypasses L7 IAP, Model Armor, and SGP for matched SNIs.Read-only, single-region, non-interactive: Pull evidence first, never mutate resources, check
us-central1unless logs indicate otherwise, and pass--quiet.
Supporting Links
Files
- ATTRIBUTION.mdAdded by AutoGineer878 B
- LICENSELicence file added by AutoGineer11.1 KiB
- SKILL.md26.2 KiB
- references/agent-gateway.md55.2 KiB
- references/agent-identity.md33.6 KiB
- references/agent-registry.md49.7 KiB
- references/attribution.md1.9 KiB
- references/field-manual.md68.3 KiB
- references/known-issues.md87.6 KiB
- references/policies.md75.2 KiB
references/agent-identity.md
Agent Identity — Debugging Reference
Reference for diagnosing "who is this request from?" issues on Gemini Enterprise Agent Platform / Agent Runtime (Reasoning Engines).
Primary source: https://docs.cloud.google.com/gemini-enterprise-agent-platform/govern/agent-identity-overview.md.txt (mirrored at https://docs.cloud.google.com/iam/docs/agent-identity-overview.md.txt)
Table of Contents
TL;DR for debugging: Lines 27-69
What "agent identity" means (vs service account, vs principal set): Lines 70-112
Identity format and trust domains: Lines 113-142
Principal set forms (for IAM policy debugging): Lines 143-210
How identities are created and bound to ReasoningEngines: Lines 211-280
How to inspect / enumerate the identity at runtime: Lines 281-335
Token format / what shows up in logs: Lines 336-370
Required roles for the identity to function: Lines 371-475
Granting roles — exact gcloud commands: Lines 476-533
Common debugging scenarios: Lines 534-646
Code: pulling the bound token via ADC inside the agent: Lines 647-672
Quick reference — useful URLs: Lines 673-700
TL;DR for debugging
An "agent identity" is a SPIFFE-based, per-agent principal — not a service account. It is bound 1:1 to the runtime resource (e.g. a single
reasoningEngines/<id>).The runtime can use one of three identity modes (
identityTypeenum onReasoningEngineSpec):IDENTITY_TYPE_UNSPECIFIED(legacy),SERVICE_ACCOUNT, orAGENT_IDENTITY. Default is service-account behavior.The actual identity in use at runtime is exposed as
spec.effectiveIdentityon the ReasoningEngine resource. Read this first.IAM bindings use
principal://...(single agent) andprincipalSet://...(group of agents in a trust domain / project / org). The trust domain is per-org or per-orgless-project and usesagents.global.org-<ORG_ID>.system.id.googoragents.global.proj-<PROJECT_NUMBER>.system.id.goog(proj-, neverproject-).The Agent Runtime SDK uses Application Default Credentials, which on the runtime automatically pull the Agent Identity token from the metadata server — no explicit code is required for it to take effect.
A new Agent Identity automatically receives
roles/aiplatform.agentDefaultAccessandroles/aiplatform.agentContextEditor, which already cover core model inference, sessions, and memory. Never grant project-levelroles/aiplatform.expressUserorroles/aiplatform.userto an Agent Identity (they permit deleting/modifying siblingReasoningEngineresources and escalating privileges). For standard project quota/observability, grant only:roles/serviceusage.serviceUsageConsumer,roles/browser,roles/logging.logWriter,roles/monitoring.metricWriter,roles/cloudapiregistry.viewer.A
401 UNAUTHENTICATEDfrom a Google Cloud API in an Agent-Identity-enabled runtime almost always means Context-Aware Access (mTLS / DPoP token-binding) is rejecting the call — not an IAM permission problem. Check binding / egress path before adding roles.Service-account mode default is the Google-managed
service-<PROJECT_NUMBER>@gcp-sa-aiplatform-re.iam.gserviceaccount.com(role:roles/aiplatform.reasoningEngineServiceAgent). To see it in the IAM page you must check "Include Google-provided role grants".Logs show both the agent SPIFFE identity and the end-user identity when an agent is acting on behalf of a user; only the agent identity when acting on its own authority.
What "agent identity" means (vs service account, vs principal set)
Source: https://docs.cloud.google.com/iam/docs/agent-identity-overview.md.txt
Agent Identity provides cryptographic, SPIFFE-based identities for agents so they can authenticate to MCP servers, Google Cloud APIs, the Agent Gateway, and other agents.
Compared to service accounts:
| Property | Service account | Agent Identity |
|---|---|---|
| Shared across workloads | Yes (default) | No — 1 per agent resource |
| Impersonable by other agents | Yes (with role) | No |
| Long-lived keys allowed | Yes | No (system-managed only) |
| Token binding | No | Yes (X.509-bound, DPoP) |
| Identity scope | Project | Tied to runtime resource URI |
Three things commonly get conflated when debugging — keep them distinct:
Service account —
[email protected]. Used whenidentityTypeis unset orSERVICE_ACCOUNT. Granted viaserviceAccount:IAM member.Agent identity (single agent) — a SPIFFE principal bound to one ReasoningEngine. Granted via
principal://<TRUST_DOMAIN>/resources/....Principal set — a group of agent identities (all agents in a project, trust domain, or org). Granted via
principalSet://<TRUST_DOMAIN>/.... Used to apply common roles (logging, quota, model access) to many agents at once without per-agent bindings.
Three-Identity Delegation Architecture
Across Client/Ingress, Agent Runtime/Broker, and Egress/Target Resource trust boundaries, Google Cloud separates three distinct identity layers:
| Identity Layer | Boundary & Format | Security Role & Audit Behavior |
|---|---|---|
| 1. User identity | Client → Agent (CLIENT_TO_AGENT OAuth / OIDC caller) | Identifies the human caller; evaluated by ingress IAP/UAP and Model Armor. |
| 2. Agent identity | Agent → Gateway / Cloud APIs (principal://agents.global.{org-ORG|proj-NUM}.system.id.goog/resources/...) | Cryptographic SPIFFE machine identity (24h auto-rotated X.509 cert + DPoP/CAA binding); brokers 2LO/API keys via Auth Manager when acting autonomously. |
| 3. Delegated identity | Agent → Downstream tool on behalf of user (3LO token via Auth Manager) | Enforces the intersection of agent egress policy + user OAuth scopes; Cloud Audit Logs record both the agent SPIFFE identity and the end-user identity. |
Identity format and trust domains
Source: https://docs.cloud.google.com/iam/docs/agent-identity-overview.md.txt and https://docs.cloud.google.com/gemini-enterprise-agent-platform/govern/identity-delegation-architecture.md.txt
SPIFFE ID (X.509 SAN):
spiffe://<TRUST_DOMAIN>/resources/<SERVICE>/<RESOURCE_PATH>IAM principal:
principal://<TRUST_DOMAIN>/resources/<SERVICE>/<RESOURCE_PATH>
Concrete runtime principal shapes (always use numeric PROJECT_NUMBER):
Agent Runtime (
ReasoningEngine):principal://agents.global.org-123456789012.system.id.goog/resources/aiplatform/projects/9876543210/locations/us-central1/reasoningEngines/1234567890Gemini Enterprise (
Engine):principal://agents.global.org-123456789012.system.id.goog/resources/discoveryengine/projects/9876543210/locations/global/collections/default_collection/engines/my-ge-app(Note: Gemini Enterprise custom/ADK agents may also authenticate with the configured project/custom Service Account depending on connector configuration.)Cloud Run (
--identity-type=agent-identity):principal://agents.global.org-123456789012.system.id.goog/resources/run/projects/9876543210/locations/us-central1/services/my-agent-serviceGKE (
iam.gke.io/spiffe-identity-type: agent-identity): SPIFFE agent identity provisioned via the GKE SPIFFE controller.
Trust domain (auto-provisioned when the Agent Platform API is first enabled):
Org present:
agents.global.org-<ORGANIZATION_ID>.system.id.googOrgless project:
agents.global.proj-<PROJECT_NUMBER>.system.id.goog(proj-, notproject-)
Source: https://docs.cloud.google.com/gemini-enterprise-agent-platform/scale/runtime/agent-identity.md.txt
Principal set forms (for IAM policy debugging)
Source: https://docs.cloud.google.com/iam/docs/principal-identifiers.md.txt
| Scope | Identifier |
|---|---|
| Single | principal://<TRUST_DOMAIN>/resources/<SERVICE>/<RESOURCE_PATH> |
| : agent : : | |
| All | principalSet://<TRUST_DOMAIN>/* |
| : agents in : : | |
| : a trust : : | |
| : domain : : | |
| All | principalSet://<TRUST_DOMAIN>/attribute.platformContainer/aiplatform/projects/<PROJECT_NUMBER> |
| : agents in : : | |
| : a project : : | |
| All | principalSet://agents.global.org-<ORG_ID>.system.id.goog/attribute.platform/aiplatform |
| : agents in : : | |
| : an org : : | |
| DIY | principal://iam.googleapis.com/projects/<PROJECT_NUMBER>/locations/global/workloadIdentityPools/<POOL>/subject/ns/<NS>/sa/<SA> |
| : agents : : | |
| : (workload : : | |
| : identity : : | |
| : pool) : : |
Tips when debugging:
If you see
principalSet://...attribute.platformContainer/aiplatform/projects/<num>in a binding, that is all agents in that project. A binding here grants every agent in the project the role — useful for shared roles (logging/quota), bad for sensitive resources.The
attribute.platform/aiplatformset covers an entire org.
Principal Identifiers in Unified Access Policy (UAP / Policy V2)
Under Unified Access Policy (iam.googleapis.com/v3 AccessPolicy and
PolicyBinding), principal identifiers are specified directly in the
rules[].principals array:
# In AccessPolicy rule definition (singular 'operation', NOT 'operations'):
rules:
- description: "Allow project agents to access registered weather service"
principals:
- "principalSet://agents.global.org-123456789012.system.id.goog/attribute.platformContainer/aiplatform/projects/9876543210"
- "principal://agents.global.org-123456789012.system.id.goog/resources/aiplatform/projects/9876543210/locations/us-central1/reasoningEngines/1234567890"
operation:
permissions:
- "iap.googleapis.com/resources.egressViaIAP"Important rules for UAP principal matching:
Direct Principal vs. PrincipalSet: You can specify either specific
principal://...URIs or broadprincipalSet://...group URIs in theprincipalsarray.Audit Log Correlation: In Cloud Audit Logs (
protoPayload.authenticationInfo.principalSubject), the runtime always logs the exactprincipal://URI of the calling agent, which satisfies either a directprincipal://rule or a container-levelprincipalSet://rule.Service Accounts in UAP: If an agent runs with a custom Service Account (
SERVICE_ACCOUNTmode), the principal string in UAP isserviceAccount:[email protected](orprincipal://iam.googleapis.com/projects/...).
How identities are created and bound to ReasoningEngines
Source: https://docs.cloud.google.com/gemini-enterprise-agent-platform/scale/runtime/agent-identity.md.txt Source: https://docs.cloud.google.com/vertex-ai/generative-ai/docs/reference/rest/v1beta1/projects.locations.reasoningEngines.md.txt
The IdentityType enum on ReasoningEngineSpec:
IDENTITY_TYPE_UNSPECIFIED— same asSERVICE_ACCOUNT. Uses theserviceAccountfield if set, else default Agent Runtime Service Agent.SERVICE_ACCOUNT— same behavior asIDENTITY_TYPE_UNSPECIFIED; explicit.AGENT_IDENTITY— uses Agent Identity. TheserviceAccountfield must not be set when this is selected.
Create with Agent Identity (Python SDK)
import vertexai
from vertexai import types
from vertexai.agent_engines import AdkApp
# v1beta1 is required for Agent Identity support
client = vertexai.Client(
project=PROJECT_ID,
location=LOCATION,
http_options=dict(api_version="v1beta1"),
)
remote_app = client.agent_engines.create(
agent=AdkApp(agent=agent),
config={
"display_name": "running-agent-with-identity",
"identity_type": types.IdentityType.AGENT_IDENTITY,
"requirements": ["google-cloud-aiplatform[adk,agent_engines]"],
"staging_bucket": f"gs://{BUCKET_NAME}",
},
)
print(f"Effective Identity: {remote_app.api_resource.spec.effective_identity}")Create identity-only (no agent code yet) so you can pre-grant IAM
remote_app = client.agent_engines.create(
config={"identity_type": types.IdentityType.AGENT_IDENTITY},
)
# Later: agent_engines.update(...) to add code.Other ways
ADK CLI:
echo '{"identity_type": "AGENT_IDENTITY"}' > .agent_engine_config.json; adk deploy ...Agents CLI:
agents-cli deploy --agent-identity
What gets auto-provisioned
A SPIFFE ID and matching X.509 certificate (rotated; valid 24 h).
roles/aiplatform.agentDefaultAccess(basic project logging + model calls).roles/aiplatform.agentContextEditor(own sessions, memory, sandboxes).A workload access token bound to the X.509 cert; an authorization DPoP proof; an entry in the agent identity pool.
If
identity_typeis not configured, the runtime falls back to service-account mode — preserves backward compatibility for existing IaC deployments.
How to inspect / enumerate the identity at runtime
Source: https://docs.cloud.google.com/gemini-enterprise-agent-platform/scale/runtime/agent-identity.md.txt
Read the effective identity (authoritative)
The spec.effectiveIdentity field on the ReasoningEngine GET response is the
single source of truth. Possible shapes (per the REST reference):
service-{project_number}@gcp-sa-aiplatform-re.iam.gserviceaccount.com—SERVICE_AGENT{name}@{project_id}.iam.gserviceaccount.com—SERVICE_ACCOUNTagents.global.{org-ORG_ID|proj-PROJECT_NUMBER}.system.id.goog/resources/aiplatform/projects/{project_number}/locations/{location}/reasoningEngines/{re}—AGENT_IDENTITY
Example REST response excerpt:
{
"spec": {
"effectiveIdentity": "agents.global.org-ORGANIZATION_ID.system.id.goog/resources/aiplatform/projects/PROJECT_NUMBER/locations/LOCATION/reasoningEngines/AGENT_ENGINE_ID"
}
}Google Cloud console
Google Cloud console -> Agent Platform Deployments. The "Identity" column lists the agent identity for each deployed agent.
gcloud / curl
REST: GET projects/PROJECT/locations/LOCATION/reasoningEngines/ID against the
v1beta1 endpoint, then read spec.effectiveIdentity.
curl -s -H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://LOCATION-aiplatform.googleapis.com/v1beta1/projects/PROJECT/locations/LOCATION/reasoningEngines/ID" \
| jq '.spec.effectiveIdentity, .spec.identityType, .spec.serviceAccount'From inside the agent's container
ADC will already be wired up — confirm with a one-shot tool call:
from google.auth import default
creds, project_id = default()
# creds.service_account_email when SA mode; for AGENT_IDENTITY the credential
# is system-attested and tied to the metadata server. Use ADC to call any
# Google API; identity comes from the bound token.Token format / what shows up in logs
Source: https://docs.cloud.google.com/access-context-manager/docs/caa-agent-security.md.txt Source: https://docs.cloud.google.com/gemini-enterprise-agent-platform/scale/runtime/agent-identity.md.txt
Agent Identity uses two artifacts (not a plain bearer JWT):
X.509 certificate — issued under a Google-managed trust domain. Embeds the agent's SPIFFE ID. Used for mTLS to Agent Gateway.
Certificate-bound workload access token — short-lived OAuth-style token cryptographically bound to the X.509 cert; carries an encrypted authorization DPoP proof.
Network/auth flow (when Agent Gateway is enabled):
Agent -> Agent Gateway: mTLS, certificate-bound token.
Agent Gateway -> Google Cloud API: DPoP (mTLS terminates at the gateway).
CAA verifies the authorization DPoP proof and the resource DPoP proof were signed with the same private key from the agent identity pool.
In Cloud Logging:
Agent acting on its own authority -> entry shows the agent's SPIFFE identity only.
Agent acting on behalf of an end user (via auth manager) -> entry shows both the agent identity and the end-user identity.
When grepping logs the SPIFFE identity will look like the
agents.global.org-...system.id.goog/resources/aiplatform/... form (no
spiffe:// scheme on most log fields — it's the principal form).
Required roles for the identity to function
Source: https://docs.cloud.google.com/gemini-enterprise-agent-platform/scale/runtime/agent-identity.md.txt
Granted automatically on create
roles/aiplatform.agentDefaultAccess— project logging and core model inference (aiplatform.endpoints.predict).roles/aiplatform.agentContextEditor— scoped access to the agent's own sessions, memories, and sandboxes.
Warning: Least-Privilege Guardrail: Do NOT grant project-level
roles/aiplatform.expressUserorroles/aiplatform.userto an Agent Identity (principal://orprincipalSet://). Those roles grantaiplatform.reasoningEngines.{create,delete,update}across the entire project, allowing a compromised agent to overwrite or delete sibling agents and escalate privileges across A2A boundaries.
Recommended baseline (grant manually before/after deploy)
| Role | Why |
|---|---|
roles/serviceusage.serviceUsageConsumer | Consume project quota + Agent Platform SDK |
roles/browser | Basic Google Cloud project/hierarchy metadata lookup |
roles/logging.logWriter | Emit structured application logs |
roles/monitoring.metricWriter | Emit metrics |
roles/cloudapiregistry.viewer | Discover tools via Cloud API Registry |
Least-Privilege Agent-to-Agent (A2A) Invocation (agentInvoker + IAM Deny)
When Agent A invokes Agent B on Agent Runtime, create a minimal custom role and
bind it at resource scope on Agent B only (never project-wide). Because
gcloud does not expose a reasoning-engines IAM subcommand, perform a
read-modify-write via the Vertex AI v1 REST :getIamPolicy and :setIamPolicy
methods (preserving existing bindings and etag):
gcloud iam roles create agentInvoker \
--project=PROJECT_ID \
--title="Agent Runtime Invoker" \
--permissions="aiplatform.reasoningEngines.query,aiplatform.reasoningEngines.get"
# 1. Fetch existing resource-level IAM policy & etag on Agent B
curl -s -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
"https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/reasoningEngines/TARGET_AGENT_B_ID:getIamPolicy" \
-d '{}'
# 2. Apply updated bindings + etag via REST :setIamPolicy (note: raw REST wraps "policy", unlike gcloud iap web)
curl -s -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
"https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/reasoningEngines/TARGET_AGENT_B_ID:setIamPolicy" \
-d '{
"policy": {
"etag": "ETAG_FROM_GET_IAM_POLICY",
"version": 3,
"bindings": [
{
"role": "projects/PROJECT_ID/roles/agentInvoker",
"members": [
"principal://agents.global.org-ORGANIZATION_ID.system.id.goog/resources/aiplatform/projects/PROJECT_NUMBER/locations/LOCATION/reasoningEngines/CALLER_AGENT_A_ID"
]
}
]
}
}'For defense in depth, attach an Organization/Project IAM Deny policy denying
aiplatform.googleapis.com/reasoningEngines.{create,delete,update} to
principalSet://agents.global.org-ORGANIZATION_ID.system.id.goog/*.
Tool, Gateway, & Cross-Project Roles (often missed)
roles/iamconnectors.useron theAuthProviderresource — required for Auth Manager 2LO/3LO token brokering.IAP egress through Agent Gateway:
Policy V1 (
gcloud iap web):roles/iap.egressor(iap.webServiceVersions.egressViaIAP) bound with--resource-type=agent-registry.UAP Policy V2 (
iapPolicyVersion: "V2"):iap.googleapis.com/resources.egressViaIAPin anAccessPolicybound to the governance project/folder/org.
Cross-project Agent Runtime → Central Agent Gateway: In the central gateway project, grant the deploying user
networkservices.agentGateways.usenetworkservices.agentGateways.get(roles/networkservices.viewer), and grant the runtime project's AI Platform Service Agent (service-RUNTIME_PROJECT_NUMBER@gcp-sa-aiplatform.iam.gserviceaccount.com)roles/networkservices.vieweror a custom role (ae_agw_cross_project_sa/ar_agw_cross_project_sawithnetworkservices.agentGateways.get,networkservices.operations.get). Both runtime and gateway must reside in the same region.
Service-account mode (legacy default)
Default SA:
service-<PROJECT_NUMBER>@gcp-sa-aiplatform-re.iam.gserviceaccount.com
(roles/aiplatform.reasoningEngineServiceAgent). Custom SAs require explicit
least-privilege roles (e.g., roles/storage.objectViewer on staging buckets).
Granting roles — exact gcloud commands
Source: https://docs.cloud.google.com/gemini-enterprise-agent-platform/scale/runtime/agent-identity.md.txt
Single agent
gcloud RESOURCE_TYPE add-iam-policy-binding RESOURCE_ID \
--member="principal://agents.global.org-ORGANIZATION_ID.system.id.goog/resources/aiplatform/projects/PROJECT_NUMBER/locations/LOCATION/reasoningEngines/AGENT_ENGINE_ID" \
--role="ROLE_NAME"All agents in a project (with org)
gcloud projects add-iam-policy-binding PROJECT_ID \
--member="principalSet://agents.global.org-ORGANIZATION_ID.system.id.goog/attribute.platformContainer/aiplatform/projects/PROJECT_NUMBER" \
--role=roles/serviceusage.serviceUsageConsumer
# Repeat for browser, cloudapiregistry.viewer, logging.logWriter, monitoring.metricWriter.All agents in an orgless project (proj-, NOT project-)
gcloud projects add-iam-policy-binding PROJECT_ID \
--member="principalSet://agents.global.proj-PROJECT_NUMBER.system.id.goog/attribute.platformContainer/aiplatform/projects/PROJECT_NUMBER" \
--role="ROLE_NAME"All agents across an org
gcloud RESOURCE_TYPE add-iam-policy-binding RESOURCE_ID \
--member="principalSet://agents.global.org-ORGANIZATION_ID.system.id.goog/attribute.platform/aiplatform" \
--role="ROLE_NAME"List the roles attached to a deployed (SA-mode) agent
gcloud projects get-iam-policy PROJECT_ID_OR_NUMBER \
--flatten="bindings[].members" \
--filter="bindings.members:serviceAccount:PRINCIPAL" \
--format="value(bindings.role)"For Agent-Identity mode, filter against the principal string instead:
gcloud projects get-iam-policy PROJECT_ID \
--flatten="bindings[].members" \
--filter="bindings.members:principal://agents.global.org-ORG.system.id.goog/resources/aiplatform/projects/PROJECT_NUMBER/locations/LOCATION/reasoningEngines/AGENT_ID" \
--format="value(bindings.role)"Common debugging scenarios
"Who is this request from?" — start here
GETthe ReasoningEngine, readspec.identityTypeandspec.effectiveIdentity.If
identityTypeisAGENT_IDENTITY, the principal in IAM/audit logs will be the SPIFFE-styleagents.global..... IfSERVICE_ACCOUNT, expect a[email protected](default) or custom SA email.Search audit logs for that exact string.
401 UNAUTHENTICATED from a Google Cloud API
Source: https://docs.cloud.google.com/iam/docs/troubleshoot-auth-manager.md.txt
{ "error": { "code": 401, "status": "UNAUTHENTICATED",
"message": "Request had invalid authentication credentials..." } }This is usually Context-Aware Access rejecting an unbound or shared token, not a missing IAM role. Confirm:
The call originates from the deployed runtime container (not local dev).
mTLS / DPoP path is intact (see CAA flow in section 4).
If you must work around (NOT recommended in production), set
GOOGLE_API_PREVENT_AGENT_TOKEN_SHARING_FOR_GCP_SERVICES=Falseviaenv_varsonagent_engines.create(...). This disables token binding.
403 PERMISSION_DENIED after switching to AGENT_IDENTITY
The Agent Runtime Service Agent's project-wide grants do not transfer to the per-agent identity. The agent has only the two default roles. Add baseline roles via the principalSet binding, then per-agent grants for sensitive resources.
IAP / Agent Gateway egress denied
You need an roles/iap.egressor binding on the IAP/endpoint with the agent
principal as members. Per the policy assignment doc:
{
"bindings": [
{
"role": "roles/iap.egressor",
"members": [
"principal://agents.global.org-123456789012.system.id.goog/resources/aiplatform/projects/9876543210/locations/us-central1/reasoningEngines/1234567890123456789"
]
}
],
"version": 3
}Warning:
gcloud iap web set-iam-policyrequires a top-level IAMPolicyJSON object ({"bindings": [...]}). Do NOT wrap"bindings"inside{"policy": ...}(which is used only by raw REST:setIamPolicycalls) — passing{"policy": ...}togcloud iap web set-iam-policysubmits an empty policy and silently wipes all existing IAP bindings!
Apply with gcloud iap web set-iam-policy policy.json --project=PROJECT_ID --region=LOCATION --resource-type=agent-registry (adding
--endpoint=ENDPOINT_UUID, --mcp-server=MCP_UUID, or --agent=AGENT_UUID
alongside --resource-type=agent-registry for per-resource scope; omitting
--resource-type=agent-registry targets IAPWebLocation iap_web and ignores
child flags).
403 Egress / Auth Error Calling an MCP Server on Cloud Run
Choose the pattern matching how the Cloud Run service is secured:
Standard Cloud Run IAM (
roles/run.invoker) — Service Account Impersonation Required: Direct Agent Identity (principal://...) to Cloud Run OIDC authentication is not natively supported. Configure the agent code to use Service Account impersonation (google.auth.impersonated_credentials.IDTokenCredentials) to mint an OIDC ID token for the Cloud Run URL:Grant
roles/iam.serviceAccountTokenCreatorto the Agent Identity on the target Service Account.Grant
roles/run.invokerto that target Service Account on the Cloud Run service, and authorize egress to the Cloud Run URL in Agent Registry + IAP/UAP.
Preview — Cloud Run Native IAP for MCP Servers (
--iap --functional-type=mcp-server): Deploy or update the Cloud Run MCP service with native IAP instead of application-layer SA impersonation:gcloud beta run deploy MCP_SERVICE_NAME \ --image=IMAGE_URL --region=REGION \ --allow-unauthenticated --iap --functional-type=mcp-serverGrant
roles/run.invokeron the Cloud Run service to the IAP service agent ([email protected]), grantroles/iap.httpsResourceAccessoron--resource-type=cloud-run --service=MCP_SERVICE_NAME, and target the.run.appshort URL (https://MCP_SERVICE_NAME-PROJECT_NUMBER.REGION.run.app).
Workforce Identity Federation (WIF) Console Errors or gcloud error 13
Federated workforce identities have limited Preview support across Agent Gateway
and Agent Registry control planes. Running gcloud network-services agent-gateways import or gcloud agent-registry commands as a WIF user can fail
with error 13: an internal error has occurred or 403, and granting broader
IAM roles to the federated principal does not fix it. Authenticate with a
standard Cloud Identity or Google Workspace account (see BKI #36).
Agent can't use an auth provider (Auth Manager) & OIDC issuer reachability
Verify roles/iamconnectors.user is granted to the agent identity on the
AuthProvider resource, and confirm .well-known/openid-configuration and JWKS
endpoints are publicly reachable.
Code: pulling the bound token via ADC inside the agent
Source: https://docs.cloud.google.com/iam/docs/auth-agent-own-identity.md.txt
from google.auth import default
from google.cloud import vision
# ADC automatically retrieves the Agent Identity token from the
# metadata server. No code changes vs. SA mode.
creds, project_id = default()
client = vision.ImageAnnotatorClient(credentials=creds, project=project_id)If you opt out of CAA (token sharing), set on deploy:
config={
"env_vars": {
"GOOGLE_API_PREVENT_AGENT_TOKEN_SHARING_FOR_GCP_SERVICES": False,
},
}Quick reference — useful URLs
Agent identity overview (govern): https://docs.cloud.google.com/gemini-enterprise-agent-platform/govern/agent-identity-overview.md.txt
Agent identity overview (IAM mirror): https://docs.cloud.google.com/iam/docs/agent-identity-overview.md.txt
Agent identity in runtime (create / list / grant): https://docs.cloud.google.com/gemini-enterprise-agent-platform/scale/runtime/agent-identity.md.txt
Setup identity & permissions: https://docs.cloud.google.com/gemini-enterprise-agent-platform/build/runtime/setup.md.txt
Manage agent access (SA mode): https://docs.cloud.google.com/gemini-enterprise-agent-platform/scale/runtime/manage-agent-access.md.txt
Principal identifiers (table of all forms): https://docs.cloud.google.com/iam/docs/principal-identifiers.md.txt
ReasoningEngineSpec REST reference: https://docs.cloud.google.com/vertex-ai/generative-ai/docs/reference/rest/v1beta1/projects.locations.reasoningEngines.md.txt
Context-Aware Access for agents (mTLS / DPoP): https://docs.cloud.google.com/access-context-manager/docs/caa-agent-security.md.txt
Auth manager troubleshooting (401 / connectors role): https://docs.cloud.google.com/iam/docs/troubleshoot-auth-manager.md.txt
Auth using agent's own identity (ADC sample): https://docs.cloud.google.com/iam/docs/auth-agent-own-identity.md.txt
Configure IAM policies (IAP egressor examples): https://docs.cloud.google.com/gemini-enterprise-agent-platform/govern/policies/configure-iam-policies.md.txt
Three-identity delegation architecture: https://docs.cloud.google.com/gemini-enterprise-agent-platform/govern/identity-delegation-architecture.md.txt
Secure Cloud Run MCP servers with IAP: https://docs.cloud.google.com/gemini-enterprise-agent-platform/govern/policies/iap-cloud-run-mcp.md.txt
Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Needs an MCP server
Security
No issues found by our static scan· No issues found
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Published by
- Publisher
- Google (Official)
- Source
- google/skills · skills/cloud/agent-platform-troubleshooting · commit 2194d3b
- Licence
- Apache License 2.0 (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by Google.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download agent-platform-troubleshooting.zip