Agent Platform Architecture
GoogleOfficialPublished by Google
- Skill
- Tool integration
- Cloud and DevOps
- Apache-2.0
- Low risk
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
Download the skill as a ZIP:
https://autogineer.com/agent-skills/google/agent-platform-architecture/downloadUnzip 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.mdto select the target topology, egress mode, ingress pattern, and governance plane, then consult the authoritativereferences/*.mdmanual for exact CLI commands, REST/YAML schemas, Common Expression Language (CEL) expressions, and Python Agent Development Kit (ADK) runtime code (references/*.mdis 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 (RESTDELETE ...?force=trueor CLI--quiet).
Prerequisites, Authentication, Region, and Billing Setup
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 setGOOGLE_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 tous-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
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 withnetworkservices.agentGateways.get,networkservices.agentGateways.use,networkservices.operations.get) rather than primitiveroles/ownerorroles/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"]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_TRAFFICvsPRIVATE_RANGES_ONLY), policy plane (UAP V2, SGP, Model Armor), and target output format (topology specification,gcloudCLI commands, or REST/YAML manifests).
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.
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 Domain | Topics and Architectural Decisions Covered | Symptoms and Failure Modes Routed Here | Canonical Reference Manual |
|---|---|---|---|
| 1. Project Hierarchy, Shared VPC, VPC-SC, and Custom Routing | Multi-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 Gateway | Choosing 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 mTLS | Source-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 STS | Two-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 Governance | Organization/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 Federation | Consolidating 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 Operations | Packaging 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 |
Supporting Public Documentation Links
Files
- ATTRIBUTION.mdAdded by AutoGineer852 B
- LICENSELicence file added by AutoGineer11.1 KiB
- SKILL.md14.4 KiB
- references/agent_gateway_and_act.md14.7 KiB
- references/agent_runtime_and_identity.md27.8 KiB
- references/attribution.md1.9 KiB
- references/egress_routing_and_swp.md22.2 KiB
- references/governance_security_policies.md30.2 KiB
- references/ingress_patterns_and_rewrites.md25.5 KiB
- references/registry_and_federation.md19.6 KiB
- references/topologies_and_project_layouts.md31.6 KiB
references/ingress_patterns_and_rewrites.md
Ingress Architecture: Self-Managed Gateways, Rewrites, and Mesh
This reference details production patterns for ingress into Gemini platform workloads, including Two-Tier and Single-Tier Self-Managed Ingress Gateways, URL Map host/path rewrites, API management integration, and Agent2Agent protocol (A2A protocol) mesh networking.
Table of Contents
1. Self-Managed Ingress Gateway Architecture: Lines 22-88
2. Ingress Traffic Flow and URL Map Rewriting: Lines 89-201
3. Routing Strategy: Hostname vs Path-Prefix: Lines 202-220
4. Policy Enforcement Matrix: IAP and Model Armor: Lines 221-234
5. Workload Ingress and Apigee API Management: Lines 235-259
6. Private CA
TrustConfigand Internal Regional ALB for Cloud Run MCP: Lines 260-3357. Ingress ALB Service Extensions (
LbTrafficExtension/ Envoyext_proc): Lines 336-451
1. Self-Managed Ingress Gateway Architecture
Exposing internal Agent Runtime (reasoningEngines) workloads directly to
external clients without an ingress gateway creates inconsistent access control,
unmonitored endpoints, and prevents custom corporate domain branding.
A Self-Managed Ingress Gateway provides:
Custom enterprise hostnames (
https://agent-a.example.com) and edge TLS termination.Fine-grained Identity-Aware access control (IAP) and Context-Aware Access (CAA) policies.
Inline AI payload security (Model Armor prompt inspection and response sanitization).
Protocol, host, and path rewriting for Agent Runtime (
reasoningEngines) streaming and synchronous queries.
Two-Tier vs. Single-Tier Gateway Architecture
graph TB
subgraph Client Space
Client[Enterprise Users / Applications]
end
subgraph Tier 1: Public Front Door (Consumer Project)
ExtALB[Global External Application Load Balancer<br/>• Single Anycast IP<br/>• Client TLS / SNI Termination<br/>• Edge Cloud Armor / Coarse IAP<br/>• Hostname Routing]
PSC_NEG1[Regional PSC NEG<br/>global access mode]
ExtALB --> PSC_NEG1
end
subgraph Tier 2: Per-Agent Ingress (Producer / Governance Project)
SA[PSC Service Attachment]
IntALB[Regional Internal Application Load Balancer<br/>• Per-Agent IAP & CAA Enforcement<br/>• URL Map Host & Path Rewrite<br/>• Model Armor Service Extensions ext_proc]
PSC_NEG2[PSC NEG to Google APIs<br/>psc_target_service: REGION-aiplatform.googleapis.com]
PSC_NEG1 -->|Private Service Connect| SA
SA --> IntALB
IntALB --> PSC_NEG2
end
subgraph Google Managed Tenant
RE[Agent Runtime (reasoningEngines / ADK Agent)]
PSC_NEG2 -->|Private VPC Egress| RE
end
Client -->|HTTPS agent-a.example.com| ExtALBArchitectural Comparison Matrix (Single-Tier vs. Two-Tier Ingress)
Single-Tier Ingress Gateway (Single External ALB -> PSC NEG targeting regional AI Platform API directly): Gateway and all agents must reside in the same project and share a single IAP policy and URL map. Lowest cost and latency (~5–10 ms single hop), best for single-project deployments with unified policies.
Two-Tier Ingress Gateway (Recommended for Multi-Team — Tier 1 Global External Application Load Balancer with Cloud Armor and IAP fanning out over a Regional PSC NEG + PSC Service Attachment to Tier 2 Regional Internal Application Load Balancers): Tier 1 and Tier 2 run in separate projects; Tier 1 enforces global anycast TLS termination, edge Cloud Armor WAF/DDoS protection, and coarse-grained IAP, while producer teams own Tier 2 Regional Internal ALBs, per-agent IAP policies, Model Armor templates, and URL Map host/path rewrites independently (~15–25 ms across two hops).
2. Ingress Traffic Flow and URL Map Rewriting
Step-by-Step Two-Tier Request Flow
Tier 1 Global External ALB (TLS, Cloud Armor and IAP): Client resolves
agent-a.example.comto Tier 1's global anycast IP. The Tier 1 Global External Application Load Balancer terminates TLS using Server Name Indication (SNI) and enforces edge Cloud Armor security policies and IAP authentication.Tier 1 Host Routing: Tier 1 URL map matches
Host: agent-a.example.comand routes to the dedicated backend service.PSC Traversal (Regional PSC NEG -> Service Attachment): The Tier 1 backend service forwards traffic through its Regional PSC NEG (
globalaccess mode) to the Tier 2 PSC Service Attachment.Tier 2 Regional Internal ALB: The Service Attachment forwards the request to the Tier 2 Regional Internal Application Load Balancer forwarding rule in the producer/governance project.
Tier 2 Per-Agent IAP and Model Armor: Evaluates per-agent IAP/Context-Aware Access (device posture, IP location) and invokes Model Armor Service Extensions (
ext_proc).Tier 2 URL Map Rewriting: Updates headers and paths required by Agent Runtime:
Hostrewritten to${REGION}-aiplatform.googleapis.comPath prefix
/chatrewritten to/v1/projects/{AGENT_PROJECT_NUMBER}/locations/{REGION}/reasoningEngines/{RE_ID}:streamQuery
Model Armor Inspection (Service Extensions): Envoy
ext_procsends the prompt payload to Model Armor. Prompt injections or jailbreaks trigger immediateHTTP 403rejection.PSC to Google APIs: The rewritten request routes across Tier 2's Google APIs PSC NEG to the regional Agent Runtime (
aiplatform.googleapis.com) backend.Execution and Egress Sanitization: The Agent Runtime executes and streams responses. The return payload is sanitized by Model Armor (PII masking) before returning to the client.
Tier 2 URL Map (tier2-urlmap.yaml) and Provisioning Commands
# tier2-urlmap.yaml (use numeric ${AGENT_PROJECT_NUMBER} in pathPrefixRewrite)
name: tier2-re-urlmap
defaultService: projects/${PRODUCER_PROJECT_ID}/regions/${REGION}/backendServices/tier2-re-backend
hostRules:
- hosts:
- "agent-a.example.com"
pathMatcher: agent-matcher
pathMatchers:
- name: agent-matcher
defaultService: projects/${PRODUCER_PROJECT_ID}/regions/${REGION}/backendServices/tier2-re-backend
pathRules:
- paths:
- /chat
- /stream
service: projects/${PRODUCER_PROJECT_ID}/regions/${REGION}/backendServices/tier2-re-backend
routeAction:
urlRewrite:
hostRewrite: "${REGION}-aiplatform.googleapis.com"
pathPrefixRewrite: "/v1/projects/${AGENT_PROJECT_NUMBER}/locations/${REGION}/reasoningEngines/${RE_ID}:streamQuery"
- paths:
- /query
service: projects/${PRODUCER_PROJECT_ID}/regions/${REGION}/backendServices/tier2-re-backend
routeAction:
urlRewrite:
hostRewrite: "${REGION}-aiplatform.googleapis.com"
pathPrefixRewrite: "/v1/projects/${AGENT_PROJECT_NUMBER}/locations/${REGION}/reasoningEngines/${RE_ID}:query"# Tier 2 Producer Project (${PRODUCER_PROJECT_ID}): Proxy-Only Subnet, Google APIs PSC NEG, Internal ALB & PSC Service Attachment
gcloud compute networks subnets create "tier2-proxy-only-subnet" --project="${PRODUCER_PROJECT_ID}" \
--network="${PRODUCER_VPC}" --region="${REGION}" --range="10.129.0.0/23" --purpose="REGIONAL_MANAGED_PROXY" --role="ACTIVE"
gcloud compute networks subnets create "tier2-psc-nat-subnet" --project="${PRODUCER_PROJECT_ID}" \
--network="${PRODUCER_VPC}" --region="${REGION}" --range="10.129.2.0/24" --purpose="PRIVATE_SERVICE_CONNECT"
gcloud compute network-endpoint-groups create "psc-aiplatform-neg" --project="${PRODUCER_PROJECT_ID}" \
--region="${REGION}" --network-endpoint-type="private-service-connect" --psc-target-service="${REGION}-aiplatform.googleapis.com"
# Note: Add --iap=enabled ONLY if authenticating via Google IAP; omit --iap=enabled when Tier 1 ext_proc injects an STS OAuth access token for Agent Runtime
gcloud compute backend-services create "tier2-re-backend" --project="${PRODUCER_PROJECT_ID}" \
--region="${REGION}" --load-balancing-scheme="INTERNAL_MANAGED" --protocol="HTTPS"
gcloud compute backend-services add-backend "tier2-re-backend" --project="${PRODUCER_PROJECT_ID}" \
--region="${REGION}" --network-endpoint-group="psc-aiplatform-neg" --network-endpoint-group-region="${REGION}"
gcloud compute url-maps import "tier2-re-urlmap" --project="${PRODUCER_PROJECT_ID}" --region="${REGION}" --source="tier2-urlmap.yaml" --quiet
gcloud compute target-https-proxies create "tier2-re-https-proxy" --project="${PRODUCER_PROJECT_ID}" \
--region="${REGION}" --url-map="tier2-re-urlmap" --certificate-manager-certificates="${TIER2_CERT_NAME}"
gcloud compute forwarding-rules create "tier2-re-fwd-rule" --project="${PRODUCER_PROJECT_ID}" \
--region="${REGION}" --load-balancing-scheme="INTERNAL_MANAGED" --network="${PRODUCER_VPC}" \
--subnet="${PRODUCER_SUBNET}" --target-https-proxy="tier2-re-https-proxy" --target-https-proxy-region="${REGION}" --ports=443
gcloud compute service-attachments create "tier2-re-service-attachment" --project="${PRODUCER_PROJECT_ID}" \
--region="${REGION}" --producer-forwarding-rule="tier2-re-fwd-rule" --connection-preference="ACCEPT_AUTOMATIC" --nat-subnets="tier2-psc-nat-subnet"
# Tier 1 Consumer Front-Door Project (${FRONTDOOR_PROJECT_ID}): Global External ALB (with Edge Cloud Armor & IAP) -> PSC NEG -> Tier 2 Service Attachment
gcloud compute network-endpoint-groups create "tier1-to-tier2-psc-neg" --project="${FRONTDOOR_PROJECT_ID}" \
--region="${REGION}" --network-endpoint-type="private-service-connect" \
--psc-target-service="projects/${PRODUCER_PROJECT_ID}/regions/${REGION}/serviceAttachments/tier2-re-service-attachment" \
--network="${FRONTDOOR_VPC}" --subnet="${FRONTDOOR_SUBNET}"
gcloud compute backend-services create "tier1-ext-backend" --project="${FRONTDOOR_PROJECT_ID}" \
--global --load-balancing-scheme="EXTERNAL_MANAGED" --protocol="HTTPS" \
--security-policy="${CLOUD_ARMOR_POLICY}" \
--iap=enabled,oauth2-client-id="${IAP_CLIENT_ID}",oauth2-client-secret="${IAP_CLIENT_SECRET}"
gcloud compute backend-services add-backend "tier1-ext-backend" --project="${FRONTDOOR_PROJECT_ID}" \
--global --network-endpoint-group="tier1-to-tier2-psc-neg" --network-endpoint-group-region="${REGION}"
gcloud compute url-maps create "tier1-ext-urlmap" --project="${FRONTDOOR_PROJECT_ID}" --default-service="tier1-ext-backend"
gcloud compute target-https-proxies create "tier1-ext-https-proxy" --project="${FRONTDOOR_PROJECT_ID}" \
--url-map="tier1-ext-urlmap" --ssl-certificates="${TIER1_SSL_CERT}"
gcloud compute forwarding-rules create "tier1-ext-fwd-rule" --project="${FRONTDOOR_PROJECT_ID}" \
--global --load-balancing-scheme="EXTERNAL_MANAGED" --target-https-proxy="tier1-ext-https-proxy" --ports=443
# Grant Edge & Backend IAM (Workforce Pool / Service Account roles/aiplatform.user; add roles/iap.httpsResourceAccessor if using IAP)
gcloud projects add-iam-policy-binding "${PRODUCER_PROJECT_ID}" \
--member="principalSet://iam.googleapis.com/locations/global/workforcePools/${WORKFORCE_POOL_ID}/*" --role="roles/aiplatform.user"
gcloud projects add-iam-policy-binding "${PRODUCER_PROJECT_ID}" --member="${EXT_PROC_IDENTITY}" --role="roles/aiplatform.user"3. Routing Strategy: Hostname vs Path-Prefix
Hostname Routing (Recommended):
Each agent has a unique FQDN:
finance-agent.example.com,hr-agent.example.com.Advantages: Complete domain isolation, clean mapping to DNS and TLS SAN certificates, straightforward per-agent IAP binding.
Path-Prefix Routing:
Single domain
agents.example.comwith routes/finance/*and/hr/*.Operational Footgun: Tier 1 must strip the path prefix (such as rewriting
/finance/chatto/chat) and either rewrite theHostheader to the Tier 2 per-agent hostname (agent-a.example.com) or include"agents.example.com"in Tier 2'shost_rule.hosts; otherwise, Tier 2 misses theagent-matcherhost rule or receives nested paths that conflict with the destination Agent Runtime:streamQuerypath rewrite.
4. Policy Enforcement Matrix: IAP and Model Armor
Transport Security (
TLS 1.3 / mTLSat Tier 1 and Tier 2): Terminates public HTTPS at the edge and enforces private mTLS across PSC.Identity and Access (
Identity-Aware Proxy (IAP)at Tier 1 or Tier 2): Validates workforce principal, Context-Aware Access (CAA) device context, and IAMroles/iap.httpsResourceAccessor. Deploying at Tier 2 allows independent per-agent policies.AI Payload Inspection (
Model Armor via Service Extensionsat Tier 2 Internal ALB): Real-timeext_procgRPC callout inspecting prompts for jailbreaks/injections and sanitizing responses for PII/DLP leaks.
5. Workload Ingress and Apigee API Management
Workload Ingress (mTLS and SPIFFE Trust Federation)
For machine-to-agent ingress across clouds, terminate transport-level mTLS at
the Ingress ALB using Certificate Manager with Private CA trust configs, and map
external machine OIDC tokens or SPIFFE X.509 SVIDs into Google Cloud principals
using Workload Identity Federation (WorkloadIdentityPool), while using
Workforce Identity Federation (WorkforcePool) for human workforce users
(EntraID, Okta, Ping).
Apigee X API Management Inline Integration (Northbound and Southbound Private)
Northbound Ingress Governance: Place Apigee X in front of the Ingress Gateway to validate external consumer JWTs, enforce spike arrest/quotas, and route over Southbound PSC into the Tier 2 Regional Internal ALB.
Southbound Tool and MCP Mediation (
Agent Gateway -> Apigee X Private -> Cloud Run / Google MCP / Internal APIs): Egress Agent Gateway enforces UAP CEL and Model Armor first, then routes over the PSC-I network attachment into an Apigee X Private Endpoint (PSC Endpoint Attachmentinside the Governance or Tool Spoke VPC) for protocol mediation, API key / 3LO token injection, and rate limiting.
6. Private CA TrustConfig and Internal Regional ALB for Cloud Run MCP
When an enterprise requires custom Private CA leaf certificates
(*.internal.example.com) rather than standard Google-managed certificates on
internal Cloud Run MCP servers:
Why a Regional Internal ALB Is Required: Native Cloud Run (
*.run.app) terminates TLS at the Cloud Run ingress edge using Google-managed certificates. To serve a custom Private CA certificate, front the Cloud Run service with anINTERNAL_MANAGEDRegional Internal Application Load Balancer backed by aSERVERLESSNetwork Endpoint Group and a Private Cloud DNS zone peered via the ACT'sdnsPeeringConfig(using a Certificate Manager self-managed certificate or Private CA certificate issuance config).Preserving Public Root Trust (
PUBLICLY_TRUSTED_ROOTS): When attaching a Certificate ManagerTrustConfigto an Agent Connectivity Template'stlsConfig, always setadditionalRoots = "PUBLICLY_TRUSTED_ROOTS". SettingNO_ADDITIONAL_ROOTSinALL_TRAFFICmode strips the WebPKI root bundle and breaks outbound TLS handshakes to Google APIs (aiplatform.googleapis.com).Handling Empty
:authorityon Serverless NEGs (defaultService, Wildcard"*"Host Rule and Mandatory IAP/mTLS): When anINTERNAL_MANAGEDRegional Internal ALB fronts a Cloud Run Serverless NEG, configure the URL MapdefaultServiceand include the wildcard"*"alongside"{mcp_internal_fqdn}"inhostRules[].hosts(--hosts="${MCP_INTERNAL_FQDN},*", since Compute EngineHostRuleschema regex only accepts RFC-1034 hostnames or"*"). BecausedefaultServiceand"*"match requests with empty:authority/Hostheaders, always enforce transport and IAM authentication (--iap=enabledwithroles/iap.egressorand/orServerTlsPolicymTLS) on the Internal ALB so omittingHostnever bypasses access control:
export PROJECT_ID="gov-hub-proj" MCP_PROJECT_ID="mcp-spoke-proj" REGION="us-central1"
export TRUST_CONFIG_ID="enterprise-private-ca-trust" MCP_SERVICE_NAME="mcp-server-prod"
export MCP_VPC="mcp-spoke-vpc" MCP_SUBNET="mcp-ilb-subnet" MCP_ILB_IP="10.20.10.10"
export MCP_INTERNAL_FQDN="mcp.internal.example.com" MCP_INTERNAL_CERT="mcp-internal-private-cert"
# 1. Import Certificate Manager TrustConfig in ${REGION} (reference in ACT tlsConfig with additionalRoots: PUBLICLY_TRUSTED_ROOTS so WebPKI roots for aiplatform.googleapis.com are preserved)
cat <<EOF > trust-config.yaml
trustStores:
- trustAnchors:
- pemCertificate: |
-----BEGIN CERTIFICATE-----
...Enterprise Private Root CA PEM...
-----END CERTIFICATE-----
EOF
gcloud certificate-manager trust-configs import "${TRUST_CONFIG_ID}" \
--project="${PROJECT_ID}" --location="${REGION}" --source="trust-config.yaml"
# 2. Because native Cloud Run (*.run.app) uses Google-managed certificates, front Cloud Run with a Serverless NEG and Regional INTERNAL_MANAGED ALB (with IAP enabled; --protocol="HTTP" is required by GCE for Serverless NEGs)
gcloud compute network-endpoint-groups create "mcp-serverless-neg" \
--project="${MCP_PROJECT_ID}" --region="${REGION}" \
--network-endpoint-type="serverless" --cloud-run-service="${MCP_SERVICE_NAME}"
gcloud compute backend-services create "mcp-internal-backend" \
--project="${MCP_PROJECT_ID}" --region="${REGION}" \
--load-balancing-scheme="INTERNAL_MANAGED" --protocol="HTTP" \
--iap=enabled,oauth2-client-id="${IAP_CLIENT_ID}",oauth2-client-secret="${IAP_CLIENT_SECRET}"
gcloud compute backend-services add-backend "mcp-internal-backend" \
--project="${MCP_PROJECT_ID}" --region="${REGION}" \
--network-endpoint-group="mcp-serverless-neg" --network-endpoint-group-region="${REGION}"
# Configure defaultService + wildcard "*" hostRule alongside ${MCP_INTERNAL_FQDN} (requires IAP and/or ServerTlsPolicy mTLS)
gcloud compute url-maps create "mcp-internal-urlmap" \
--project="${MCP_PROJECT_ID}" --region="${REGION}" --default-service="mcp-internal-backend"
gcloud compute url-maps add-path-matcher "mcp-internal-urlmap" \
--project="${MCP_PROJECT_ID}" --region="${REGION}" --path-matcher-name="mcp-matcher" \
--default-service="mcp-internal-backend" --new-hosts="${MCP_INTERNAL_FQDN},*"
gcloud compute target-https-proxies create "mcp-internal-https-proxy" \
--project="${MCP_PROJECT_ID}" --region="${REGION}" --url-map="mcp-internal-urlmap" \
--certificate-manager-certificates="${MCP_INTERNAL_CERT}"
gcloud compute forwarding-rules create "mcp-internal-fwd-rule" \
--project="${MCP_PROJECT_ID}" --region="${REGION}" --load-balancing-scheme="INTERNAL_MANAGED" \
--network="${MCP_VPC}" --subnet="${MCP_SUBNET}" --address="${MCP_ILB_IP}" \
--target-https-proxy="mcp-internal-https-proxy" --target-https-proxy-region="${REGION}" --ports=4437. Ingress ALB Service Extensions (LbTrafficExtension / Envoy ext_proc)
When an Application Load Balancer (ALB) requires custom header mutation,
external token exchange (sts.googleapis.com/v1/token), or custom request
authentication before forwarding to a Google Cloud backend
(aiplatform.googleapis.com or Cloud Run), attach a Service Extensions
LbTrafficExtension (ext_proc gRPC callout).
7.1 GA LbTrafficExtension YAML Schema and gcloud service-extensions lb-traffic-extensions import
[!IMPORTANT] Location Scope and HTTP/2 Callout Backend:
gcloud service-extensions lb-traffic-extensionsusesimport <name> --location=<location> --source=<file.yaml>. For a Global External Application Load Balancer (EXTERNAL_MANAGEDwith global forwarding rules), use--location="global"and referenceglobal/forwardingRules/...andglobal/backendServices/...(configured with--protocol=HTTP2); for a Regional Internal Application Load Balancer (INTERNAL_MANAGED), use--location="${REGION}"andregions/${REGION}/....
# lb-traffic-extension.yaml (Global External ALB: --location=global; use regions/${REGION}/... for Regional Internal ALB)
name: ext-proc-token-exchange
loadBalancingScheme: EXTERNAL_MANAGED
forwardingRules:
- https://www.googleapis.com/compute/v1/projects/${PROJECT_ID}/global/forwardingRules/${FORWARDING_RULE_NAME}
extensionChains:
- name: token-exchange-chain
matchCondition:
celExpression: 'true'
extensions:
- name: ext-proc-auth-swap
authority: ext-proc.internal.example.com
service: https://www.googleapis.com/compute/v1/projects/${PROJECT_ID}/global/backendServices/${EXT_PROC_BACKEND_SERVICE}
supportedEvents:
- REQUEST_HEADERS
timeout: 1.0s
failOpen: falsegcloud compute backend-services create "${EXT_PROC_BACKEND_SERVICE}" --project="${PROJECT_ID}" \
--global --load-balancing-scheme="EXTERNAL_MANAGED" --protocol="HTTP2" --health-checks="${EXT_PROC_HC}"
gcloud service-extensions lb-traffic-extensions import ext-proc-token-exchange \
--location="global" \
--source="lb-traffic-extension.yaml" \
--project="${PROJECT_ID}"7.2 Envoy ext_proc Credential Caching, STS Federation and Fail-Closed Header Mutation
When implementing a Python ExternalProcessorServicer:
Fail Closed on Missing or Malformed Bearer Tokens: Return an immediate
HTTP 401ImmediateResponse(StatusCode.Unauthorized) wheneverAuthorization: Bearer <token>is absent or empty.Thread-Safe Credential Caching and Connection Pooling: Reuse a persistent
httpx.Client(timeout=0.4)and cache federated STS tokens fromhttps://sts.googleapis.com/v1/token(expiry - 60s, keyed by SHA-256 token digest) so callouts stay well within Envoy'stimeout: 1.0s. For OIDC Workforce Identity Federation (Okta,EntraID,Ping), pass"subject_token_type": "urn:ietf:params:oauth:token-type:id_token"(or"urn:ietf:params:oauth:token-type:jwt"for generic workload JWTs).Preserving Upstream Caller Context: Replace
Authorizationwith the Google Cloud STS access token for edge IAM (roles/aiplatform.userorroles/run.invoker) and copy the caller's original token intoX-Forwarded-User-AuthorizationusingHeaderValue(key=..., raw_value=...)withOVERWRITE_IF_EXISTS_OR_ADD. Pair this inbound exchange with Agent Identity Auth Manager (AuthProvider) for outbound2LO/3LOtool calls (references/agent_runtime_and_identity.mdSection 6.2):
import hashlib, json, threading, time, urllib.parse, httpx
from envoy.config.core.v3 import base_pb2
from envoy.service.ext_proc.v3 import external_processor_pb2 as ep_pb2
_STS_CLIENT = httpx.Client(timeout=0.4)
_STS_LOCK = threading.Lock()
_STS_CACHE: dict[str, tuple[str, float]] = {}
def exchange_workforce_token_via_sts(idp_jwt: str, workforce_pool_provider: str, user_project: str = "") -> str:
digest = hashlib.sha256(f"{workforce_pool_provider}:{idp_jwt}".encode("utf-8")).hexdigest()
now = time.time()
if (cached := _STS_CACHE.get(digest)) and now < cached[1] - 60:
return cached[0]
provider_path = workforce_pool_provider.strip().removeprefix("//iam.googleapis.com/").lstrip("/")
payload = {
"grant_type": "urn:ietf:params:oauth:grant-type:token-exchange",
"audience": f"//iam.googleapis.com/{provider_path}",
"scope": "https://www.googleapis.com/auth/cloud-platform",
"requested_token_type": "urn:ietf:params:oauth:token-type:access_token",
"subject_token_type": "urn:ietf:params:oauth:token-type:id_token",
"subject_token": idp_jwt,
}
if user_project:
payload["options"] = json.dumps({"userProject": user_project})
resp = _STS_CLIENT.post("https://sts.googleapis.com/v1/token", content=urllib.parse.urlencode(payload), headers={"Content-Type": "application/x-www-form-urlencoded"})
resp.raise_for_status()
body = resp.json()
with _STS_LOCK:
_STS_CACHE[digest] = (str(body["access_token"]), now + float(body.get("expires_in", 3600)))
return str(body["access_token"])
def build_ext_proc_header_mutation(original_auth: str, gcp_token: str) -> ep_pb2.HeaderMutation:
return ep_pb2.HeaderMutation(
set_headers=[
base_pb2.HeaderValueOption(
header=base_pb2.HeaderValue(key="X-Forwarded-User-Authorization", raw_value=original_auth.encode("utf-8")),
append_action=base_pb2.HeaderValueOption.OVERWRITE_IF_EXISTS_OR_ADD,
),
base_pb2.HeaderValueOption(
header=base_pb2.HeaderValue(key="Authorization", raw_value=f"Bearer {gcp_token}".encode("utf-8")),
append_action=base_pb2.HeaderValueOption.OVERWRITE_IF_EXISTS_OR_ADD,
),
]
)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
- 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 or Google.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download agent-platform-architecture.zip