Generated banner for Agent Platform Architecture
Generated logo for Agent Platform Architecture

Agent Platform Architecture

GoogleOfficialPublished by Google

  • Skill
  • Tool integration
  • Cloud and DevOps
  • Apache-2.0
  • Low risk

From the author

Designs, engineers, and validates enterprise Gemini platform architectures. Use when designing multi-project hierarchies (Host, Central Governance Hub, Runtime Spoke, Tool/MCP Spoke), configuring Agent Gateway, authoring Agent Connectivity Templates (ALL_TRAFFIC vs PRIVATE_RANGES_ONLY), deploying Secure Web Proxy (SWP) with Policy-Based Routing (PBR) or Cross-Cloud mTLS Egress Hubs, configuring Private CA TrustConfig with Internal ALB + Serverless NEG, implementing Unified Access Policies (UAP Policy V2 CEL) and Semantic Governance (SGP), configuring 3P IdP Token Exchange (EntraID/Ping/Okta via ext_proc + STS) or Agent Identity Auth Manager (SPIFFE), enforcing Model Armor Floor Settings and Fail-Closed guardrails, deploying Cross-Project Registry sync, binding ADK agents on Agent Runtime, or executing Day-2 lifecycle operations. Don't use for read-only live log triage or incident diagnosis, or generic Google Cloud Identity and Access Management (IAM) debugging.
— the description by Google

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

This skill provides a structured framework for architecting and managing enterprise Gemini platform environments. It covers multi-project hierarchies, secure network connectivity via Agent Connectivity Templates (ACT), and advanced governance using Unified Access Policies (UAP) and Model Armor. It is designed for engineers building scalable, zero-trust agent platforms that require specific egress patterns, identity management, and cross-cloud integration.

What it does

  • Designs multi-project hierarchies including Host, Governance Hub, and Runtime Spokes.
  • Configures Agent Connectivity Templates for ALL_TRAFFIC or PRIVATE_RANGES_ONLY egress.
  • Implements security guardrails using Model Armor and Unified Access Policies (UAP V2).
  • Sets up identity and token exchange using SPIFFE and 3P IdP integration.
  • Manages Day-2 lifecycle operations for agent runtimes and connectivity templates.
  • Validates architecture through a structured 3-phase deployment and audit process.

When to use it

  • When designing the network and security topology for a new enterprise Gemini platform.
  • When configuring secure egress and ingress patterns for agent-to-service communication.
  • When implementing cross-project governance and identity boundaries.
  • When troubleshooting connectivity or policy enforcement issues in a Gemini platform stack.

Advantages

  • Provides a standardized, repeatable approach to complex platform architecture.
  • Ensures adherence to zero-trust principles and least-privilege IAM.
  • Reduces configuration drift through clear, domain-specific reference manuals.
  • Supports complex requirements like hybrid mTLS and cross-cloud egress hubs.

Usage examples

“Design a multi-project hierarchy for a Gemini platform with a central governance hub and separate runtime spokes.”
The agent will outline the project structure, VPC layout, and IAM bootstrap requirements for the requested hierarchy.
“How do I configure an Agent Connectivity Template for ALL_TRAFFIC egress?”
The agent will provide the specific YAML manifest and CLI commands to configure the ACT with the required egress mode.

Install

  1. Download the skill as a ZIP:

    https://mp-staging.autogineer.com/agent-skills/google/agent-platform-architecture/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip agent-platform-architecture.zip -d .agents/skills

Documentation by Google

Gemini platform Architecture and Engineering Guide

This skill is the reference system for designing, engineering, and validating enterprise-grade Gemini platform architectures across multi-project hierarchies, hybrid/cross-cloud networks, zero-trust identity boundaries, and inline safety/policy enforcement planes.

Usage Attribution

MUST READ: Before executing any gcloud, REST API, or MCP command, you MUST read and follow the instructions in Usage Attribution.

