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://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-gateway.md
Agent Gateway — Debugging Reference
Curated from Google Cloud's Gemini Enterprise Agent Platform architecture. Focused on what a debugger needs to triage failed requests, routing issues, and provisioning blocks on Agent Gateway and Agent Connectivity Templates (ACT).
Table of Contents
TL;DR for debugging: Lines 24-94
1. Architecture & Control Plane: Lines 95-118
2. Deployment Modes & Topologies: Lines 119-163
3. Agent Connectivity Template (ACT), Cloud DNS Peering, & Private CA: Lines 164-290
4. Dual-Registry Gateway Binding Rules: Lines 291-340
5. Cloud NAT & Egress IP Mechanics: Lines 341-380
6. Downstream Egress Proxies: Next-Hop SWP + PBR vs. Explicit HTTPS Proxy: Lines 381-681
7. Delegated Authorization, Model Armor, SGP, & Native MCP: Lines 682-742
8. Logging, Monitoring, & Cloud Trace: Lines 743-808
9. Common Failure Modes & Troubleshooting Guide: Lines 809-825
10. Reference Gateway, ACT Specifications, & Ordered Teardown: Lines 826-890
11. Cross-Project Centralized Governance Architecture: Lines 891-1018
TL;DR for debugging
Control Plane & Infrastructure: Managed under Network Services (
networkservices.googleapis.com). Google-managed Agent Gateway proxy infrastructure runs in Google-managed infrastructure outside your consumer project.Important: All configuration changes, deployments, and debugging must be performed strictly on consumer-project resources.
Native VPC-SC Support Mandates ACT in
ALL_TRAFFICMode: As of September 8, 2026, Agent Gateway creation inside a VPC-SC perimeter works natively out of the box when the gateway binds to an Agent Connectivity Template (ACT) configured withvpcEgress: ALL_TRAFFIC. InALL_TRAFFICmode, all outbound packets from runtime containers are captured and tunneled through the PSC-I Network Attachment into the consumer VPC.The Cloud NAT Egress Prerequisite (Silent Black Hole): Under
vpcEgress: ALL_TRAFFIC, external public Internet traffic exiting the PSC-I Network Attachment routes through the consumer VPC. The consumer VPC subnet MUST have Cloud NAT configured; otherwise outbound SaaS/REST calls hang and time out.Google Front End (GFE) Bypass Exception: Traffic directed to Google APIs or Cloud Run default domains (
*.run.app) does NOT exit through Cloud NAT. Google's network routes Google IP ranges internally via Private Google Access.Dual-Registry & Jurisdiction Invariants: Agent Gateway supports linking up to two Agent Registries:
Exactly one registry MUST be
global.The second can be
regional(e.g.,us-central1) ormulti-regional(usoreu, matching the gateway's geographic jurisdiction).Two regional registries, two multi-regional registries, or a cross-jurisdiction pairing (
us-central1+eu) fails validation with HTTP400.
Concurrent Mutation Lock (
HTTP 409 ABORTED) & Tombstones: Submitting concurrentPATCH,import, ordeleteoperations while an LRO is active on the same gateway aborts withHTTP 409 ABORTED: unable to queue the operation(~1.5–2 minutes). Reusing a recently deleted gateway name before cleanup finishes can also collide; poll LROs to completion or use a unique versioned gateway ID.Multi-Runtime Sharing vs. In-Place Rebinding: Multiple Agent Runtime (Reasoning Engine) instances in the same region can share a single
AGENT_TO_ANYWHEREgateway (https://docs.cloud.google.com/gemini-enterprise-agent-platform/govern/gateways/set-up-agent-gateway.md.txt), provided gateway mutations are serialized and essential platform APIs are allowlisted before binding (binding an enforcing gateway before allowlisting APIs causes immediateHTTP 498failures).Dependency-Ordered Teardown: Delete bound workloads and UAP
PolicyBindingresources first, thenAuthzPolicy→AuthzExtension/ExtensionBinding/TelemetryPolicy→AgentGateway→ACT→TrustConfig/NetworkAttachment/ VPC, polling each LRO todone: truebefore proceeding (see §10.3).Private CA
TrustConfig, 2-Hop DNS Peering, & Explicit HTTPS Proxy:Private CA (
TrustConfigGA): Always setadditionalRoots: PUBLICLY_TRUSTED_ROOTSalongsidetlsConfig.trustConfig, and create a new ACT +PATCHthe gateway (updateMask=agentConnectivityTemplate) when rotating trust configs.Cloud DNS 2-Hop Limit: Cloud DNS permits at most 2 peering hops total (Agent Gateway consumes Hop 1 → max 1 consumer peering hop; a 2nd consumer hop fails preflight or returns
SERVFAIL→503).Explicit HTTPS Proxy (
HTTPS_PROXY): Requires av1beta1L4AuthzPolicy(gcloud beta network-security authz-policies import) withnetworkRulesmatchingto.operations[].snis(omittingloadBalancingSchemeandports); otherwiseHTTP CONNECTfails withHTTP 404on the L7 listener (see §6.3).
1. Architecture & Control Plane
Agent Gateway acts as the enterprise security gateway and Layer 7 policy enforcement point for AI agent workloads:
Client-to-Agent (ingress): External clients reaching agents or tools on Google Cloud.
Agent-to-Anywhere (egress): Agents on Google Cloud reaching external services, APIs, MCP servers, or peer agents.
Core Resource Types
| Type | Purpose |
|---|---|
networkservices.agentGateways | Gateway resource governing Client-to-Agent (CLIENT_TO_AGENT) or Agent-to-Anywhere (AGENT_TO_ANYWHERE) traffic. |
networkservices.agentConnectivityTemplates | Centralized VPC egress (ALL_TRAFFIC / PRIVATE_RANGES_ONLY), Private DNS peering, and Private CA TrustConfig. |
networksecurity.authzPolicies | Attaches L7 httpRules/MCP rules, L4 networkRules (v1beta1), CUSTOM extensions, or DENY_BY_DEFAULT to gateways. |
networkservices.authzExtensions / serviceextensions.extensionBindings | Attaches IAP/UAP, Model Armor, Semantic Governance Policies (SGP), or custom ext_proc extensions. |
networkservices.telemetryPolicies | Preview distributed Cloud Trace sampling configuration (gcloud beta network-services telemetry-policies). |
certificatemanager.trustConfigs | Private CA trust stores and self-signed leaf allowlists referenced by ACT tlsConfig. |
compute.networkAttachments | PSC-Interface (PSC-I) attachment in the consumer VPC for private and ALL_TRAFFIC egress. |
2. Deployment Modes & Topologies
2.1 Google-Managed vs. Self-Managed Topologies
Google-Managed Agent Gateway: Google operates the Envoy proxy fleet for Agent Runtime (Reasoning Engines), Gemini Enterprise apps, and IAP-protected Cloud Run MCP ingress (
governedAccessPath: AGENT_TO_ANYWHEREorCLIENT_TO_AGENT).Self-Managed Agent Gateway (Secure Web Proxy): Customer-managed Secure Web Proxy instance in the consumer VPC governing GKE pods, Cloud Run jobs/services, and Token Management Policies (
TokenAggregationPolicy/TokenBudgetPolicy).
2.2 Standard Mode (ACT + Consumer VPC) vs. Standalone Mode
Standard Mode (Enterprise Isolated): Binds
agentConnectivityTemplatewith a consumer VPCNetworkAttachment(PSC-I), optionaldnsPeeringConfig, and optionaltlsConfig.trustConfig. Required for VPC-SC (vpcEgress: ALL_TRAFFIC), private RFC 1918 backends, deterministic Cloud NAT egress IPs, Next-Hop SWP, Explicit HTTPS Proxies, and Semantic Governance Policies (SGP).Standalone Mode (Google-Managed Public Egress): Omits the ACT and consumer VPC Network Attachment; governs public endpoints cataloged in Agent Registry over Google-managed networking (not supported for VPC-SC private egress).
2.3 Workload Binding Nuances & Bootstrap Sequencing (HTTP 498)
Bootstrap Allowlist Order (
HTTP 498): Before binding an Agent Runtime or Gemini Enterprise engine to an enforcing gateway (or flippingDRY_RUNto enforced), register the consolidatedgoogleapisservice (8 base FQDNs) and grant UAP/IAP egress permissions. Binding an enforcing gateway before allowlisting essential platform APIs causes immediateHTTP 498errors and startup crashes.Gemini Enterprise App Registration & Binding (
UpdateEngine): Gemini Enterprise apps (discoveryengine.googleapis.com) register into Agent Registry and bind to an Agent Gateway viaPATCH .../engines/{ENGINE_ID}(UpdateEngine). Agent Gateways are strictly regional (neverglobal): deploy the gateway inus-central1forglobalorusGemini Enterprise apps and ineurope-west1foreuapps, paired with the matching single regional Agent Registry (us-central1oreurope-west1), and remove the binding viaUpdateEnginebefore deleting the gateway.Removing a Gateway from Agent Runtime: Clear the runtime attachment via
PATCH .../reasoningEngines/{ID}?updateMask=agentGatewayConfigwith an emptyagentGatewayConfig: {}body before deleting the gateway.
3. Agent Connectivity Template (ACT), Cloud DNS Peering, & Private CA
The Agent Connectivity Template defines the compute model, network isolation, and DNS topology for agent containers.
3.1 Egress Modes: ALL_TRAFFIC vs. PRIVATE_RANGES_ONLY
| Egress Mode | Network Path | VPC-SC | Use Case |
: : : Compatible? : :
| :------------------------ | :---------------- | :------------ | :----------- |
| ALL_TRAFFIC | Outbound TCP/UDP | YES | Enterprise |
: : packets are : (Mandatory) : production :
: : captured and : : environments :
: : tunneled through : : requiring :
: : the PSC-I Network : : VPC-SC :
: : Attachment into : : perimeter :
: : the consumer VPC. : : compliance :
: : External DNS : : and :
: : queries resolve : : controlled :
: : to synthetic PSC : : egress. :
: : VIP : : :
: : 240.0.0.2\:443. : : :
| PRIVATE_RANGES_ONLY | Directs only RFC | NO | Dev/test |
: : 1918 traffic : : workloads :
: : (10.0.0.0/8, : : where public :
: : 172.16.0.0/12, : : egress does :
: : 192.168.0.0/16) : : not need VPC :
: : through PSC-I. : : inspection :
: : Public internet : : or VPC-SC :
: : traffic exits : : compliance. :
: : directly from the : : :
: : Google runtime. : : :
3.2 Consumer VPC Network Attachment (PSC-I) & Preflight Requirements
The Network Attachment bridges the Google-managed gateway fleet into the consumer VPC:
Subnet Configuration:
purpose: PRIVATEwithprivateIpGoogleAccess: true.Subnet Sizing: Minimum
/26(recommended/24). Never use/28— concurrent rollouts and dynamic PSC-I interfaces exhaust/28subnets.No Consumer VPC Packet Intercept: Do not attach a Network Security
InterceptDeploymentGroup/ Packet Intercept policy to the consumer VPC hosting the PSC-I subnet; intercepted gateway return packets drop with HTTP503.
Attachment Settings:
connectionPreference: ACCEPT_AUTOMATIC, residing in the exact same region as the ACT and Agent Gateway (projects/PROJECT_ID/regions/REGION/networkAttachments/NAME).Mandatory IAM Grants:
Deploying Caller: Needs
compute.networkAttachments.use(e.g.,roles/compute.networkAdminor custom role) on the Network Attachment; otherwise ACT/gateway import fails preflight validation.Gateway & Extension Service Agents on Subnet/Project: Grant
roles/compute.networkUseron the PSC-I subnet to both:service-GATEWAY_PROJECT_NUMBER@gcp-sa-agentgateway.iam.gserviceaccount.com(also grantroles/compute.networkVieweron the VPC host project)service-GATEWAY_PROJECT_NUMBER@gcp-sa-dep.iam.gserviceaccount.com
3.3 Cloud DNS Architecture, Peering Schemas, & 2-Hop Peering Limit
Default Resolution: Without
dnsPeeringConfig, Agent Gateway resolves target hostnames using public recursive DNS only; private Cloud DNS zones in the consumer VPC are invisible until DNS peering is configured.Schema Difference — ACT vs. Inline
AgentGateway:ACT (
egressNetworkConfig.dnsPeeringConfig): Accepts onlydomains(YAML array of FQDNs with trailing dots, e.g.,["corp.internal."]) and stringtargetNetwork(projects/VPC_PROJECT_ID/global/networks/VPC_NAME— do NOT addtargetProject, and omit deprecatedaccessTypes: [PRIVATE]).Inline
AgentGateway(networkConfig.dnsPeeringConfig): Configured as a sibling ofnetworkConfig.egresswhen not using an ACT; requiresdomains,targetNetwork, andtargetProject.
Mandatory DNS Peering Service Agent IAM: Grant
roles/dns.peerandroles/dns.reader(plusroles/compute.networkViewer) on the target VPC project toservice-GATEWAY_PROJECT_NUMBER@gcp-sa-agentgateway.iam.gserviceaccount.com(do not grant only togcp-sa-networkservices, which is not the Agent Gateway DNS peering identity).Cloud DNS 2-Hop Total Transitive Peering Limit (
SERVFAIL→503): Cloud DNS supports at most 2 peering hops end-to-end:[Google-Managed Gateway VPC] --(Hop 1: ACT dnsPeeringConfig)--> [Consumer VPC A] --(Hop 2: Cloud DNS Peering)--> [Hub DNS VPC B]. IfVPC Bpeers a 3rd hop toVPC C(Gateway -> VPC A -> VPC B -> VPC C), Cloud DNS drops transitive resolution: control-plane preflight either rejects the peering chain or runtime queries returnSERVFAIL(surfaced by Envoy as503 UF,URX/Upstream resolution failure). Fix: PointdnsPeeringConfig.targetNetworkdirectly at the authoritative DNS Hub VPC (reducing hops to 1) or host an authoritative Cloud DNS forwarding/private zone directly inVPC AorVPC B."."Root Zone Rule — Authoritative Forbidden (NXDOMAIN) vs. Private Forwarding Allowed: Never peer to a VPC hosting a private authoritative Cloud DNS zone for"."(root) without explicit*.googleapis.comoverrides — it shadows public & Private Google Access resolution withNXDOMAIN(503). By contrast,domains: ["."]is supported when the spoke VPC hosts a"."Cloud DNS Private Forwarding Zone forwarding queries to a hub resolver.
3.4 Private CA & Self-Signed TLS (TrustConfig — GA)
When Needed: Upstream private HTTPS endpoints or internal load balancers signed by an internal Private CA or self-signed certificate fail Envoy TLS verification (
CERTIFICATE_VERIFY_FAILED/503 UF) unless trusted on the ACT.Configuration: Create a Certificate Manager
TrustConfigin the same project and region (trustStoresfor Private CA root/intermediate chains orallowlistedCertificatesfor self-signed leaf certs) and attach it underegressNetworkConfig.tlsConfig:egressNetworkConfig: networkAttachment: projects/PROJECT_ID/regions/REGION/networkAttachments/agw-na vpcEgress: ALL_TRAFFIC tlsConfig: trustConfig: projects/PROJECT_NUMBER/locations/REGION/trustConfigs/private-ca-trust additionalRoots: PUBLICLY_TRUSTED_ROOTSCritical Trap 1 (
additionalRoots: PUBLICLY_TRUSTED_ROOTS): OmittingadditionalRootsdefaults toNO_ADDITIONAL_ROOTS, stripping Mozilla/Google public WebPKI roots and immediately breaking TLS to all public APIs and*.googleapis.com!Critical Trap 2 (ACT Immutability):
tlsConfig.trustConfig,networkAttachment, anddnsPeeringConfigcannot be mutated in-place on a bound ACT. Create a new ACT (agw-act-v2) and rebind the gateway viaPATCH .../agentGateways/{NAME}?updateMask=agentConnectivityTemplate(orgcloud network-services agent-gateways import), then delete the old ACT.Runtime Container CA Bundle (
agentGatewayCard.rootCertificates): For runtimes requiring explicit trust of the gateway's regional TLS inspection CA, extractagentGatewayCard.rootCertificatesviagcloud network-services agent-gateways describe GATEWAY_NAME --location=REGION --format="value(agentGatewayCard.rootCertificates)"(there is noexport-cacertssubcommand ongcloud network-services).
4. Dual-Registry Gateway Binding Rules
Agent Gateway supports linking up to two Agent Registries in its
registries list:
registries:
- //agentregistry.googleapis.com/projects/PROJECT_NUMBER/locations/global
- //agentregistry.googleapis.com/projects/PROJECT_NUMBER/locations/us-central1Best-Practice Recommendation (Single Regional Registry): Production deployments (including both Agent Runtime and Gemini Enterprise apps) should associate each
AgentGatewaywith a single regional Agent Registry instance in the same project and region as the gateway (//agentregistry.googleapis.com/projects/PROJECT_ID/locations/REGION, usingus-central1forglobalorusGemini Enterprise apps andeurope-west1foreuapps; bothPROJECT_IDand numericPROJECT_NUMBERare accepted). Multi-registry configurations remain permitted by the Network Services API validator up to the ceiling below.
Network Services Validation Invariants
Agent Gateway control-plane validation enforces:
Cardinality: Maximum of two registries are permitted (
<= 2).Mandatory Global Invariant: If two registries are configured, exactly one of them MUST be
global.Second Registry Scope: The second registry can be either
regional(matching the gateway's exact region, e.g.,us-central1) ORmulti-regional(usoreu).Jurisdiction Alignment: A regional gateway in
us-*cannot bind aneumulti-region registry, and aneurope-*gateway cannot bind ausmulti-region registry (usandeuare read-only roll-up views for auto-discovered resources; manual registration requiresglobalor a concrete region).Disallowed Configurations:
Two regional registries (e.g.,
us-central1+europe-west1): Rejected (HTTP 400).Two multi-regional registries (e.g.,
us+eu): Rejected (HTTP 400).One regional + one multi-regional (without
global): Rejected (HTTP 400).Two global registries: Rejected (
HTTP 400).
Validation error message on violation:
maximum of two registries are supported. When it's two registries, one of them must be global, the other one can be either regional or multi-regional.5. Cloud NAT & Egress IP Mechanics
In ALL_TRAFFIC mode, outbound traffic behavior depends on the target domain:
[ Reasoning Engine ]
│
▼ (Captured via PSC-I)
[ Consumer PSC-I Subnet ] ── (10.20.1.0/24)
│
├─── Google APIs / *.run.app ──────► [ Private Google Access ] ──► [ GFE ]
│
└─── External Internet / SaaS ─────► [ Cloud Router + NAT ] ──► [ Static IP: 203.0.113.10 ]5.1 Routing Path
Packets exit the Network Attachment on the consumer subnet (
agw-psci-subnet, e.g.,10.20.1.0/24).VPC route tables direct internet-bound CIDRs (
0.0.0.0/0) through the default internet gateway via Cloud Router (agw-nat-router) and Cloud NAT (agw-cloud-nat).
5.2 Deterministic Static Egress IP
Outbound calls to external destinations (
api.weather.gov,api.ipify.org, SaaS APIs) are Source-NAT'd (SNAT) to the Cloud NAT static regional IP (for example,203.0.113.10inus-central1or198.51.100.20ineurope-west1) so external partners can allowlist a deterministic source IP.
5.3 Google Front End (GFE) Bypass Exception
Traffic directed to Google APIs or Cloud Run default domains (
*.run.app) does not exit through Cloud NAT.Google's Andromeda SDN intercepts traffic matching Google IP ranges and routes it internally to GFE via Private Google Access, bypassing the Cloud NAT static external IP.
6. Downstream Egress Proxies: Next-Hop SWP + PBR vs. Explicit HTTPS Proxy
Enterprise consumer VPCs use one of two downstream proxy patterns behind an Agent
Gateway: Pattern A (Transparent Next-Hop SWP + Policy-Based Routing) when
full Layer 7 Agent Gateway governance must precede VPC egress without client
proxy settings, or Pattern B (Explicit Forward HTTPS Proxy + L4 AuthzPolicy)
when routing via HTTPS_PROXY to an explicit Squid/SWP/corporate proxy on :443.
6.1 Pattern A Platform Constraints & Routing Incompatibilities
PSC Endpoints Cannot Be Route Next-Hops: Google Cloud route tables (both static routes and Policy-Based Routes) do not permit Private Service Connect (PSC) forwarding rules (
--load-balancing-scheme="") or service attachments as next hops.SWP via PSC Service Attachment Lacks Next-Hop Mode: Publishing Secure Web Proxy behind a PSC Service Attachment operates strictly in Explicit Proxy Mode (
HTTP CONNECT). Transparent Layer 3/Layer 4 IP packets emerging from an Agent Gateway Network Attachment lackHTTP CONNECTframing (if an explicit proxy is required instead of Next-Hop SWP, configureHTTPS_PROXYplus av1beta1L4AuthzPolicyas shown in §6.3).Static Route Tag Defect: Next-hop routing mode with static routes requires VM network instance tags (
--tags). Network Attachments (compute network-attachments) are consumer network interfaces, not VM instances, and cannot bear network tags. Consequently, static routes cannot match or steer traffic originating from an Agent Gateway Network Attachment.
6.2 The Working Architecture: Next-Hop SWP + Policy-Based Routing (PBR)
The only functional pattern for intercepting transparent egress from an Agent Gateway Network Attachment is deploying Next-Hop SWP directly in the consumer VPC and steering traffic via Policy-Based Routing:
[ Reasoning Engine ]
│
▼ (ACT vpcEgress: ALL_TRAFFIC)
[ Agent Gateway ]
│
▼ (PSC-I / Network Attachment, e.g. 10.20.1.0/24)
[ Consumer Subnet ]
│
├──► [ Policy-Based Route (PBR) ] ── (Matches source: 10.20.1.0/24, dest: 0.0.0.0/0)
│ │
│ ▼ (Priority 200: next-hop-ilb-ip = 10.20.1.250)
│ [ Next-Hop SWP Gateway (SECURE_WEB_GATEWAY) ]
│ │
│ ▼ (Proxy-Only Subnet: REGIONAL_MANAGED_PROXY /26)
│ [ GatewaySecurityPolicy (L7 CEL Rules) ]
│ │
│ ▼ (Outbound Internet SNAT)
│ [ Cloud NAT (ENDPOINT_TYPE_SWG) ]
│ │
│ ▼
│ [ External Internet / Public APIs ]
│
└──► [ Fallback PBR (Priority 1000) ] ──► DEFAULT_ROUTING1. SWP Gateway Deployment
SWP must be deployed directly in the consumer VPC with type: SECURE_WEB_GATEWAY
and routingMode: NEXT_HOP_ROUTING_MODE, listening on an internal IP on the
PSC-I subnet (e.g. 10.20.1.250):
Important: The Network Services API requires
type: SECURE_WEB_GATEWAY. Passingtype: SECURE_WEB_PROXYis rejected by schema validation.
# swp-gateway.yaml
name: projects/PROJECT_ID/locations/REGION/gateways/swp-gateway
type: SECURE_WEB_GATEWAY
routingMode: NEXT_HOP_ROUTING_MODE
addresses:
- 10.20.1.250
subnetwork: projects/PROJECT_ID/regions/REGION/subnetworks/agw-psci-subnet
gatewaySecurityPolicy: projects/PROJECT_ID/locations/REGION/gatewaySecurityPolicies/swp-policy
ports:
- 443
- 80Import via GA gcloud CLI:
gcloud network-services gateways import swp-gateway \
--source=swp-gateway.yaml \
--location=REGION \
--project=PROJECT_ID2. Envoy Proxy-Only Subnet Prerequisite
SWP runs on Envoy proxy instances managed within the consumer VPC. It requires a dedicated proxy-only subnet in the target region:
gcloud compute networks subnets create swp-proxy-subnet \
--purpose=REGIONAL_MANAGED_PROXY \
--role=ACTIVE \
--region=REGION \
--network=VPC_NAME \
--range=10.20.2.0/26 \
--project=PROJECT_ID3. Policy-Based Routing (PBR) Configuration
Because Network Attachments cannot have VM network tags, routing must use PBR to match traffic based on the source CIDR of the Network Attachment subnet:
Primary PBR (
agw-psci-to-swp-pbr, Priority 200): Matches source CIDR10.20.1.0/24(the PSC-I subnet where the Network Attachment resides) and destination0.0.0.0/0, steering traffic to the SWP internal IP:gcloud network-connectivity policy-based-routes create agw-psci-to-swp-pbr \ --network=projects/PROJECT_ID/global/networks/VPC_NAME \ --source-range=10.20.1.0/24 \ --destination-range=0.0.0.0/0 \ --next-hop-ilb-ip=10.20.1.250 \ --priority=200 \ --project=PROJECT_IDDefault Fallback PBR (
agw-pbr-default-routing, Priority 1000): Directs all non-matching or bypass traffic to default VPC routing:gcloud network-connectivity policy-based-routes create agw-pbr-default-routing \ --network=projects/PROJECT_ID/global/networks/VPC_NAME \ --destination-range=0.0.0.0/0 \ --priority=1000 \ --project=PROJECT_ID
4. L7 Policy Enforcement (GatewaySecurityPolicy)
Security rules attached to the SWP Gateway evaluate outbound traffic using CEL (Common Expression Language) expressions. Rules allow authorized domains and deny unauthorized traffic with HTTP 403 or TLS connection drops:
inUrlList(host(), ['api.weather.gov', 'api.ipify.org', 'REGION-aiplatform.mtls.googleapis.com'])Or explicit hostname equality:
host() == 'api.weather.gov' || host() == 'api.ipify.org' || host() == 'REGION-aiplatform.mtls.googleapis.com'5. Cloud NAT Interdependence (ENDPOINT_TYPE_SWG)
SWP Envoy proxy instances reside on the private proxy-only subnet and do not
possess external IP addresses. Outbound internet egress from SWP requires a
Cloud NAT gateway created with ENDPOINT_TYPE_SWG (--endpoint-types is
immutable and not supported on gcloud compute routers nats update — create
a new NAT gateway or recreate an existing VM-only NAT):
gcloud compute routers nats create agw-cloud-nat \
--router=agw-nat-router \
--region=REGION \
--nat-all-subnet-ip-ranges \
--auto-allocate-nat-external-ips \
--endpoint-types=ENDPOINT_TYPE_VM,ENDPOINT_TYPE_SWG \
--project=PROJECT_IDNote: In
NEXT_HOP_ROUTING_MODE, the Google Cloud SWP control plane may autogenerateswg-autogen-router-{network_id}andswg-autogen-natwithnatIpAllocateOption: AUTO_ONLYandENDPOINT_TYPE_SWG. Outbound public IP queries (e.g.api.ipify.org) reflect the SWG NAT's auto-allocated public IPs rather than the VPC's manual Cloud NAT static IP, validating end-to-end traversal through SWP.
6. The ADK Streaming Query Session Trap (HTTP 503)
In ALL_TRAFFIC ACT mode, Vertex AI Agent Development Kit (ADK) streaming
queries attempt to initialize session state via:
POST https://<region>-aiplatform.mtls.googleapis.com/v1beta1/projects/.../locations/<region>/reasoningEngines/...:createSessionBecause ALL_TRAFFIC forces all runtime egress through the Agent Gateway into
the Network Attachment, PBR intercepts and routes this session creation call to
SWP. If <region>-aiplatform.mtls.googleapis.com is omitted from the
GatewaySecurityPolicy allowlist, SWP rejects it (default_denied). This causes
ADK streaming queries to crash with:
HTTP 503 Service Unavailable: remote connection failurewhile direct, non-streaming query() calls (which do not create sessions)
continue to succeed. Always allowlist the regional aiplatform endpoint in SWP!
7. Observability & Log Verification
SWP logs are emitted under resource type networkservices.googleapis.com/Gateway:
resource.type="networkservices.googleapis.com/Gateway"
resource.labels.gateway_name="swp-gateway"
resource.labels.location="REGION"Verify enforcedGatewaySecurityPolicy.matchedRules with action (ALLOWED vs
DENIED), tlsSniHostname, clientIp, and httpRequest.status.
6.3 Pattern B: Explicit Forward HTTPS Proxy (HTTPS_PROXY + L4 AuthzPolicy)
Agent Runtime (Reasoning Engine) and containerized workloads do support
explicit forward HTTPS proxies (HTTPS_PROXY=https://proxy.corp.internal:443)
when Agent Gateway passes matching TLS SNIs through at Layer 4.
Why HTTP CONNECT Fails with HTTP 404 by Default
By default, Agent Gateway's Envoy listener terminates TLS and passes decrypted
streams to an L7 HTTP connection manager (loopback_tls). When an SDK or curl
sends CONNECT api.example.com:443 HTTP/1.1 inside the TLS session to an
explicit proxy, the L7 HTTP manager rejects nested CONNECT requests with
HTTP 404 Not Found (curl: (56) CONNECT tunnel failed, response 404).
Required 5-Part Configuration
Import a
v1beta1L4AuthzPolicy(networkRules): Route the proxy's SNI hostname to Agent Gateway's L4 TCP/SNI pass-through filter chain usinggcloud beta(networkRulesis available only inv1beta1, supports at most 5 rules and 10snisper operation, is mutually exclusive withhttpRules, and must omit bothtarget.loadBalancingSchemeandports; either omitfromor include both7.0.0.0/8and your PSC-I CIDR innetworkRules[].from.sources[].ipBlocks, and never setfrom.sources[].resourceson Agent Gateway targets):# proxy-l4-authz-policy.yaml name: allow-explicit-proxy-l4 policyProfile: REQUEST_AUTHZ action: ALLOW target: resources: - projects/PROJECT_ID/locations/REGION/agentGateways/AGENT_GATEWAY_NAME networkRules: - to: operations: - snis: - exact: "proxy.corp.internal"gcloud beta network-security authz-policies import allow-explicit-proxy-l4 \ --source=proxy-l4-authz-policy.yaml \ --location=REGION \ --project=PROJECT_IDConfigure TLS Listener on Port
:443& Consumer VPC / Proxy Source ACLs:Agent Gateway forwards egress on
:443; configure the explicit proxy (for example, Squidhttps_port 443 tls-cert=...or Explicit SWP on:443) with a DNS record resolvable viadnsPeeringConfig.Two-Plane Source IP Rule: In your consumer VPC GCE ingress firewall and Squid
acl localnet src, allow only your consumer PSC-I Network Attachment subnet CIDR (e.g.,10.20.1.0/24— packets exiting the PSC-I NIC into your VPC are sourced from the PSC-I subnet, never7.0.0.0/8). Use7.0.0.0/8only inside Agent Gateway'sAuthzPolicynetworkRules[].from.sources[].ipBlockswhenfromis set.
Set
HTTPS_PROXYand MandatoryNO_PROXYExclusions on the Agent:HTTPS_PROXY="https://proxy.corp.internal:443"(and lowercasehttps_proxy)NO_PROXY=".googleapis.com,googleapis.com,metadata.google.internal,169.254.169.254,localhost,127.0.0.1"(and lowercaseno_proxy). Omitting169.254.169.254/metadata.google.internalbreaks ADC token fetches; omitting.googleapis.comtunnels Google API mTLS calls into the proxy.
Trust Both CAs Inside the Runtime Container: Because L4 pass-through does not terminate TLS at Agent Gateway, ACT
tlsConfig.trustConfigdoes not validate the explicit proxy's certificate. CombineagentGatewayCard.rootCertificates(for direct L7 Google API/MCP calls) and your Private CA root (for the explicit proxy and any SSL-bumped upstream) into your container's CA bundle (SSL_CERT_FILE,REQUESTS_CA_BUNDLE,GRPC_DEFAULT_SSL_ROOTS_FILE_PATH).Governance Trade-Off Warning: Traffic matching an L4
networkRulesALLOWpolicy bypasses Layer 7 Agent Gateway governance (IAP/UAP authorization, Model ArmorCONTENT_AUTHZ, Semantic Governance Policies, andhttpRules) for that proxy SNI. Enforce URL/domain filtering on the downstream proxy itself, or use Pattern A (Next-Hop SWP + PBR) if full L7 Agent Gateway inspection is required before VPC egress.
| Dimension | Pattern A: Transparent Next-Hop SWP + PBR (§6.2) | Pattern B: Explicit HTTPS Proxy + L4 AuthzPolicy (§6.3) |
|---|---|---|
Container HTTPS_PROXY / NO_PROXY | None required (transparent L3/L4) | Required (https://proxy:443 + NO_PROXY / no_proxy) |
| Agent Gateway Policy Layer | Full L7 (IAP/UAP, Model Armor, SGP, httpRules) | L4 SNI pass-through (networkRules bypasses L7 for proxy SNI) |
| Private CA Validation | Gateway ACT tlsConfig.trustConfig | Container trust bundle (SSL_CERT_FILE / REQUESTS_CA_BUNDLE) |
| Routing Mechanism | Consumer VPC PBR → NEXT_HOP_ROUTING_MODE SWP + ENDPOINT_TYPE_SWG | Direct PSC-I routing + DNS peering to :443 explicit proxy |
7. Delegated Authorization, Model Armor, SGP, & Native MCP
Agent Gateway evaluates policies attached via networksecurity.googleapis.com
authzPolicies (never legacy authorizationPolicies). Always omit
target.loadBalancingScheme when targeting agentGateways/*.
7.1 Precedence, Profiles, & Cardinality Limits
Evaluation Order (
REQUEST_AUTHZ):CUSTOM→DENY→ALLOW→DENY_BY_DEFAULT. (REQUEST_AUTHZexecutes beforeCONTENT_AUTHZ.)Policy Caps: Egress (
AGENT_TO_ANYWHERE) supports up to 4CONTENT_AUTHZpolicies; Ingress (CLIENT_TO_AGENT) supports at most 1CONTENT_AUTHZpolicy.
7.2 Native MCP AuthzPolicy (MATCH_BASE_PROTOCOL_METHODS)
When restricting MCP tools via httpRules[].to.operations[].mcp, ALLOW rules
must set baseProtocolMethodsOption: MATCH_BASE_PROTOCOL_METHODS. Leaving
the default (SKIP_BASE_PROTOCOL_METHODS) blocks MCP session handshakes
(initialize, ping, notifications/initialized) when paired with DENY_BY_DEFAULT.
7.3 IAP Unified Access Policy (UAP / Policy V2)
Set
iapPolicyVersion: "V2"in the IAPAuthzExtensionmetadata(with optionaliamEnforcementMode: "DRY_RUN"; omitiamEnforcementModeor set"ENFORCE"for active blocking).Rules grant FQDN permission
iap.googleapis.com/resources.egressViaIAPusing singular"operation"and plural"conditions": {"iap.googleapis.com": {...}}(seereferences/policies.md§2).
7.4 Model Armor Content Security (CONTENT_AUTHZ)
Ingress (
CLIENT_TO_AGENT): Executes asservice-AGENT_PROJECT_NUMBER@gcp-sa-aiplatform-re.iam.gserviceaccount.com(roles/modelarmor.calloutUseron agent project;roles/modelarmor.useron template project). Inspects ADKreasoningEngines.streamQuerypayloads only.Egress (
AGENT_TO_ANYWHERE): Executes asservice-GATEWAY_PROJECT_NUMBER@gcp-sa-dep.iam.gserviceaccount.com(roles/modelarmor.calloutUser+roles/serviceusage.serviceUsageConsumeron gateway project;roles/modelarmor.useron template project).60-Second Stream Deadline: Envoy enforces a hard 60-second total stream deadline on
CONTENT_AUTHZcallouts. ScopehttpRules[].whento excludeapplication/grpcand streams >60s to avoidStream removed/ HTTP500/504.
7.5 Semantic Governance Policies (SGP)
Evaluates natural-language constraints and user intent via the LLM in the semantic governance policy engine (
gcloud beta ai semantic-governance-policy-engine/semantic-governance-policies, running under[email protected]).Requires
AGENT_IDENTITY+agent_gateway_configat runtime creation, ACT + DNS peering (avoiding reserved SGP subnets10.0.0.0/24,10.0.1.0/24,10.0.2.0/24), non-streaming model invocation (streamed responses return no verdict or an error), and a non-streaming CELwhenfilter using.contains():"!request.headers['content-type'].startsWith('application/grpc') && (request.path.contains(':generateContent') || request.path.contains(':rawPredict') || request.path.contains('/v1/messages') || request.path.contains('/chat/completions'))".Wholesale
metadataOverwrite Trap:PATCH .../authzExtensions/{NAME}?updateMask=metadata(orimport) replaces the entiremetadatamap — always supply all active keys (sgpEnforcementMode: "DRY_RUN",sgpUserIntentMatching) together.
8. Logging, Monitoring, & Cloud Trace
8.1 Monitored Resource & Log Analytics Prerequisite
Upgrade the _Default log bucket to Log Analytics to populate the Cloud
Console Agent Gateway Observability dashboard.
resource.type="networkservices.googleapis.com/Gateway"
resource.labels.location="REGION"
resource.labels.gateway_name="AGENT_GATEWAY_NAME"8.2 Inspecting L7 Decisions & Suppressing Outer CONNECT 240.0.0.2:443 Noise
In ACT ALL_TRAFFIC mode, every connection logs an outer tunnel CONNECT 240.0.0.2:443
entry alongside the inner TLS-inspected request. Filter -httpRequest.requestMethod="CONNECT"
when triaging inner L7 status codes, or keep CONNECT when checking L4 pass-through:
# Inner L7 4xx/5xx decisions (suppressing outer 240.0.0.2:443 CONNECT entries)
gcloud logging read \
'resource.type="networkservices.googleapis.com/Gateway" AND resource.labels.gateway_name="AGENT_GATEWAY_NAME" AND -httpRequest.requestMethod="CONNECT" AND httpRequest.status>=400' \
--project=PROJECT_ID --limit=20 --freshness=1h --format=json
# Semantic Governance Policy (SGP) evaluation verdicts & rationales
gcloud logging read \
'logName="projects/PROJECT_ID/logs/semantic-governance-policy"' \
--project=PROJECT_ID --limit=20 --freshness=1h --format=json8.3 Distributed Tracing with Cloud Trace (TelemetryPolicy — Preview)
Always verify
cloudtrace.googleapis.comis enabled (gcloud services enable cloudtrace.googleapis.com) and grantroles/cloudtrace.agenton the project to all 3 platform service agents (grantingroles/cloudtrace.agentonly to the runtime workload SA emits zero gateway spans; also grant to[email protected]if using SGP):service-PROJECT_NUMBER@gcp-sa-networksecurity.iam.gserviceaccount.comservice-PROJECT_NUMBER@gcp-sa-agentgateway.iam.gserviceaccount.com
Import a schema-valid
TelemetryPolicyviagcloud beta:# tracing-policy.yaml name: "projects/PROJECT_ID/locations/REGION/telemetryPolicies/agw-trace-policy" displayName: "Tracing policy for Agent Gateway traffic" telemetryTarget: resources: - "//networkservices.googleapis.com/projects/PROJECT_ID/locations/REGION/agentGateways/AGENT_GATEWAY_NAME" tracingConfiguration: samplingRate: 1.0 parentBasedSampling: enabled: true samplingRate: 1.0gcloud beta network-services telemetry-policies import agw-trace-policy \ --source=tracing-policy.yaml \ --location=REGION \ --project=PROJECT_ID
9. Common Failure Modes & Troubleshooting Guide
| Symptom | Root Cause | Remediation |
|---|---|---|
Gateway mutation fails with HTTP 409 ABORTED: unable to queue the operation | Resource-level LRO mutex active from concurrent PATCH/import/delete, or recent gateway tombstone | Poll active LRO to completion (~1.5–2 min) before retrying; use a new gateway ID if recreating immediately after delete. |
HTTP 404 on HTTP CONNECT when using HTTPS_PROXY | Missing v1beta1 L4 AuthzPolicy (networkRules snis); L7 HTTP manager rejects nested CONNECT | Import ALLOW AuthzPolicy with networkRules[].to.operations[].snis via gcloud beta (omit loadBalancingScheme & ports; see §6.3). |
HTTP 498 immediately after binding runtime to gateway | Enforcing gateway bound before allowlisting essential Google APIs (googleapis service + UAP/IAP policy) | Register the 8 base Google API FQDNs and verify UAP/IAP allow rules (or DRY_RUN) before binding the runtime. |
Outbound SaaS calls hang/time out under ACT ALL_TRAFFIC | Consumer VPC PSC-I subnet lacks Cloud NAT | Deploy Cloud Router and Cloud NAT covering the PSC-I subnet. |
503 / SERVFAIL or NXDOMAIN on private or Google API hosts | >2 total Cloud DNS peering hops, missing gcp-sa-agentgateway roles/dns.peer, or authoritative "." private root zone | Limit peering to <=1 consumer hop (2 total), grant roles/dns.peer + roles/dns.reader to gcp-sa-agentgateway, and replace any authoritative "." private root zone with specific domain suffixes or a Cloud DNS Private Forwarding Zone. |
TLS fails to *.googleapis.com after attaching TrustConfig | Omitted additionalRoots: PUBLICLY_TRUSTED_ROOTS on ACT tlsConfig | Create a new ACT including additionalRoots: PUBLICLY_TRUSTED_ROOTS and PATCH agentConnectivityTemplate on the gateway. |
Private VPC backend returns 503 despite valid DNS, routes, & firewall | Network Security Packet Intercept (InterceptDeploymentGroup) enabled on consumer VPC | Move the Agent Gateway Network Attachment to a consumer VPC without Packet Intercept, or exclude the PSC-I subnet. |
ACT or AuthzExtension deletion fails with HTTP 400 ... already being used | Child resources deleted out of order while AgentGateway or AuthzPolicy still references them | Follow the 7-step teardown sequence in §10.3, polling each deletion LRO to completion. Open a Google Cloud Support case if an orphaned backend reference persists after zero gateways remain. |
Agent Runtime deletion fails with HTTP 400 FAILED_PRECONDITION | Active sessions or memories exist on the Reasoning Engine | Pass ?force=true on the DELETE .../reasoningEngines/{ID}?force=true REST call. |
REST API egress returns 403 on /api/v2/tickets.json | Unregistered UAP CEL rule matched /api/v2/tickets without .json / ? variants | Match exact path, .json, / subpaths, and ? query strings on destination.unregistered.path. |
10. Reference Gateway, ACT Specifications, & Ordered Teardown
10.1 Agent Connectivity Template YAML (act.yaml)
name: projects/PROJECT_ID/locations/REGION/agentConnectivityTemplates/agw-all-traffic-template
accessPath: AGENT_TO_ANYWHERE
deploymentModel: CENTRALIZED
egressNetworkConfig:
networkAttachment: projects/PROJECT_ID/regions/REGION/networkAttachments/agw-network-attachment
vpcEgress: ALL_TRAFFIC
dnsPeeringConfig:
domains:
- corp.internal.
targetNetwork: projects/PROJECT_ID/global/networks/agw-consumer-vpc
tlsConfig:
trustConfig: projects/PROJECT_NUMBER/locations/REGION/trustConfigs/private-ca-trust
additionalRoots: PUBLICLY_TRUSTED_ROOTSImport via GA CLI:
gcloud network-services agent-connectivity-templates import agw-all-traffic-template \
--source=act.yaml \
--location=REGION \
--project=PROJECT_ID10.2 Agent Gateway YAML (gateway.yaml)
name: projects/PROJECT_ID/locations/REGION/agentGateways/agw-prod-gateway
agentConnectivityTemplate: projects/PROJECT_NUMBER/locations/REGION/agentConnectivityTemplates/agw-all-traffic-template
googleManaged:
governedAccessPath: AGENT_TO_ANYWHERE
protocols:
- MCP
registries:
- //agentregistry.googleapis.com/projects/PROJECT_ID/locations/REGIONImport via GA CLI:
gcloud network-services agent-gateways import agw-prod-gateway \
--source=gateway.yaml \
--location=REGION \
--project=PROJECT_ID10.3 Dependency-Ordered 7-Step Public Teardown Sequence
Deleting resources out of order causes HTTP 400 FAILED_PRECONDITION (already being used). Always tear down in this order and wait for each LRO to finish:
Unbind or delete workloads: Unbind (
?updateMask=agentGatewayConfig/ Gemini EnterpriseUpdateEngine) or delete bound Reasoning Engines (?force=trueif sessions exist).Delete UAP
PolicyBindingthenAccessPolicy: Pollgcloud iam policy-bindings describeuntil404(10–30s consistency window) before deletingAccessPolicy.Delete
AuthzPolicyresources: Rungcloud network-security authz-policies delete(orgcloud betafor L4networkRulespolicies) and wait for LRO completion before deleting extensions or gateways.Delete
AuthzExtension,ExtensionBinding, &TelemetryPolicy: Remove extensions (gcloud service-extensions authz-extensions delete/gcloud beta service-extensions extension-bindings delete) and tracing policies (gcloud beta network-services telemetry-policies delete). (If Token Management Policies are used on self-managed SWP, deleteCostPerTokenPolicy→TokenBudgetPolicy→TokenAggregationPolicy.)Delete
AgentGateway: Rungcloud network-services agent-gateways deleteand poll the operation todone: true.Delete
AgentConnectivityTemplate: Rungcloud network-services agent-connectivity-templates deleteonly aftergcloud network-services agent-gateways list --location=REGIONconfirms zero gateways reference it.Delete
TrustConfig,NetworkAttachment, Cloud NAT, & Subnet: Clean up Certificate Manager and VPC networking resources last.
11. Cross-Project Centralized Governance Architecture
Google Cloud's Gemini Enterprise Agent Platform supports cross-project bindings from Agent Runtimes (Vertex AI Reasoning Engines) in consumer projects to an Agent Gateway in a Centralized Governance Project.
11.1 Three-Tier Project Boundary Model
To separate policy authoring, network security, and runtime execution, enterprise deployments structure responsibilities across three distinct project tiers:
Centralized Governance Project (
AGW_PROJECT_ID):Agent Registry (
agentregistry.googleapis.com): The authoritative catalog of vetted MCP tools, endpoints, and peer agents. Both Gateway and Registry MUST reside in this same project.Agent Gateway (
networkservices.googleapis.com): The managedAGENT_TO_ANYWHEREgateway instance mediating all outbound agent traffic.Model Armor Templates & IAP/UAP Policies: Guardrails for request/response DLP inspection, prompt injection detection, and CEL-based authorization.
Network Infrastructure: Egress VPC with a Private Service Connect (PSC-I) Network Attachment, Cloud NAT, and Private DNS peering.
Agent Runtime Projects (
AE_PROJECT_NUMBER):Vertex AI Reasoning Engines: Containerized agent execution environments deployed by product/application teams.
Cross-Project Gateway Binding: Configured in
agentGatewayConfig.agentToAnywhereConfig.agentGatewaypointing directly to the central gateway resource.No Local VPC Required: Runtimes do not require local VPCs or interconnects; all private traffic tunnels into the governance project's network attachment.
MCP & Service Backend Projects (
MCP_PROJECT_ID):Host business logic, databases, or microservices (Cloud Run, GKE, Compute Engine). Services are explicitly registered into the central Agent Registry catalog.
11.2 Cross-Project IAM Requirements
To bind an Agent Runtime to an Agent Gateway in another project, permissions must be granted to both the deploying caller and the runtime project's service agent:
Deploying Principal (Developer EUC, Cloud Build, or CI/CD Service Account): The caller invoking
client.agent_engines.createor Vertex AI REST API must hold:networkservices.agentGateways.getnetworkservices.agentGateways.use(or roleroles/networkservices.viewer) onprojects/AGW_PROJECT_ID/locations/REGION/agentGateways/GATEWAY_NAME.
Vertex AI Service Agent: Grant access to the runtime project's service agent on the governance project (
AGW_PROJECT_ID):Option A: Predefined Role (Network Services Viewer):
gcloud projects add-iam-policy-binding "AGW_PROJECT_ID" \ --member="serviceAccount:service-AE_PROJECT_NUMBER@gcp-sa-aiplatform.iam.gserviceaccount.com" \ --role="roles/networkservices.viewer"Option B: Least-Privilege Custom Role (
ae_agw_cross_project_sa/ar_agw_cross_project_sa):gcloud iam roles create ae_agw_cross_project_sa \ --project="AGW_PROJECT_ID" \ --title="AE AGW Cross Project SA" \ --description="Custom role for cross-project service agent to access Agent Gateways and Operations" \ --permissions="networkservices.agentGateways.get,networkservices.operations.get" \ --stage="GA" gcloud projects add-iam-policy-binding "AGW_PROJECT_ID" \ --member="serviceAccount:service-AE_PROJECT_NUMBER@gcp-sa-aiplatform.iam.gserviceaccount.com" \ --role="projects/AGW_PROJECT_ID/roles/ae_agw_cross_project_sa"
11.3 Agent Runtime Deployment Specification
Deploy the agent runtime referencing the central gateway and disabling bound token sharing via CAA opt-out:
remote_agent = client.agent_engines.create(
agent=local_agent,
config={
"agent_gateway_config": {
"agent_to_anywhere_config": {
"agent_gateway": (
"projects/AGW_PROJECT_ID/locations/REGION/agentGateways/AGENT_GATEWAY_TO_ANYWHERE_NAME"
)
},
},
"identity_type": types.IdentityType.AGENT_IDENTITY,
"env_vars": {
# Opt out of default Context-Aware Access (CAA) token binding to allow
# token validation through cross-project gateway egress
"GOOGLE_API_PREVENT_AGENT_TOKEN_SHARING_FOR_GCP_SERVICES": False,
},
},
)Warning: Regional Colocation Invariant: The Agent Runtime and the Agent Gateway MUST reside in the exact same Google Cloud region (e.g.,
us-central1). Cross-region bindings fail control plane validation withINVALID_ARGUMENT.
11.4 Two-Tier Registry Authorization Model
Tier 1: Baseline Google APIs Access (Coarse-Grained via
principalSet://): All runtimes require baseline access to Google Cloud APIs for discovery, telemetry, and platform operations. Register the consolidatedgoogleapisendpoint in the central registry and authorize runtimes using project-level or trust-domain-wide principal sets:Project-Level Scope:
principalSet://TRUST_DOMAIN/attribute.platformContainer/aiplatform/projects/AE_PROJECT_NUMBERTrust-Domain-Wide Scope:
principalSet://TRUST_DOMAIN/*Role:
roles/iap.egressoron the Google APIs endpoint.
Important: Folder-Level Syntax Limitation:
attribute.platformContainer/aiplatform/folders/FOLDER_NUMBERis not an indexed attribute in IAM SPIFFE URI evaluation. Scoping must strictly use project-level syntax or Principal Access Boundary (PAB) policies.Tier 2: Granular MCP Tools & Peer Agents (Fine-Grained via
principal://): For sensitive business tools, grantroles/iap.egressoron the specific MCP server resource directly to the individual Reasoning Engine:principal://TRUST_DOMAIN/resources/aiplatform/projects/AE_PROJECT_NUMBER/locations/REGION/reasoningEngines/ENGINE_IDOptionally restrict with CEL conditions:api.getAttribute('iap.googleapis.com/mcp.tool.isReadOnly', false) == true || api.getAttribute('iap.googleapis.com/mcp.toolName', '') == ''
11.5 Server-Generated Resource ID Extraction Pattern
In Agent Registry, all write operations use gcloud agent-registry services create. However, IAP authorization policies must be bound to the server-generated resource ID (agentregistry-00000000-...), NOT the friendly service name:
# 1. Fetch server-generated resource ID
REGISTRY_RESOURCE=$(gcloud agent-registry services describe MCP_SERVICE_NAME \
--project="AGW_PROJECT_ID" \
--location="REGION" \
--format='value(registryResource)')
RESOURCE_ID=$(basename "$REGISTRY_RESOURCE")
# 2. Grant roles/iap.egressor on iap_web/agentRegistry/mcpServers/{RESOURCE_ID}
# (Use agents.global.proj-AE_PROJECT_NUMBER.system.id.goog/... if orgless)
gcloud iap web add-iam-policy-binding \
--project="AGW_PROJECT_ID" \
--region="REGION" \
--resource-type=agent-registry \
--mcp-server="${RESOURCE_ID}" \
--member="principal://agents.global.org-ORG_ID.system.id.goog/resources/aiplatform/projects/AE_PROJECT_NUMBER/locations/REGION/reasoningEngines/ENGINE_ID" \
--role="roles/iap.egressor"11.6 VPC Service Controls (VPC-SC) Perimeter Bridging
If the Centralized Governance Project (AGW_PROJECT_ID) and the Agent Runtime Projects (AE_PROJECT_NUMBER) reside in different VPC-SC service perimeters:
Establish a Perimeter Bridge connecting both perimeters, OR
Configure explicit Ingress and Egress Rules on both perimeters permitting cross-perimeter communication for:
aiplatform.googleapis.comnetworkservices.googleapis.comagentregistry.googleapis.com
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 or Google.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download agent-platform-troubleshooting.zip