agent-platform-architecture

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Gemini platform Architecture and Engineering Guide

Gemini platform 架构与工程指南

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.
本 skill 是用于设计、工程化并验证企业级 Gemini platform 架构的参考体系,涵盖多项目层级结构、混合云/跨云网络、零信任身份边界,以及内联安全/策略执行平面。

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
).

必须阅读:在执行任何
gcloud
、REST API 或 MCP 命令之前,你必须阅读并遵循 使用说明与归属要求 中的指示。
[!IMPORTANT] 架构范围与参考规范:使用
SKILL.md
选择目标拓扑、出口模式、入口模式和治理平面,然后查阅权威的
references/*.md
手册,以获取准确的 CLI 命令、REST/YAML schema、Common Expression Language (CEL) 表达式和 Python Agent Development Kit (ADK) runtime 代码(
references/*.md
是所有实现语法的唯一事实来源)。当可以使用远程 Model Context Protocol (MCP) 工具(例如 Google Developer Knowledge MCP server 或 Google 托管的 MCP endpoint)时,应优先通过远程 MCP 工具调用,而不是使用原始 CLI/REST 命令。当请求仅为架构设计时,不要对客户项目执行未经请求的实时变更。
[!CAUTION] 敏感操作的人工审批门禁:在执行命令或应用配置之前,始终要求用户明确确认;这些操作包括授予权限过于宽松的 Identity and Access Management (IAM) binding(
roles/iap.egressor
、
roles/compute.networkUser
、
roles/networkservices.admin
)、修改 Organization Policies(
constraints/iam.managed.disableAccessPolicyBinding
)、更新 Unified Access Policy (UAP) 或 VPC Service Controls (VPC-SC) policy,或者删除资源(REST
DELETE ...?force=true
或 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:
      bash
      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).

  1. Google Cloud SDK、身份验证和项目设置:
    • 安装 Google Cloud SDK (
      gcloud
      )
      , 并对 CLI 和 Application Default Credentials 进行身份验证(
      gcloud auth login && gcloud auth application-default login
      ,或设置
      GOOGLE_APPLICATION_CREDENTIALS
      )。
    • 选择或创建目标项目(
      gcloud projects create {project_id}
      /
      gcloud config set project {project_id}
      ),设置 默认区域(
      gcloud config set compute/region {region}
      ,默认为
      us-central1
      ;参见 Google Cloud Locations),并启用所需 API:
      bash
      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. 结算、最小权限 IAM 和产品术语:
    • 验证所有项目均绑定了有效的结算账号(
      gcloud billing projects describe {project_id} --format="value(billingEnabled)"
      ),涵盖
      {host_project_id}
      、
      {gov_project_id}
      、
      {runtime_project_id}
      和
      {mcp_project_id}
      (即使在评估免费层额度时也必须执行;请参阅 Google Cloud Pricing)。
    • 授予明确的最小权限 IAM role(
      roles/aiplatform.user
      、
      roles/networkservices.admin
      、
      roles/compute.networkAdmin
      、
      roles/compute.networkUser
      、
      roles/iap.egressor
      ,或包含
      networkservices.agentGateways.get,networkservices.agentGateways.use,networkservices.operations.get
      的自定义 role),而不是粗粒度的
      roles/owner
      或
      roles/editor
      。
    • 使用批准的产品名称:Gemini platform、 Agent Runtime(
      reasoningEngines
      )、Agent Gateway (
      240.0.0.2:443
      )、Agent Connectivity Template (ACT)、 Agent Registry,以及 Unified Access Policy (UAP Policy V2) / Semantic Governance Policy (SGP)。

3-Phase Architect Workflow and Decision Tree

3 阶段架构工作流与决策树

mermaid
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
      ).

mermaid
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. 阶段 1 — 范围验证与架构发现:
    • 范围边界与单区域发现:拒绝处理与 Gemini platform 技术栈无关的常规 Google Cloud IAM/Compute/Storage 调试, 或拒绝运行广泛的多区域实时项目扫描循环,并改用
      gcloud ai reasoning-engines list --region={region}
      。
    • 架构设计与工程化:识别项目层级结构(
      Host
      、
      Governance Hub
      、
      Runtime Spoke
      、
      Tool/MCP Spoke
      )、 出口模式(
      ALL_TRAFFIC
      与
      PRIVATE_RANGES_ONLY
      )、策略平面 (UAP V2、SGP、Model Armor),以及目标输出格式(拓扑规范、
      gcloud
      CLI 命令或 REST/YAML manifest)。
  2. 阶段 2 — 架构草案与资源映射:
    • 使用 域路由与症状矩阵(Domain Router and Symptom Matrix) 综合生成拓扑图、项目/VPC 布局、IAM 引导矩阵和安全控制,并将每份手册中的标准 REST/YAML schema 和 CLI 命令映射到目标部署工件中。
  3. 阶段 3 — 部署后与审计日志验证:
    • 将每项架构设计与 部署后与 Cloud Audit Log 验证清单 (
      references/topologies_and_project_layouts.md
      )以及 runtime 查询验证 (
      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 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 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

references/
中的每份参考手册都是其领域 CLI 命令、REST/YAML schema、配额和 CEL 表达式的唯一事实来源。生成配置或回答领域特定问题之前,始终应阅读对应的参考手册:
架构领域涵盖的主题与架构决策路由至此的症状与故障模式标准参考手册
1. 项目层级结构、共享 VPC、VPC-SC 与自定义路由多项目隔离(
Host
、
Governance Hub
、
Runtime Spoke
、
Tool/MCP Spoke
)、PSC-I subnet sizing、跨项目 Service Agent IAM bootstrap、VPC-SC perimeter、非 RFC 1918 PUPI/对等自定义 route exchange,以及部署后 Cloud Audit Log 验证。
PSC-I IP 耗尽、跨项目 attachment 或
addressGroup
权限拒绝、VPC-SC perimeter 阻断、非 RFC 1918 内部路由被丢弃,或部署后验证问题。
references/topologies_and_project_layouts.md
2. Agent Connectivity Template (ACT) 与 Agent Gateway选择
ALL_TRAFFIC
与
PRIVATE_RANGES_ONLY
、ACT 和 Agent Gateway REST/YAML schema、控制平面 URI 格式、registry attachment 数量限制,以及容器自定义 Root CA bundle 信任。
控制平面 URI 验证错误、registry attachment 数量限制错误,或容器 TLS 验证失败(
[SSL: UNEXPECTED_EOF_WHILE_READING]
)。
references/agent_gateway_and_act.md
3. 出站路由、Next-Hop SWP、PBR 与 Hybrid mTLSPSC-I subnet 的 Source-range Policy-Based Routes (PBR)、Next-Hop Secure Web Proxy(
NEXT_HOP_ROUTING_MODE
)、
swg-autogen-nat
与手动 Cloud NAT 共存、gRPC/A2A/WebSocket 路由、Spanner SA impersonation,以及 Cross-Cloud mTLS Egress Hubs(Hybrid NEG)。
手动 Cloud NAT 与
swg-autogen-nat
之间的非对称返回路由导致丢包、PSC-I interface 上的出站 URL 过滤,或通过 Cloud Interconnect/VPN 发起跨云 mTLS。
references/egress_routing_and_swp.md
4. 入口 ALB、URL 重写、Private CA 与 3P IdP STS两层和单层 ALB ingress,URL Map 的
hostRewrite
/
pathPrefixRewrite
,面向 Cloud Run MCP server 的 Private CA
TrustConfig
与 Regional Internal ALB + Serverless NEG,以及通过
LbTrafficExtension
(
ext_proc
+ STS)实现 3P IdP(
EntraID
/
Ping
/
Okta
)token exchange。
WebPKI 根剥离(
NO_ADDITIONAL_ROOTS
)、Serverless NEG 上空的
:authority
被丢弃、
*.run.app
Google 托管证书不匹配,或 OAuth/IAP header 冲突。
references/ingress_patterns_and_rewrites.md
5. UAP Policy V2、IAP V1、SGP 与 Model Armor 治理Organization/Folder/Project UAP Policy V2 与 IAP V1 CEL authorization rule、Semantic Governance Policy(SGP
CONTENT_AUTHZ
)、自定义
AuthzExtension
/
AuthzPolicy
target,以及 fail-closed Model Armor Floor Settings、template 和 ADK callback。
MCP
initialize
或
tools/list
出现
Egress request is not authorized
(
HTTP 403
/
status.code=7
)、
AuthzExtension
出现
failed to parse the service URL
、二进制 gRPC parser 崩溃,或 fail-open 安全绕过。
references/governance_security_policies.md
6. Agent Registry、整合的
googleapis
与 Federation
将核心 Google APIs FQDN 整合到单一
googleapis
service(
ALL_TRAFFIC
)、注册 MCP/A2A/REST service、提取服务端生成的
registryResource
UUID 以绑定
roles/iap.egressor
,以及 Event-Driven Spoke-to-Hub Registry Federation。
ALL_TRAFFIC
agent 启动或遥测流量进入黑洞、Registry resource 上的 IAM binding target 不匹配、OpenAPI/MCP spec 大小被拒绝,或多项目 catalog 漂移。
references/registry_and_federation.md
7. ADK Runtime 打包、Agent Identity 与 Day-2 运维使用
AGENT_IDENTITY
(SPIFFE)和 Auth Manager 打包 ADK agent、区域驻留、BigQuery 执行前成本保护、原地 ACT 更新、反向依赖拆除,以及外部 Cloud NAT IP 验证。
原始凭据暴露、
HTTP 409 ABORTED
控制平面 mutex 锁、
HTTP 400 FAILED_PRECONDITION
(
FROM_AGENT_GATEWAY*
或
contains child resources: sessions
),或探测
*.run.app
时出现
X-Forwarded-For: 0.0.0.0
。
references/agent_runtime_and_identity.md

Supporting Public Documentation Links

补充公开文档链接