Troubleshoots Google Cloud Gemini Enterprise Agent Platform issues across Agent Gateway, Agent Connectivity Templates (ACT), Agent Registry, Agent Identity, Identity-Aware Proxy (IAP), Unified Access Policies (UAP), Model Armor, Semantic Governance Policies (SGP), Cloud DNS peering, Private CA TrustConfig, Next-Hop Secure Web Proxy (SWP), Explicit HTTPS Proxy (L4 AuthzPolicy), and Cloud Trace. Use when agent requests fail with 401/403/404/498/500/503 or Code 13, Egress request is not authorized, HTTP CONNECT fails with 404, Agent Runtime crashes on startup, or gateway/ACT/IAP/Model Armor/SGP configs fail validation. Don't use for general Google Cloud Identity and Access Management (IAM) debugging or networking issues unrelated to the Agent Platform stack.
Written by Google and published in google/skills under the Apache-2.0 license. Treq shows it unchanged except for heading levels and links to files on GitHub.
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.
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.
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.
If the prompt asks about Compute Engine (GCE), Cloud Storage (GCS) buckets, or generic GCP IAM permissions unrelated to the Agent Platform stack:
If asked to write, generate, compile, or execute a custom Python or bash script to discover resources (e.g., active Agent Runtime instances):
gcloud agent-registry agents list --location=us-central1 or curl -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" "https://us-central1-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/reasoningEngines""If asked about registering multiple Agent Runtime, Cloud Resource Manager, or Google API interfaces, or structuring services in Agent Registry:
googleapis service entry in
Agent Registry via gcloud agent-registry services create googleapis --endpoint-spec-type=no-spec.https://aiplatform.googleapis.com when 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.comreferences/agent-registry.md §2 for the full command.If an agent gets a 401 or 403 egress error calling an MCP server or tool on
Cloud Run or Cloud Functions:
principalSet://... / principal://...)
to standard Cloud Run OIDC authentication is not natively supported.roles/iam.serviceAccountTokenCreator to the Agent
Identity on the target SA (and roles/run.invoker to that SA on Cloud Run).--iap --functional-type=mcp-server, run.app short URL), authorize via IAP/UAP
instead of roles/run.invoker (see references/known-issues.md BKI 21 and
references/agent-identity.md).If Agent Runtime startup crashes (set_up()) with connection resets or
handshake errors reaching telemetry.mtls.googleapis.com:
gcloud agent-registry endpoints list):
telemetry.mtls.googleapis.com, monitoring.googleapis.com,
trace.mtls.googleapis.com, and cloudtrace.googleapis.com.gcloud agent-registry services create --endpoint-spec-type=no-spec (which projects read-only
Endpoints in Agent Registry for telemetry.mtls.googleapis.com,
monitoring.googleapis.com, trace.mtls.googleapis.com, and
cloudtrace.googleapis.com).AuthorizationPolicy (AuthzPolicy / IAP / UAP)
bound to the Gateway that allows the agent's principal set (identity) to
access the telemetry endpoints (see references/known-issues.md BKI 23).403 / Egress request is not authorized)When logs or symptoms show 403 / Egress request is not authorized via IAP:
roles/iap.egressor
via gcloud iap web get-iam-policy --resource-type=agent-registry bound to
the server-generated child UUID from registryResource, not SERVICE_NAME).gcloud agent-registry services create) if none
exists for the exact target hostname.roles/iap.egressor on the registry entry (IAM v1 — set-iam-policy requires top-level {"bindings": [...]} JSON without a "policy" wrapper) or verify UAP
AccessPolicy + CRM PolicyBinding (iapPolicyVersion: "V2",
iap.googleapis.com/resources.egressViaIAP; see references/policies.md §2).protoPayload.serviceName="iap.googleapis.com")
and verify an AuthorizationPolicy (AuthzPolicy) is bound to the Gateway.roles/iap.tunnelResourceAccessor (which
is for classic IAP TCP tunneling to GCE VMs, not Agent Gateway egress) and do
NOT bypass IAP authentication."PROVISIONING Hang)When diagnosing gateway provisioning stuck or failing on subnet IP exhaustion:
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-central1Usable - Allocated = Free) before recommending any
Network Attachment deletion; flag that a /28 subnet is easily exhausted and
recommend expanding the CIDR range to at least /26 (known-issues.md BKI 19).us / eu)If asked about manually registering endpoints or services in us or eu:
us or eu
multi-region locations (us and eu are read-only roll-up locations for
auto-discovered resources)." (Explicitly name BOTH us and eu.)us-central1) or global."ALL_TRAFFICWhen diagnosing VPC-SC perimeter blocks or external API hangs under VPC-SC:
vpcEgress: ALL_TRAFFIC (native VPC-SC creation works out of the box since Sept 8,
2026 when vpcEgress: ALL_TRAFFIC is set) and that Cloud NAT is
configured on the consumer VPC's PSC-I network attachment subnet.references/known-issues.md BKI 18 & 28.DENY CrashCUSTOM_ORG_POLICY_VIOLATION on gcloud iam policy-bindings create:
Caused by constraints/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).destination.is_registered == false DENY:
Explain that the blanket DENY blocked internal/unauthenticated SDK bootstrap
and metadata calls (such as Cloud Resource Manager project lookups) during
Reasoning Engine init; remove or scope the blanket DENY rule (BKI 5).When configuring or validating registries on an Agent Gateway:
global and the
other must be regional or multi-regional.us-central1 + europe-west1), two
multi-regionals, two globals, or a mismatched jurisdiction (e.g., us-central1
gateway + eu registry) is invalid and rejected with an HTTP 400
validation error (references/agent-gateway.md §4, BKI 26).When Reasoning Engine in Project 1 fails to bind to a Gateway in Project 2:
networkservices.agentGateways.use and
networkservices.agentGateways.get (or roles/networkservices.viewer) in Project 2.roles/networkservices.viewer or custom
role ae_agw_cross_project_sa (alias ar_agw_cross_project_sa) to
service-PROJECT_1_NUMBER@gcp-sa-aiplatform.iam.gserviceaccount.com in Project 2.GOOGLE_API_PREVENT_AGENT_TOKEN_SHARING_FOR_GCP_SERVICES
to False (references/known-issues.md BKI 10, references/agent-gateway.md §11).Distinguish the two supported consumer-VPC proxy architectures:
HTTPS_PROXY needed):
type: SECURE_WEB_GATEWAY and
routingMode: NEXT_HOP_ROUTING_MODE on an internal IP on the PSC-I subnet
(e.g., 10.20.1.250), with a /26 REGIONAL_MANAGED_PROXY ACTIVE subnet.10.20.1.0/24
to --next-hop-ilb-ip=10.20.1.250 (priority 200) + fallback PBR (1000).ENDPOINT_TYPE_SWG (nats create ... --endpoint-types=ENDPOINT_TYPE_VM,ENDPOINT_TYPE_SWG),
and allowlist <region>-aiplatform.mtls.googleapis.com in SWP CEL (BKI 33).HTTPS_PROXY + L4 AuthzPolicy):
HTTPS_PROXY=https://proxy.corp.internal:443 fails on
HTTP CONNECT with HTTP 404 because Agent Gateway's L7 HTTP manager
terminates TLS and rejects nested CONNECT.v1beta1 L4 AuthzPolicy via gcloud beta network-security authz-policies import with action: ALLOW and networkRules matching
to.operations[].snis (omit target.loadBalancingScheme and ports; max 5 rules;
omit from or include 7.0.0.0/8 + PSC-I CIDR in from.sources[].ipBlocks).:443, allow the consumer PSC-I subnet CIDR on VPC firewall/proxy ACLs (never 7.0.0.0/8),
set NO_PROXY/no_proxy to .googleapis.com,googleapis.com,metadata.google.internal,169.254.169.254,localhost,127.0.0.1,
bundle agentGatewayCard.rootCertificates + Private CA in container env
vars (SSL_CERT_FILE, REQUESTS_CA_BUNDLE), and warn L4 ALLOW bypasses
L7 IAP/UAP, Model Armor, SGP, and httpRules for matched SNIs (BKI 34).TrustConfig, Model Armor, SGP, MCP, Identity, & LifecyclednsPeeringConfig (domains array with trailing .; ACT
uses string targetNetwork only, whereas inline AgentGateway.networkConfig.dnsPeeringConfig
also requires targetProject). Cloud DNS caps total peering hops at 2
(Gateway consumes Hop 1 → max 1 consumer peering hop; a 2nd hop fails preflight
or returns SERVFAIL → 503, BKI 35). Grant roles/dns.peer, roles/dns.reader,
roles/compute.networkViewer, and roles/compute.networkUser to
service-GATEWAY_PROJECT_NUMBER@gcp-sa-agentgateway.iam.gserviceaccount.com
(and compute.networkAttachments.use to caller, BKI 9). Never use authoritative "." private root zones ("." requires a Cloud DNS Private Forwarding Zone).TrustConfig & Immutable ACT: Set egressNetworkConfig.tlsConfig.trustConfig
with additionalRoots: PUBLICLY_TRUSTED_ROOTS (omitting breaks *.googleapis.com).
ACT fields are immutable — create a new ACT and rebind via PATCH with
updateMask=agentConnectivityTemplate (BKI 6).CONTENT_AUTHZ): Ingress (CLIENT_TO_AGENT, max 1, ADK
streamQuery only) uses service-AGENT_PROJECT_NUMBER@gcp-sa-aiplatform-re.iam.gserviceaccount.com;
Egress (AGENT_TO_ANYWHERE, max 4) uses service-GATEWAY_PROJECT_NUMBER@gcp-sa-dep.iam.gserviceaccount.com.
Scope httpRules when to exclude gRPC and streams >60 seconds (Stream removed, BKI 13).gcp-sa-aiplatform, non-streaming
LLM calls only, .contains() + !request.headers['content-type'].startsWith('application/grpc')
in when, and full-map updates on PATCH ?updateMask=metadata so
sgpEnforcementMode: "DRY_RUN" and sgpUserIntentMatching are preserved (BKI 38).baseProtocolMethodsOption: MATCH_BASE_PROTOCOL_METHODS on MCP ALLOW rules (BKI 39). Orgless trust
domains use agents.global.proj-PROJECT_NUMBER.system.id.goog (proj-, never
project-); never grant roles/aiplatform.expressUser or project-wide
roles/aiplatform.user to Agent Identities. For Cloud Trace (TelemetryPolicy),
always recommend enabling cloudtrace.googleapis.com (gcloud services enable cloudtrace.googleapis.com)
and granting roles/cloudtrace.agent to compute-system, gcp-sa-networksecurity,
and gcp-sa-agentgateway (see references/agent-gateway.md §8.3 and references/field-manual.md Step 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).| 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 |
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.
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).
Follow in order (copy-paste commands in references/field-manual.md):
gcloud projects describe $PROJECT_ID).403, 404 CONNECT, 498,
500, 503, crash, timeout). Check PSC subnet IPs, ACT ALL_TRAFFIC + Cloud
NAT, and agentGatewayCard.rootCertificates CA trust.networkservices.googleapis.com/Gateway
(filtering -httpRequest.requestMethod="CONNECT" when inspecting L7 requests)
to find the exact failing SNI/hostname and serviceExtensionsInfo.iapPolicyVersion (V1 vs
V2), DRY_RUN vs enforced, Model Armor callout status, or
logs/semantic-governance-policy verdicts and rationales.gcloud agent-registry {services,endpoints,mcp-servers,agents} list and
confirm dual-registry + jurisdiction rules.roles/iap.egressor via
--resource-type=agent-registry on the child UUID (V1), UAP
AccessPolicy/PolicyBinding + constraints/iam.managed.disableAccessPolicyBinding
(V2), PAB overrides, and least-privilege Agent Identity roles (proj- for orgless).networkRules vs L7
httpRules, MCP MATCH_BASE_PROTOCOL_METHODS, Model Armor / SGP when
exclusions, ExtensionBinding scope, and policy caps (max 4 egress, max 1 ingress CONTENT_AUTHZ).TrustConfig
(PUBLICLY_TRUSTED_ROOTS), gcp-sa-agentgateway IAM, <=2 DNS peering hops,
no Packet Intercept on the consumer VPC, and SWP/Explicit Proxy settings.principal://
binding if principalSet:// lags; for Cloud Trace, enable cloudtrace.googleapis.com, verify v1beta1 TelemetryPolicy (telemetryTarget referencing agentGateways/* and object parentBasedSampling: {enabled: true, samplingRate: 1.0}, never string ENABLED), and grant roles/cloudtrace.agent to service-<PROJECT_NUMBER>@compute-system.iam.gserviceaccount.com, service-<PROJECT_NUMBER>@gcp-sa-networksecurity.iam.gserviceaccount.com, and service-<PROJECT_NUMBER>@gcp-sa-agentgateway.iam.gserviceaccount.com.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):
AuthzPolicy, MCP, UAP v3beta, Model Armor, SGPservices vs projected endpoints, 9 API families, jurisdictionsAlways 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>
AuthzPolicy → Extension → IAP/UAP/Model Armor/SGP → PAB (PAB overrides IAM Allow).networkRules enables HTTP CONNECT explicit proxies (:443) but bypasses L7 IAP, Model Armor, and SGP for matched SNIs.us-central1 unless logs indicate otherwise, and pass --quiet.Claude Code and Codex keep each installed skill's name and description in context. When a request matches the description, the agent loads the full SKILL.md. You can also run it yourself: type /agent-platform-troubleshooting in Claude Code or $agent-platform-troubleshooting in Codex.
The description says when to use it:
Use when agent requests fail with 401/403/404/498/500/503 or Code 13, Egress request is not authorized, HTTP CONNECT fails with 404, Agent Runtime crashes on startup, or gateway/ACT/IAP/Model Armor/SGP configs fail validation.
Copy the agent-platform-troubleshooting folder into .claude/skills/ in your project. To use it in every project, copy it into ~/.claude/skills/ instead.
git clone --depth 1 https://github.com/google/skills.git /tmp/google-skills
mkdir -p .claude/skills
cp -r /tmp/google-skills/skills/cloud/agent-platform-troubleshooting .claude/skills/
Codex reads skills from .agents/skills/ in your repository, and from ~/.agents/skills/ for every repository. It detects new skills on its own. Restart Codex if agent-platform-troubleshooting does not appear.
git clone --depth 1 https://github.com/google/skills.git /tmp/google-skills
mkdir -p .agents/skills
cp -r /tmp/google-skills/skills/cloud/agent-platform-troubleshooting .agents/skills/
Open Settings and select the Skills tab. The tab appears when Skills installation is on under Settings → Feature Preview. Search for agent-platform-troubleshooting and choose Install….
Install for repository writes the skill under .treq/skills/ in the current repository. Install for application makes it available to every repository on this machine. Each new workspace gets a copy in .claude/skills/ and .agents/skills/, so Claude Code and Codex both find it. See Installing Skills from the Library.
agent-platform-troubleshooting ships 8 files, 397.7 KB in total. Select a file to load it from GitHub.