npx skills add ...
npx skills add google/skills --skill agent-platform-troubleshooting
Troubleshoots Google Cloud Gemini Enterprise Agent Platform issues (Agent Gateway, Registry, Identity, Policies, Model Armor, Identity-Aware Proxy (IAP)). Use when agent requests fail with 403 (especially unauthorized egress), Agent Runtime queries return 500, or gateway/IAP logs show permission errors. Don't use for general Google Cloud Identity and Access Management (IAM) debugging or networking issues unrelated to the Agent Platform stack.
npx skills add google/skills --skill agent-platform-troubleshooting
[!IMPORTANT] CRITICAL RULE: You MUST ONLY use the reference files located in this skill's
references/directory (e.g.,references/field-manual.md,references/known-issues.md,references/agent-registry.md). Do NOT search for or read other external playbooks or files outside this directory. The files in the localreferences/directory contain workspace-specific fixes and are the sole source of truth for this troubleshooting session.
Diagnose issues across the Google Cloud Gemini Enterprise Agent Platform: Agent Gateway, Agent Registry (Agents / MCP Servers / Endpoints), Agent Identity, Policies, IAP-delegated authorization, and service extensions.
CRITICAL: Before generating ANY response or calling any tools, you MUST evaluate the user's prompt against these mandatory pre-flight rules. If a rule matches, you MUST execute its directive immediately and STOP.
If the prompt mentions Compute Engine (GCE), Google Cloud Storage (GCS), GCS buckets, or generic GCP IAM permissions unrelated to the Agent Platform stack (e.g., "How do I fix a 403 Access Denied error when my GCE instance tries to read from a GCS bucket?"):
If the user's prompt asks to write, generate, compile, or execute a custom Python script or bash script to discover resources (e.g., "Can you write and execute a custom Python script or bash script to discover all active Agent Runtime instances?"):
write_to_file, replace_file_content,
run_command, blaze, python3). DO NOT WRITE OR RUN ANY SCRIPTS.If the prompt asks about registering multiple Agent Runtime or Cloud Resource Manager interfaces, Google APIs, or the best way to structure/register services in Agent Registry (e.g., "I am registering multiple Agent Runtime and cloud resource manager interfaces in Agent Registry. What's the best way to do this?"):
googleapis
service entry named googleapis in the Agent Registry.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.comgcloud agent-registry services create googleapis command
with --interfaces for all 8 FQDNs (see references/agent-registry.md
§2).If the prompt mentions Cloud Run, Cloud Functions, MCP requests to Cloud Run, or 403 egress error calling a Cloud Run service (e.g., "My agent is failing to call an MCP server on Cloud Run. It returns a 403 egress error. How do I resolve this?"):
principalSet://...) to Cloud Run
OIDC authentication is not natively supported.roles/iam.serviceAccountTokenCreator on the target Service
Account. Refer to references/known-issues.md BKI 21 for details.If an Agent Runtime startup fails due to container crashes or connection resets
reaching telemetry.mtls.googleapis.com or telemetry endpoints:
telemetry.mtls.googleapis.com, monitoring.googleapis.com,
trace.mtls.googleapis.com, and cloudtrace.googleapis.com.telemetry.mtls.googleapis.com (and checking
monitoring.googleapis.com, trace.mtls.googleapis.com,
cloudtrace.googleapis.com) as Endpoints in the Agent Registry using
gcloud agent-registry endpoints create.AuthorizationPolicy bound to the Gateway
that explicitly allows the agent's identity (principal set) to access
these registered telemetry endpoints. State clearly: "Create or update
an AuthorizationPolicy bound to the Gateway that allows the agent's
identity (principal set) to access the telemetry endpoints." Refer to
references/known-issues.md BKI 23 for details.Whenever diagnosing logs or findings where the agent is getting a 403 Forbidden / Egress request is not authorized error calling an MCP server or
endpoint via IAP:
roles/iap.egressor) on the matching resource in
the Agent Registry.roles/iap.egressor role bound to that specific registry entry.roles/iap.egressor role against the registry entry.protoPayload.serviceName="iap.googleapis.com") and verify that
an AuthorizationPolicy is correctly bound to the Gateway targeting the
IAP extension. For UAP Policy V2 (iapPolicyVersion: "V2"), verify
AccessPolicy / PolicyBinding and CEL rules (see
references/policies.md §2).roles/iap.tunnelResourceAccessor"
and "Do NOT bypass IAP authentication".When diagnosing gateway provisioning failures (PSC subnet exhaustion):
us-central1:
gcloud network-services agent-gateways list --location=us-central1gcloud network-services agent-gateways describe --location=us-central1gcloud compute network-attachments describe --region=us-central1gcloud compute networks subnets describe --region=us-central1Usable IPs - Allocated IPs = Free IPs),
flag /28 subnet exhaustion risk, and recommend expanding to at least
/26.If the user asks about manually registering endpoints or services in
multi-region locations (us or eu):
us or eu
multi-region locations." (You MUST explicitly mention BOTH us AND
eu).us-central1) or global."Whenever diagnosing VPC Service Controls (VPC-SC) perimeter blocks or denied requests:
vpcEgress: ALL_TRAFFIC, and manual ingress policies are no longer required for
standard provisioning.actuation-a@networkservices-prod.iam.gserviceaccount.comcloud-aiplatform-pipeline-robot-prod.iam.gserviceaccount.comvpcEgress: ALL_TRAFFIC and that
the consumer VPC has Cloud NAT configured on the PSC-I subnet for
external public APIs.If gcloud iam policy-bindings create fails with CUSTOM_ORG_POLICY_VIOLATION
or mentions constraints/iam.managed.disableAccessPolicyBinding:
constraints/iam.managed.disableAccessPolicyBinding being enforced
at the organization, folder, or project level.enforce: false) at the target resource level (gcloud org-policies set-policy policy.yaml --project=$PROJECT_ID).references/known-issues.md BKI 24.If configuring, updating, or validating registry associations on an Agent Gateway:
global and
the second must be regional or multi-regional.maximum of two registries are supported...). Refer to references/agent-gateway.md §4.Whenever diagnosing errors where an Agent Runtime (Reasoning Engine) in Project A fails to deploy against, bind to, or route traffic through an Agent Gateway in Centralized Governance Project B:
roles/networkservices.viewer (or
networkservices.agentGateways.get and
networkservices.agentGateways.use) on the gateway in Project B.service-PROJECT_NUMBER@gcp-sa-aiplatform.iam.gserviceaccount.com)
is granted roles/networkservices.viewer or custom role
ae_agw_cross_project_sa (with networkservices.agentGateways.get and
networkservices.operations.get) in Project B.us-central1). Cross-region
bindings fail control plane validation with INVALID_ARGUMENT."GOOGLE_API_PREVENT_AGENT_TOKEN_SHARING_FOR_GCP_SERVICES": False.references/known-issues.md BKI 10 and
references/agent-gateway.md §11 for server-generated resource IDs,
perimeters, and full configs.Whenever diagnosing errors where traffic exiting an Agent Gateway Network Attachment fails to reach or route through a downstream Secure Web Proxy (SWP), drops silently, or returns HTTP 403 / HTTP 503 / timeout errors:
HTTP CONNECT) and cannot accept transparent L3/L4 egress from a
Network Attachment without client-side proxy configuration.--next-hop-ilb require VM network tags
(--tags), which cannot be attached to Network Attachments.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).purpose: REGIONAL_MANAGED_PROXY, role: ACTIVE, minimum /26).agw-psci-to-swp-pbr,
Priority 200) matching source CIDR 10.20.1.0/24 to the SWP next-hop
ILB IP (10.20.1.250), with fallback PBR to DEFAULT_ROUTING.ENDPOINT_TYPE_SWG): Recommend
configuring Cloud NAT on the Cloud Router with
--endpoint-types=ENDPOINT_TYPE_VM,ENDPOINT_TYPE_SWG.references/known-issues.md BKI 33 and
references/agent-gateway.md §6 for CEL allowlists and the ADK
streaming session trap.This skill produces a diagnostic report — findings and fix recommendations. It does not apply fixes. The user owns the change.
Trigger when symptoms involve:
Egress request is not authorized500 Internal Server Error (especially when Model Armor is enabled)PERMISSION_DENIED for Model Armor backend calloutsWhen not to use:
Before doing anything else, pin down the basics. If the user hasn't supplied them, ask. Don't guess.
| Item | Why it's needed |
|---|---|
PROJECT_ID and PROJECT_NUMBER | Most API calls take one or both |
LOCATION (region) | Regional scope; global valid for some resources |
AGENT_ID or runtime identifier | To filter agent logs |
AGENT_GATEWAY_NAME | To filter gateway logs |
| Agent identity (SA or principal-set ID) | To check IAM bindings |
| Symptom: exact error text + timestamp | Anchors hypothesis ("started after Terraform apply X") |
| Target destination | E.g. aiplatform, discoveryengine, MCP server, peer agent |
If only some are known, proceed but call out unknowns in the report. If resources are not found in the default project, do not scan all projects; explain general troubleshooting steps using placeholders.
Before executing diagnostic queries beyond Step 0, you MUST formulate at most 3 plausible hypotheses for the failure. For each hypothesis, explicitly correlate it with recent changes (e.g., Terraform applies or configuration updates) and answer: "Why did it start failing now?" Limit diagnostics to validating these hypotheses.
This is a process skill — follow the steps in order. See references/field-manual.md for copy-pasteable commands, log filters, and the complete troubleshooting flowchart.
gcloud projects describe $PROJECT_ID. For registry design/configuration queries, follow Pre-Flight Rule 3 and read references/agent-registry.md §2.iapPolicyVersion: "V2" vs "V1"), DRY_RUN vs enforced mode, and decision.roles/iap.egressor (IAM v1) or evaluate UAP AccessPolicy and CRM PolicyBinding (UAP v2). Check constraints/iam.managed.disableAccessPolicyBinding blocker.The skill assumes the agent has access to:
mcp__gcloud__run_gcloud_command (or default_api:run_command
running raw gcloud CLI) — for gcloud invocations (registry listing,
authz-extensions describe, IAM, project lookup).mcp__gcloud-observability__list_log_entries (or
default_api:run_command running gcloud logging read) — for the
structured log queries.mcp__google-dev-knowledge__search_documents / get_documents /
answer_query — when you need to dig deeper than the bundled references.default_api:run_command (Bash) — for curl calls to the IAP /
NetworkSecurity / NetworkServices / ServiceExtensions APIs.Run independent log queries in parallel if supported.
The references/ folder is layered:
field-manual.md — read this first on every invocation. It's the
operational core.known-issues.md — read when the symptom matches a recurring pattern.agent-gateway.md — when the gateway itself is the suspect.policies.md — when the question is about IAM modeling.agent-registry.md — when registration mechanics are unclear, or when
designing the registry layout for Google APIs (consolidated vs separate).agent-identity.md — when the question is about who the agent is.Read the smallest set that answers the question. Don't preload everything.
Always produce a structured report. Use this template exactly.
authz_policy actually targeting it)
→ authz extension → IAP/IAM → PAB.roles/iap.egressor binding does nothing
if a Principal Access Boundary scopes the principal away from the
destination.roles/iap.egressor (for IAM v1) and FQDN permission
iap.googleapis.com/resources.egressViaIAP (for UAP v2).PolicyBinding rather than shadow resources.
Evaluation follows absolute DENY precedence and additive ALLOW aggregation
across the CRM tree.ALL_TRAFFIC: Under VPC-SC,
traffic traverses synthetic PSC VIP 240.0.0.2:443. External public API
traffic exiting the consumer VPC requires Cloud NAT on the PSC-I subnet to
avoid silent connection hangs.global and the second must be
regional or multi-regional.us-central1) unless logs point
elsewhere.--quiet / -q or
gcloud config set core/disable_prompts True) to avoid hanging.