[!IMPORTANT] Architectural Scope and Reference Discipline: Use SKILL.md to select the target topology, egress mode, ingress pattern, and governance plane, then consult the authoritative references/*.md manual for exact CLI commands, REST/YAML schemas, Common Expression Language (CEL) expressions, and Python Agent Development Kit (ADK) runtime code (references/*.md is the single source of truth for all implementation syntax). When remote Model Context Protocol (MCP) tools (such as the Google Developer Knowledge MCP server or Google-managed MCP endpoints) are available, prefer remote MCP tool invocation over raw CLI/REST commands. Do not execute unrequested live mutations against customer projects when asked for architectural designs.

[!CAUTION] Human Approval Gate for Sensitive Operations: Always prompt the user for explicit confirmation before executing commands or applying configurations that grant permissive Identity and Access Management (IAM) bindings (roles/iap.egressor, roles/compute.networkUser, roles/networkservices.admin), modify Organization Policies (constraints/iam.managed.disableAccessPolicyBinding), update Unified Access Policy (UAP) or VPC Service Controls (VPC-SC) policies, or delete resources (REST DELETE ...?force=true or CLI --quiet).


Prerequisites, Authentication, Region, and Billing Setup

  1. Google Cloud SDK, Authentication, and Project Setup:

    • Install the Google Cloud SDK (gcloud) and authenticate CLI and Application Default Credentials (gcloud auth login && gcloud auth application-default login, or set GOOGLE_APPLICATION_CREDENTIALS).

    • Select or create the target project (gcloud projects create {project_id} / gcloud config set project {project_id}), set the default region (gcloud config set compute/region {region}, defaulting to us-central1; see Google Cloud Locations), and enable required APIs:

      gcloud services enable aiplatform.googleapis.com agentregistry.googleapis.com \
        agentidentity.googleapis.com agentidentitycredentials.googleapis.com \
        networkservices.googleapis.com networksecurity.googleapis.com iap.googleapis.com \
        modelarmor.googleapis.com compute.googleapis.com dns.googleapis.com \
        certificatemanager.googleapis.com servicenetworking.googleapis.com
  2. Billing, Least-Privilege IAM, and Product Terminology:

    • Verify an active billing account is attached (gcloud billing projects describe {project_id} --format="value(billingEnabled)") across {host_project_id}, {gov_project_id}, {runtime_project_id}, and {mcp_project_id} (required even when evaluating free-tier allowances; review Google Cloud Pricing).

    • Grant explicit least-privilege IAM roles (roles/aiplatform.user, roles/networkservices.admin, roles/compute.networkAdmin, roles/compute.networkUser, roles/iap.egressor, or a custom role with networkservices.agentGateways.get,networkservices.agentGateways.use,networkservices.operations.get) rather than primitive roles/owner or roles/editor.

    • Use approved product names: Gemini platform, Agent Runtime (reasoningEngines), Agent Gateway (240.0.0.2:443), Agent Connectivity Template (ACT), Agent Registry, and Unified Access Policy (UAP Policy V2) / Semantic Governance Policy (SGP).


3-Phase Architect Workflow and Decision Tree

graph TD
    Start["Enterprise Gemini platform Architecture"] --> Q1{"1. Egress Destinations?"}
    Q1 -->|"RFC 1918 + Google APIs Only"| Priv["ACT: vpcEgress = PRIVATE_RANGES_ONLY<br/>• Direct Private Google Access (PGA)"]
    Q1 -->|"Public Internet, VPC-SC, or Non-RFC 1918 PUPI"| All["ACT: vpcEgress = ALL_TRAFFIC<br/>• 100% Egress via AGW VIP 240.0.0.2:443<br/>• Consolidate Core Google APIs FQDNs"]
    All --> Q2{"2. Layer 7 URL List or Cross-Cloud mTLS?"}
    Q2 -->|"No (Standard NAT)"| Nat["Direct Cloud NAT on PSC-I Subnet<br/>• ENDPOINT_TYPE_VM,ENDPOINT_TYPE_SWG"]
    Q2 -->|"Yes (Next-Hop SWP)"| Swp["Next-Hop SWP (NEXT_HOP_ROUTING_MODE) + PBR<br/>• Internal and Google API DEFAULT_ROUTING bypasses<br/>• Default route via SWP ILB IP<br/>• Exclude PSC-I from manual Cloud NAT"]
  1. Phase 1 — Scope Verification and Architecture Discovery:

    • Scope Boundaries and Single-Region Discovery: Decline generic Google Cloud IAM/Compute/Storage debugging unrelated to the Gemini platform stack or requests to run broad multi-region live project scanning loops, pointing instead to gcloud ai reasoning-engines list --region={region}.

    • Architecture Design and Engineering: Identify the project hierarchy (Host, Governance Hub, Runtime Spoke, Tool/MCP Spoke), egress mode (ALL_TRAFFIC vs PRIVATE_RANGES_ONLY), policy plane (UAP V2, SGP, Model Armor), and target output format (topology specification, gcloud CLI commands, or REST/YAML manifests).

  2. Phase 2 — Draft Architecture Plan and Resource Mapping:

    • Synthesize the topology diagram, project/VPC layout, IAM bootstrap matrix, and security controls using the Domain Router and Symptom Matrix, and map each manual's canonical REST/YAML schema and CLI commands into the target deployment artifacts.

  3. Phase 3 — Post-Deployment and Audit Log Verification:

    • Pair every architecture design with the Post-Deployment and Cloud Audit Log Verification checklist (references/topologies_and_project_layouts.md) and runtime query validation (references/agent_runtime_and_identity.md).


Domain Router and Symptom Matrix

Each reference manual in references/ is the single source of truth for its domain's CLI commands, REST/YAML schemas, quotas, and CEL expressions. Always read the corresponding reference manual before generating configurations or answering domain-specific questions:

Architecture DomainTopics and Architectural Decisions CoveredSymptoms and Failure Modes Routed HereCanonical Reference Manual
1. Project Hierarchy, Shared VPC, VPC-SC, and Custom RoutingMulti-project separation (Host, Governance Hub, Runtime Spoke, Tool/MCP Spoke), PSC-I subnet sizing, cross-project Service Agent IAM bootstrap, VPC-SC perimeters, non-RFC 1918 PUPI/peered custom route exchange, and post-deployment Cloud Audit Log verification.PSC-I IP exhaustion, cross-project attachment or addressGroup permission denials, VPC-SC perimeter blocks, dropped non-RFC 1918 internal routes, or post-deployment verification.references/topologies_and_project_layouts.md
2. Agent Connectivity Template (ACT) and Agent GatewayChoosing ALL_TRAFFIC vs PRIVATE_RANGES_ONLY, ACT and Agent Gateway REST/YAML schemas, control-plane URI formatting, registry attachment limits, and container custom Root CA bundle trust.Control-plane URI validation errors, registry attachment limit errors, or container TLS verification failures ([SSL: UNEXPECTED_EOF_WHILE_READING]).references/agent_gateway_and_act.md
3. Outbound Routing, Next-Hop SWP, PBR, and Hybrid mTLSSource-range Policy-Based Routes (PBR) for PSC-I subnets, Next-Hop Secure Web Proxy (NEXT_HOP_ROUTING_MODE), swg-autogen-nat vs manual Cloud NAT coexistence, gRPC/A2A/WebSocket routing, Spanner SA impersonation, and Cross-Cloud mTLS Egress Hubs (Hybrid NEG).Asymmetric return-routing drops between manual Cloud NAT and swg-autogen-nat, outbound URL filtering on PSC-I interfaces, or cross-cloud mTLS origination over Cloud Interconnect/VPN.references/egress_routing_and_swp.md
4. Ingress ALB, URL Rewrites, Private CA, and 3P IdP STSTwo-Tier and Single-Tier ALB ingress with URL Map hostRewrite/pathPrefixRewrite, Private CA TrustConfig with Regional Internal ALB + Serverless NEG for Cloud Run MCP servers, and 3P IdP (EntraID/Ping/Okta) token exchange via LbTrafficExtension (ext_proc + STS).WebPKI root stripping (NO_ADDITIONAL_ROOTS), empty :authority drops on Serverless NEGs, *.run.app Google-managed certificate mismatches, or OAuth/IAP header collisions.references/ingress_patterns_and_rewrites.md
5. UAP Policy V2, IAP V1, SGP, and Model Armor GovernanceOrganization/Folder/Project UAP Policy V2 and IAP V1 CEL authorization rules, Semantic Governance Policy (SGP CONTENT_AUTHZ), custom AuthzExtension / AuthzPolicy targets, and fail-closed Model Armor Floor Settings, templates, and ADK callbacks.Egress request is not authorized (HTTP 403 / status.code=7) on MCP initialize or tools/list, failed to parse the service URL on AuthzExtension, binary gRPC parser crashes, or fail-open safety bypasses.references/governance_security_policies.md
6. Agent Registry, Consolidated googleapis, and FederationConsolidating core Google APIs FQDNs into a single googleapis service (ALL_TRAFFIC), registering MCP/A2A/REST services, extracting server-generated registryResource UUIDs for roles/iap.egressor, and Event-Driven Spoke-to-Hub Registry Federation.ALL_TRAFFIC agent startup or telemetry blackholing, IAM binding target mismatches on Registry resources, OpenAPI/MCP spec size rejections, or multi-project catalog drift.references/registry_and_federation.md
7. ADK Runtime Packaging, Agent Identity, and Day-2 OperationsPackaging ADK agents with AGENT_IDENTITY (SPIFFE) and Auth Manager, regional residency, BigQuery pre-execution cost guards, in-place ACT updates, reverse-dependency teardown, and external Cloud NAT IP verification.Raw credential exposure, HTTP 409 ABORTED control-plane mutex locks, HTTP 400 FAILED_PRECONDITION (FROM_AGENT_GATEWAY* or contains child resources: sessions), or X-Forwarded-For: 0.0.0.0 when probing *.run.app.references/agent_runtime_and_identity.md

Files

references/egress_routing_and_swp.md

Egress Architecture: Routing, SWP, and gRPC Interception

This reference details the low-level data-plane routing mechanics for outbound traffic from Gemini platform workloads, focusing on Policy-Based Routing, Secure Web Proxy next-hop mode, and non-HTTP/2 gRPC traversal.


Table of Contents

  • 1. Outbound Interception Pipeline (ALL_TRAFFIC): Lines 22-54

  • 2. Policy-Based Routing (PBR) vs Static Routes: Lines 55-128

  • 3. Secure Web Proxy (SWP) NEXT_HOP_ROUTING_MODE: Lines 129-218

  • 4. Consuming gRPC Endpoints (Spanner / Google APIs): Lines 219-248

  • 5. Egress to Cloud Run / Cloud Functions (OIDC JWT and Header Conflict Invariant): Lines 249-293

  • 6. Mutual TLS (mTLS) Client Certificate Management: Lines 294-312

  • 7. Cross-Cloud and Hybrid Secure Web Proxy (SWP) mTLS Egress Hub: Lines 313-371


1. Outbound Interception Pipeline (ALL_TRAFFIC)

When the Agent Connectivity Template is set to vpcEgress: ALL_TRAFFIC, outbound connections follow a deterministic multi-stage interception pipeline:

graph TD
    Agent[Reasoning Engine Container] -->|DNS Resolution| SyntheticDNS[Synthetic Resolver]
    SyntheticDNS -->|Returns 240.0.0.2| Agent
    Agent -->|TCP Connect 240.0.0.2:443| AGW_Proxy[Agent Gateway Envoy Proxy]
    AGW_Proxy -->|TLS SNI Inspection| SNICheck{SNI in Registry?}
    SNICheck -->|No Match (Policy V1)| Drop1[Drop: default_denied<br/>UNEXPECTED_EOF_WHILE_READING]
    SNICheck -->|No Match (UAP Policy V2:<br/>destination.is_registered == false)| IAPCheck{UAP / IAP Authz}
    SNICheck -->|Matched (destination.is_registered == true)| IAPCheck
    IAPCheck -->|Denied| Drop2[HTTP 403 / TLS Drop]
    IAPCheck -->|Allowed| PSC_I[PSC Network Attachment]
    PSC_I -->|Enters Consumer Subnet| PBR[Policy-Based Route (PBR)]
    PBR -->|Next-Hop Forwarding| SWP[Secure Web Proxy (NEXT_HOP)]
    SWP -->|Security Policy CEL| CloudNAT[Cloud NAT (Autogen)]
    CloudNAT -->|Egress with Static IP| Internet[External SaaS / APIs]

[!NOTE] IAM Policy V1 vs. UAP Policy V2 Unregistered SNI Behavior: When the AuthzExtension uses legacy IAM Policy V1 (no iapPolicyVersion = "V2"), any SNI not cataloged in Agent Registry is immediately dropped at TLS termination with default_denied ([SSL: UNEXPECTED_EOF_WHILE_READING]). When iapPolicyVersion = "V2" is enabled, unregistered SNIs are evaluated by the IAP authorization engine against UAP rules matching destination.is_registered == false (using destination.unregistered.host, .path, and .method) before being allowed or dropped.


2. Policy-Based Routing (PBR) vs Static Routes

Standard Google Cloud VPC routing has a critical limitation when intercepting traffic from Network Attachments:

  • Static Route Tag Incompatibility: Static routes targeting an Internal Load Balancer (--next-hop-ilb) require network tags (--tags). However, Private Service Connect Interfaces (PSC-I) provisioned by Google-managed tenant projects cannot have network tags attached.

  • PSC Route Target Prohibition: Google Cloud route tables explicitly prohibit PSC forwarding rules or service attachments as next-hop targets.

  • The PBR Solution: Policy-Based Routing (PBR) routes traffic based on source IP range rather than network tags. By matching --source-range=<PSCI_SUBNET_CIDR> and --destination-range=0.0.0.0/0, PBR cleanly intercepts all egress exiting the Network Attachment and directs it to the SWP internal load balancer IP.

PBR Resource Manifests
1. Internal / Peered Route Bypass (priority: 50, Evaluated First)

To prevent internal RFC 1918 or peered non-RFC 1918 PUPI (${PUPI_CIDR}) VPC destinations from being hair-pinned into the external Secure Web Proxy, place a higher-priority (priority: 50, lower numerical value = evaluated first) DEFAULT_ROUTING rule ahead of the priority: 100 0.0.0.0/0 SWP catch-all:

# Canonical REST/YAML resource name requires /locations/global/policyBasedRoutes/
name: projects/${PROJECT_ID}/locations/global/policyBasedRoutes/pbr-psci-default-fallback-10
description: "Bypass SWP for RFC 1918 (10.0.0.0/8, plus priority 50 rules for 172.16.0.0/12 and 192.168.0.0/16)"
network: "projects/${PROJECT_ID}/global/networks/${VPC_NAME}"
priority: 50
filter:
  protocolVersion: IPV4
  srcRange: "${PSCI_SUBNET_CIDR}"    # REST/YAML field is srcRange (gcloud CLI flag is --source-range); must match PSC-I Subnet CIDR (/26+, such as 10.20.1.0/26)
  destRange: "10.0.0.0/8"           # Pair with priority: 50 for 172.16.0.0/12 and 192.168.0.0/16, priority: 51 for ${PUPI_CIDR} (PUPI), priority: 52 for 199.36.153.8/30 (PGA), and priority: 53 for 199.36.153.4/30 (VPC-SC)
  ipProtocol: ALL
nextHopOtherRoutes: DEFAULT_ROUTING
2. Primary Policy-Based Route (PSC-I Public Egress to SWP, priority: 100)
name: projects/${PROJECT_ID}/locations/global/policyBasedRoutes/pbr-psci-to-swp
description: "Steer PSC-I agent public egress to Secure Web Proxy internal IP"
network: "projects/${PROJECT_ID}/global/networks/${VPC_NAME}"
priority: 100
filter:
  protocolVersion: IPV4
  srcRange: "${PSCI_SUBNET_CIDR}"    # REST/YAML field is srcRange (gcloud CLI flag is --source-range)
  destRange: "0.0.0.0/0"
  ipProtocol: ALL
nextHopIlbIp: "${SWP_ILB_IP}"       # Internal IP of SWP Gateway in dedicated SWP subnet (such as 10.20.2.50)
export PROJECT_ID="host-vpc-proj" VPC_NAME="enterprise-shared-vpc"
export PSCI_SUBNET_CIDR="10.20.1.0/26" SWP_ILB_IP="10.20.2.50" PUPI_CIDR="198.51.100.0/24"
# For multi-VPC custom/PUPI route exchange (HOST_VPC / SPOKE_VPC peerings), see references/topologies_and_project_layouts.md Section 9.

for IDX_CIDR in "10:10.0.0.0/8" "172:172.16.0.0/12" "192:192.168.0.0/16"; do
  gcloud network-connectivity policy-based-routes create "pbr-psci-rfc1918-${IDX_CIDR%%:*}" \
    --project="${PROJECT_ID}" --network="projects/${PROJECT_ID}/global/networks/${VPC_NAME}" \
    --source-range="${PSCI_SUBNET_CIDR}" --destination-range="${IDX_CIDR#*:}" \
    --ip-protocol="ALL" --priority=50 --next-hop-other-routes="DEFAULT_ROUTING"
done
gcloud network-connectivity policy-based-routes create "pbr-psci-to-swp" \
  --project="${PROJECT_ID}" --network="projects/${PROJECT_ID}/global/networks/${VPC_NAME}" \
  --source-range="${PSCI_SUBNET_CIDR}" --destination-range="0.0.0.0/0" \
  --ip-protocol="ALL" --priority=100 --next-hop-ilb-ip="${SWP_ILB_IP}"

3. Secure Web Proxy (SWP) NEXT_HOP_ROUTING_MODE

When deploying Secure Web Proxy behind an Agent Gateway Network Attachment:

  1. Type and Routing Mode (Transparent PBR Next-Hop vs. Explicit Proxy Mode): When SWP operates as a Transparent PBR Next-Hop (Section 3), the Gateway resource must specify type: SECURE_WEB_GATEWAY and routingMode: NEXT_HOP_ROUTING_MODE (specifying SECURE_WEB_PROXY or omitting routingMode in PBR Next-Hop mode causes import failure). Conversely, when SWP operates in Explicit Proxy / Cross-Cloud NLB Termination Mode (Section 7), omit routing_mode and attach certificate_urls and server_tls_policy.

  2. Dedicated SWP Subnet + Proxy-Only Subnet: Place the SWP Gateway instance in its own regular RFC 1918 subnet (10.20.2.0/24, distinct from the PBR-intercepted PSC-I subnet 10.20.1.0/26 so SWP outbound packets are not re-intercepted by PBR), alongside a regional proxy-only subnet (sized to at least /26, such as 10.20.3.0/24) with purpose: REGIONAL_MANAGED_PROXY and role: ACTIVE.

  3. Autogenerated Cloud NAT: SWP in NEXT_HOP_ROUTING_MODE automatically provisions an autogenerated router (swg-autogen-router-{network_id}) and Cloud NAT (swg-autogen-nat) with natIpAllocateOption: AUTO_ONLY and ENDPOINT_TYPE_SWG. Exclude the PSC-I subnet from any manual Cloud NAT via LIST_OF_SUBNETWORKS (never ALL_SUBNETWORKS_ALL_IP_RANGES); outbound calls reflect swg-autogen-nat IPs.

Gateway Resource Definition
name: projects/${PROJECT_ID}/locations/${REGION}/gateways/swp-egress-gateway
type: SECURE_WEB_GATEWAY
routingMode: NEXT_HOP_ROUTING_MODE
addresses: ["${SWP_ILB_IP}"]
ports: [443]
subnetwork: "projects/${PROJECT_ID}/regions/${REGION}/subnetworks/${SWP_SUBNET_NAME}"
network: "projects/${PROJECT_ID}/global/networks/${VPC_NAME}"
gatewaySecurityPolicy: "projects/${PROJECT_ID}/locations/${REGION}/gatewaySecurityPolicies/swp-security-policy"
Gateway Security Policy and Rules
name: projects/${PROJECT_ID}/locations/${REGION}/gatewaySecurityPolicies/swp-security-policy
description: "Egress policy for approved agent destinations"
name: projects/${PROJECT_ID}/locations/${REGION}/gatewaySecurityPolicies/swp-security-policy/rules/deny-denylisted-llms
priority: 10
basicProfile: DENY
enabled: true
sessionMatcher: "host() in ['api.openai.com', 'api.anthropic.com', 'api.cohere.ai'] || host().endsWith('.openai.com') || host().endsWith('.anthropic.com') || host().endsWith('.cohere.ai')"
# GatewaySecurityPolicy enforces implicit default-DENY for all unmatched hosts; priority 100 ALLOW permits only explicit approved FQDNs:
name: projects/${PROJECT_ID}/locations/${REGION}/gatewaySecurityPolicies/swp-security-policy/rules/allow-approved-domains
priority: 100
basicProfile: ALLOW
enabled: true
sessionMatcher: "host() == 'aiplatform.googleapis.com' || host() == 'aiplatform.mtls.googleapis.com' || host() == '${REGION}-aiplatform.googleapis.com' || host() == '${REGION}-aiplatform.mtls.googleapis.com' || host() == 'aiplatform.${REGION}.rep.googleapis.com' || host() == 'agentregistry.googleapis.com' || host() == 'agentidentity.googleapis.com' || host() == 'cloudresourcemanager.mtls.googleapis.com' || host() == 'iamcredentials.mtls.googleapis.com' || host() == 'telemetry.mtls.googleapis.com' || host() == 'trace.mtls.googleapis.com' || host() == 'logging.googleapis.com' || host() == 'monitoring.googleapis.com' || host() == 'cloudtrace.googleapis.com' || host() == 'telemetry.googleapis.com' || host() == 'spanner.googleapis.com' || host() == '${CLOUD_RUN_MCP_HOST}'"
gcloud network-security gateway-security-policies import swp-security-policy \
  --project="${PROJECT_ID}" --location="${REGION}" --source="swp-security-policy.yaml"
gcloud network-security gateway-security-policies rules import deny-denylisted-llms \
  --project="${PROJECT_ID}" --location="${REGION}" --gateway-security-policy="swp-security-policy" --source="deny-denylisted-llms.yaml"
gcloud network-security gateway-security-policies rules import allow-approved-domains \
  --project="${PROJECT_ID}" --location="${REGION}" --gateway-security-policy="swp-security-policy" --source="allow-approved-domains.yaml"
gcloud network-services gateways import swp-egress-gateway \
  --project="${PROJECT_ID}" --location="${REGION}" --source="swp-egress-gateway.yaml"

[!IMPORTANT] Explicit Google APIs FQDNs, PGA Bypass and .googleapis.com Wildcard Prohibition: In ALL_TRAFFIC mode, ADK streaming queries initialize sessions via POST https://{region}-aiplatform.mtls.googleapis.com/.../sessions. Configure Private Cloud DNS CNAME routing for *.googleapis.com and *.run.app to private.googleapis.com. (199.36.153.8/30) or restricted.googleapis.com. (199.36.153.4/30) with priority: 52..53 DEFAULT_ROUTING PBR bypasses so Google APIs and internal Cloud Run traffic route via Private Google Access, and list the explicit core Google APIs FQDNs, spanner.googleapis.com, and approved ${CLOUD_RUN_MCP_HOST} in the SWP sessionMatcher (preceded by a priority: 10 DENY rule for denylisted external LLM domains) rather than a broad host().endsWith('.googleapis.com') wildcard. Only append external test endpoints (host() == 'api.ipify.org' or host() == 'api.weather.gov') in non-production validation environments when running NAT reflection probes.


4. Consuming gRPC Endpoints (Spanner / Google APIs)

Google Cloud services accessed over binary gRPC (such as Spanner spanner.googleapis.com) require special handling:

  1. Upper-Case Protocol Binding: Google APIs accessed over gRPC must be registered in Agent Registry with protocolBinding: GRPC (strictly uppercase). Using lowercase grpc or JSONRPC causes proxy rejection.

  2. Unregistered Endpoint Fallback: Agent Gateway's Envoy HTTP/2 trie does not parse arbitrary gRPC method :path prefixes (such as /google.spanner.v1.Spanner/CreateSession), classifying them as agentGatewayInfo: {}. To allow gRPC streams through IAP authorization without opening a broad googleapis.com wildcard, configure a UAP allow rule scoped to the exact gRPC service hostname: ((destination.is_registered == false) && (destination.unregistered.host == 'spanner.googleapis.com')).

  3. SPIFFE Limitation on Data Plane: Spanner data-plane APIs do NOT evaluate SPIFFE URIs (principal://agents.global.org-...), returning 403 IAM_PERMISSION_DENIED. The agent workload must use Service Account Impersonation:

    • Grant the agent container's principalSet the role roles/iam.serviceAccountTokenCreator on an intermediate service account.

    • Grant the intermediate service account roles/spanner.databaseUser on the Spanner database.

    • In Python/ADK code, use Google Auth SDK impersonated_credentials.Credentials to mint an OAuth 2.0 token before initializing the Spanner client.


5. Egress to Cloud Run / Cloud Functions (OIDC JWT and Header Conflict Invariant)

When an agent invokes an internal MCP server hosted on Cloud Run through Agent Gateway, two authentication constraints apply:

  1. Authorization Header Interception by Cloud Run Ingress: Google Cloud Run's front-end proxy intercepts and validates the standard Authorization: Bearer <ID_TOKEN> header for Cloud Run IAM authentication (roles/run.invoker), stripping or rejecting it with HTTP 401/403 if an upstream user or application token is passed in that header.

    • Workaround A (X-Serverless-Authorization): Pass the Cloud Run IAM OIDC ID token in X-Serverless-Authorization: Bearer <IAM_ID_TOKEN> and keep upstream application/user credentials in Authorization (or vice versa).

    • Workaround B (Agent Identity Auth Manager): Configure Agent Identity Auth Manager to manage and inject Cloud Run invocation credentials over the wire at the Agent Gateway boundary.

  2. Service Account Impersonation for OIDC ID Tokens: Direct egress from Agent Identity (principalSet://...) cannot mint standard OIDC ID tokens directly; use Service Account Impersonation when minting an IAM OIDC token from ADK code:

import google.auth
from google.auth import impersonated_credentials
import google.auth.transport.requests

default_creds, project_id = google.auth.default()
target_sa = f"cloud-run-invoker@{project_id}.iam.gserviceaccount.com"
target_creds = impersonated_credentials.Credentials(
    source_credentials=default_creds,
    target_principal=target_sa,
    target_scopes=["https://www.googleapis.com/auth/iam"],
)
id_creds = impersonated_credentials.IDTokenCredentials(
    target_credentials=target_creds,
    target_audience="https://custom-tool-service-xyz.a.run.app",
    include_email=True,
)
id_creds.refresh(google.auth.transport.requests.Request())
headers = {"X-Serverless-Authorization": f"Bearer {id_creds.token}"}

6. Mutual TLS (mTLS) Client Certificate Management

When an Agent Gateway or runtime connects to upstream internal enterprise endpoints or partner APIs requiring mTLS:

  • Failure Symptom: Gateway proxy load-balancer logs show connection drops or HTTP 403 errors with jsonPayload.mtls.clientCertChainVerified: false.

  • Root Cause: The client certificate associated with the gateway's ClientTlsPolicy in Certificate Manager is expired, invalid, or signed by a CA untrusted by the target server.

  • Remediation:

    1. Inspect certificate validity and CA chain in Certificate Manager.

    2. Issue a renewed X.509 certificate and update the target ClientTlsPolicy resource.

    3. Ensure the destination server's trust store includes the root CA signing the gateway's client certificate.


7. Cross-Cloud and Hybrid Secure Web Proxy (SWP) mTLS Egress Hub

When routing outbound or cross-cloud agent traffic (across Cloud Interconnect or HA VPN to AWS, Azure, or on-premises endpoints) through a governed hub, enforce a two-stage egress pipeline rather than bypassing SWP:

  1. Stage 1 — Layer 7 URL Filtering via Next-Hop SWP (NEXT_HOP_ROUTING_MODE): Route outbound cross-cloud traffic from the Agent Gateway PSC-I subnet through Next-Hop Secure Web Proxy (via the priority 100 PBR rule in Section 2; do not bypass SWP with a DEFAULT_ROUTING PBR for cross-cloud endpoints) so SWP enforces Layer 7 hostname/URL allowlisting before traffic crosses the hybrid boundary.

  2. Stage 2 — Mutual TLS Origination via ClientTlsPolicy, Regional Internal Proxy ALB and Hybrid NEG: Forward approved traffic to a Regional INTERNAL_MANAGED Proxy Load Balancer VIP (10.40.2.x, outside the /26 PSC-I subnet), whose BackendService originates mutual TLS using a Certificate Manager ClientTlsPolicy (and BackendAuthenticationConfig) to the Zonal Hybrid Connectivity NEG (NON_GCP_PRIVATE_IP_PORT) across Cloud Interconnect or HA VPN:

Egress Hub ComponentResource / API TypeMandatory Configuration Contract
1. Subnets and Health-Check Firewallcompute.subnetworks + compute.firewallsProvision a PSC-I subnet (/26, purpose=PRIVATE), a dedicated VIP/SWP subnet (10.40.2.0/24 — place the Internal ALB VIP outside the /26 PSC-I range), an active Proxy-Only subnet (10.40.10.0/23, purpose=REGIONAL_MANAGED_PROXY, role=ACTIVE), and a firewall rule allowing health checks (35.191.0.0/16,130.211.0.0/22) and the proxy-only subnet.
2. Zonal Hybrid NEGcompute.networkEndpointGroups (zonal)Create with --network="${VPC_NAME}" --network-endpoint-type=non-gcp-private-ip-port --default-port=443 and attach remote cross-cloud endpoints via --add-endpoint="ip=${REMOTE_IP},port=${REMOTE_PORT}".
3. Private CA Trust Store and ACT DNS Peeringcertificatemanager.trustConfigs + dnsPeeringConfigPeer the cross-cloud Private Cloud DNS domain via the ACT's dnsPeeringConfig, and load the enterprise Private CA root PEM into TrustConfig with additionalRoots: PUBLICLY_TRUSTED_ROOTS on the ACT tlsConfig (never NO_ADDITIONAL_ROOTS in ALL_TRAFFIC mode, which strips Google API WebPKI roots).
4. Inbound mTLS Validationnetworksecurity.serverTlsPoliciesSet mtlsPolicy.clientValidationMode = "REJECT_INVALID" and mtlsPolicy.clientValidationTrustConfig = "projects/${PROJECT_NUMBER}/locations/${REGION}/trustConfigs/${TRUST_CONFIG}" (numeric ${PROJECT_NUMBER} required).
5. Outbound mTLS Originationnetworksecurity.clientTlsPolicies + backendAuthenticationConfigsConfigure a Certificate Manager ClientTlsPolicy (never embed client private keys in agent source code) and BackendAuthenticationConfig on the Next-Hop SWP -> Regional INTERNAL_MANAGED Proxy Load Balancer BackendService (--tls-settings) backed by the Hybrid NEG (NON_GCP_PRIVATE_IP_PORT).
# 1. Create Zonal Hybrid Connectivity NEG (NON_GCP_PRIVATE_IP_PORT) for Cross-Cloud / On-Premises Endpoint
gcloud compute network-endpoint-groups create "hybrid-mtls-neg" \
  --project="${PROJECT_ID}" --zone="${ZONE}" --network="${VPC_NAME}" \
  --network-endpoint-type="non-gcp-private-ip-port" --default-port=8443
gcloud compute network-endpoint-groups update "hybrid-mtls-neg" \
  --project="${PROJECT_ID}" --zone="${ZONE}" --add-endpoint="ip=${REMOTE_IP},port=8443"

# 2. Configure Certificate Manager ClientTlsPolicy & BackendAuthenticationConfig for Outbound mTLS Origination
cat <<EOF > client-tls-policy.yaml
name: projects/${PROJECT_ID}/locations/${REGION}/clientTlsPolicies/hybrid-mtls-client-policy
clientCertificate:
  certificateProviderInstance:
    pluginInstance: projects/${PROJECT_ID}/locations/${REGION}/certificates/${CLIENT_CERT_NAME}
EOF
gcloud network-security client-tls-policies import "hybrid-mtls-client-policy" \
  --project="${PROJECT_ID}" --location="${REGION}" --source="client-tls-policy.yaml"
gcloud network-security backend-authentication-configs create "hybrid-mtls-auth-config" \
  --project="${PROJECT_ID}" --location="${REGION}" \
  --client-certificate="projects/${PROJECT_ID}/locations/${REGION}/certificates/${CLIENT_CERT_NAME}" \
  --trust-config="projects/${PROJECT_ID}/locations/${REGION}/trustConfigs/${TRUST_CONFIG_NAME}" \
  --well-known-roots="none"
gcloud compute backend-services create "hybrid-mtls-backend" \
  --project="${PROJECT_ID}" --region="${REGION}" \
  --load-balancing-scheme="INTERNAL_MANAGED" --protocol="HTTPS" --health-checks="${HC_NAME}" \
  --tls-settings="sni=${REMOTE_FQDN},authenticationConfig=//networksecurity.googleapis.com/projects/${PROJECT_ID}/locations/${REGION}/backendAuthenticationConfigs/hybrid-mtls-auth-config"
gcloud compute backend-services add-backend "hybrid-mtls-backend" \
  --project="${PROJECT_ID}" --region="${REGION}" \
  --network-endpoint-group="hybrid-mtls-neg" --network-endpoint-group-zone="${ZONE}" \
  --balancing-mode="RATE" --max-rate-per-endpoint=100

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, Needs a command-line tool

Security

What our scanner noticed· Low risk

  • Instructions that use the network

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
Google
Publisher
Google (Official)
Source
google/skills · skills/cloud/agent-platform-architecture · commit 2194d3b
Licence
Apache License 2.0 (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by Google.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download agent-platform-architecture.zip