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://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/agent_runtime_and_identity.md

ADK Agent Runtime Packaging, Identity Token Exchange, Observability and Day-2 Operations

This reference details configuring Python Agent Development Kit (ADK) agents for Agent Runtime in Gemini platform (reasoningEngines), configuring Agent Identity (AGENT_IDENTITY), Third-Party IdP Token Exchange (ext_proc + STS), Data Residency, Distributed W3C Trace Correlation and BigQuery Cost Governance, and Day-2 Lifecycle Operations.


Table of Contents

  • 1. End-to-End ADK Packaging and Runtime Architecture Overview: Lines 27-44

  • 2. Python Packaging and Artifact Preparation: Lines 45-120

  • 3. Conflict Teardown and Active Session Deletion (?force=true): Lines 121-137

  • 4. CreateReasoningEngine REST and Python SDK Specification: Lines 138-224

  • 5. End-to-End Validation Queries: Lines 225-242

  • 6. Third-Party IdP Token Exchange (ext_proc / STS) and Agent Identity Auth Manager: Lines 243-300

  • 7. Data Residency, Regional Endpoints, Sovereign Cloud and Global Anycast Failover: Lines 301-355

  • 8. Day-2 Operations: Updating Agent Connectivity Templates In-Place and Control-Plane Mutex Locks: Lines 356-388

  • 9. Avoiding Dangling Reference Locks on ACT Deletion (FROM_AGENT_GATEWAY*): Lines 389-405

  • 10. Teardown and Clean Recreation Lifecycle: Lines 406-454

  • 11. Egress NAT Reflection and Cloud Run Ingress Routing Behavior: Lines 455-478


1. End-to-End ADK Packaging and Runtime Architecture Overview

+-----------------------------------------------------------------------------------------+
| GCS Artifact Contract: gs://${PROJECT_ID}-${REGION}/agent_artifacts/                    |
|   • agent_engine.pkl (cloudpickle protocol=4) | dependencies.tar.gz | requirements.txt  |
+--------------------------------------------+--------------------------------------------+
                                             | (REST CreateReasoningEngine / ADK SDK)
                                             v
+-----------------------------------------------------------------------------------------+
| Agent Runtime Container (reasoningEngines)                                              |
|   • identityType: AGENT_IDENTITY (SPIFFE PrincipalSet / Principal X.509 SVID)           |
|   • agentGateway: projects/${PROJECT_NUMBER}/locations/${REGION}/agentGateways/${ID}    |
+--------------------------------------------+--------------------------------------------+

2. Python Packaging and Artifact Preparation

2.1 Model Version and Regional Availability Configuration

Always verify the target model's supported regions in official documentation (https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/gemini/{model_version}.md.txt):

  • Global Endpoint Models (such as gemini-2.5-pro via global):

    • When targeting the global, us, or eu endpoint rather than a standalone regional endpoint, instantiate Gemini(model="gemini-2.5-pro", client_kwargs={"location": "global", "http_options": {"api_transport": "rest"}}) and set GOOGLE_CLOUD_LOCATION="global", VERTEXAI_LOCATION="global", and GOOGLE_GENAI_API_TRANSPORT="rest" in deploymentSpec.env (using REST transport guarantees :generateContent / :streamGenerateContent calls emit application/json so inline SGP and Model Armor CONTENT_AUTHZ extensions inspect 100% of LLM payloads).

    • Ensure aiplatform.googleapis.com, aiplatform.mtls.googleapis.com, us-aiplatform.googleapis.com, us-aiplatform.mtls.googleapis.com, and aiplatform.us.rep.googleapis.com are registered in the googleapis Agent Registry service with protocol_binding = "HTTP_JSON".

  • Regional Models (such as gemini-2.5-flash in us-central1):

    • Set location="us-central1" in client_kwargs and deploymentSpec.env, and include us-central1-aiplatform.googleapis.com, us-central1-aiplatform.mtls.googleapis.com, and aiplatform.us-central1.rep.googleapis.com in googleapis when the runtime is hosted in another region.

2.2 GCS Package Artifact Contract and Staging Bucket Integrity Hardening

The Agent Runtime reconstructs the agent from three Cloud Storage objects (packageSpec):

  1. pickleObjectGcsUri (agent_engine.pkl): Serialized with cloudpickle.dump(agent_instance, f, protocol=4) (protocol 4 guarantees compatibility with the container's Python 3.11 runtime).

  2. dependencyFilesGcsUri (dependencies.tar.gz): Gzipped tarball containing local Python source modules.

  3. requirementsGcsUri (requirements.txt): Pinned runtime dependencies (google-adk>=1.17.0,<2.0.0, google-cloud-aiplatform[agent_engines,adk]>=1.90.0,<2.0.0, cloudpickle>=3.0.0,<4.0.0, httpx>=0.27.0,<1.0.0, opentelemetry-api==1.37.0, opentelemetry-sdk==1.37.0, opentelemetry-exporter-gcp-trace==1.11.0).

  4. Staging Bucket Integrity and Service Agent Read Access (cloudpickle Supply-Chain Guard): Because cloudpickle deserialization executes code at container startup, configure the staging bucket with uniform_bucket_level_access = true, public_access_prevention = "enforced", and versioning { enabled = true }, restrict roles/storage.objectAdmin strictly to the CI/CD build service account, verify object crc32c / md5Hash checksums on upload, and grant read-only roles/storage.objectViewer on gs://${PROJECT_ID}-${REGION} to both service-${PROJECT_NUMBER}@gcp-sa-aiplatform.iam.gserviceaccount.com and service-${PROJECT_NUMBER}@gcp-sa-aiplatform-re.iam.gserviceaccount.com.

2.3 Multi-Agent ADK Orchestration, Deterministic Pre-Model Callbacks and Grounded Retrieval

When designing regulated multi-agent systems (such as supervisor-to-specialist topologies with domain triage, grounded vector/SQL retrieval, and policy review):

  1. Deterministic Pre-Model Short-Circuiting (before_model_callback): Never rely solely on probabilistic LLM prompts for mandatory safety escalations or encoded prompt-injection filtering. Attach a deterministic before_model_callback on the root LlmAgent that runs the 3-step pre-sanitization normalization pipeline (references/governance_security_policies.md Section 9.4) and evaluates deterministic escalation rules (returning an immediate LlmResponse short-circuit before invoking Gemini or specialist sub-agents when a high-risk condition is triggered).

  2. Supervisor and Specialist Sub-Agent Hierarchy: Compose specialist LlmAgent instances (sub_agents=[retrieval_specialist, compliance_specialist]) under the root orchestrator LlmAgent, scoping MCP toolsets per specialist so only the retrieval specialist holds read-only MCP/database tools and every synthesized response includes verifiable source citations (source_id, document_uri) from the retrieved corpus.


3. Conflict Teardown and Active Session Deletion (?force=true)

A consumer project's regional Agent Runtime tenant project (*-tp) can only bond to one Agent Gateway per region (multiple ReasoningEngine instances in the same project/region can share that gateway, or use separate spoke projects if distinct gateways are required).

[!IMPORTANT] Active Session Deletion Invariant (?force=true): Calling DELETE on an Agent Runtime instance that has existing conversations or child sessions fails with HTTP 400 FAILED_PRECONDITION: The ReasoningEngine ... contains child resources: sessions. Always append ?force=true (DELETE https://${REGION}-aiplatform.googleapis.com/v1/${RE_NAME}?force=true) and poll the resulting LRO until done: true (see Section 10 for the complete CLI teardown script).


4. CreateReasoningEngine REST and Python SDK Specification

4.1 REST Specification (reasoningEngines)
{
  "displayName": "adk-enterprise-agent",
  "description": "ADK Agent with governed egress via Agent Gateway and AGENT_IDENTITY",
  "spec": {
    "identityType": "AGENT_IDENTITY",
    "agentFramework": "google-adk",
    "classMethods": [
      {"name": "async_create_session", "apiMode": "async", "parameters": {"type": "object", "properties": {"user_id": {"type": "string"}}}},
      {"name": "query", "apiMode": "", "parameters": {"type": "object", "properties": {"message": {"type": "string"}}}},
      {"name": "stream_query", "apiMode": "stream", "parameters": {"type": "object", "properties": {"message": {"type": "string"}, "user_id": {"type": "string"}, "session_id": {"type": "string"}}}}
    ],
    "packageSpec": {
      "pickleObjectGcsUri": "gs://${PROJECT_ID}-${REGION}/agent_artifacts/agent_engine.pkl",
      "dependencyFilesGcsUri": "gs://${PROJECT_ID}-${REGION}/agent_artifacts/dependencies.tar.gz",
      "requirementsGcsUri": "gs://${PROJECT_ID}-${REGION}/agent_artifacts/requirements.txt",
      "pythonVersion": "3.11"
    },
    "deploymentSpec": {
      "env": [
        {"name": "GOOGLE_CLOUD_AGENT_ENGINE_ENABLE_TELEMETRY", "value": "true"},
        {"name": "GOOGLE_CLOUD_LOCATION", "value": "global"},
        {"name": "VERTEXAI_LOCATION", "value": "global"},
        {"name": "GOOGLE_GENAI_USE_ENTERPRISE", "value": "1"},
        {"name": "GOOGLE_GENAI_API_TRANSPORT", "value": "rest"},
        {"name": "OTEL_SERVICE_NAME", "value": "adk-enterprise-agent"},
        {"name": "ADK_CAPTURE_MESSAGE_CONTENT_IN_SPANS", "value": "false"},
        {"name": "GOOGLE_API_PREVENT_AGENT_TOKEN_SHARING_FOR_GCP_SERVICES", "value": "False"}
      ],
      "agentGatewayConfig": {
        "agentToAnywhereConfig": {
          "agentGateway": "projects/${PROJECT_NUMBER}/locations/${REGION}/agentGateways/${GATEWAY_ID}"
        }
      }
    }
  }
}

Submit via POST https://${REGION}-aiplatform.googleapis.com/v1/projects/${PROJECT_NUMBER}/locations/${REGION}/reasoningEngines and poll the returned operation URL until .done == true.

4.2 Python SDK Deployment (client.agent_engines.create)

When binding a Runtime Spoke ReasoningEngine to a Governance Hub AgentGateway, both resources must reside in the exact same region and use numeric uint64 project numbers (AGW_PROJECT_NUMBER); grant (networkservices.agentGateways.get, networkservices.agentGateways.use, networkservices.operations.get) (or roles/networkservices.admin) to the deployer and gcp-sa-aiplatform, and roles/compute.networkUser on act-${TEMPLATE_ID} to gcp-sa-aiplatform-re (see references/topologies_and_project_layouts.md Section 3.1):

remote_agent = client.agent_engines.create(
    agent=local_agent,
    config={
        "agent_gateway_config": {
            "agent_to_anywhere_config": {
                "agent_gateway": f"projects/{AGW_PROJECT_NUMBER}/locations/{REGION}/agentGateways/{GATEWAY_ID}"
            },
        },
        "identity_type": "AGENT_IDENTITY",
        "env_vars": {
            "GOOGLE_API_PREVENT_AGENT_TOKEN_SHARING_FOR_GCP_SERVICES": "False",
        },
    },
)

[!CAUTION] Token-Sharing Boundary (GOOGLE_API_PREVENT_AGENT_TOKEN_SHARING_FOR_GCP_SERVICES="False"): Setting GOOGLE_API_PREVENT_AGENT_TOKEN_SHARING_FOR_GCP_SERVICES="False" is required so the Agent Runtime container can present its platform token across a cross-project Agent Gateway (AGW_PROJECT_ID) to registered Google APIs (googleapis). Never pass raw Google Cloud platform access tokens to external 3P or untrusted MCP servers; enforce UAP Policy V2 host/resource scoping and use Agent Identity Auth Manager (AuthProvider) or X-Serverless-Authorization scoped OIDC ID tokens (references/egress_routing_and_swp.md Section 5) for downstream MCP tool authentication.


5. End-to-End Validation Queries

# 5.1 Session Creation (:query with async_create_session)
curl -s -X POST "https://${REGION}-aiplatform.googleapis.com/v1/${RE_NAME}:query" \
  -H "Authorization: Bearer $(gcloud auth print-access-token)" \
  -H "Content-Type: application/json" \
  -d '{"classMethod": "async_create_session", "input": {"user_id": "test-user"}}' | jq .

# 5.2 Streaming Query Execution (:streamQuery NDJSON)
curl -N -X POST "https://${REGION}-aiplatform.googleapis.com/v1/${RE_NAME}:streamQuery" \
  -H "Authorization: Bearer $(gcloud auth print-access-token)" \
  -H "Content-Type: application/json" \
  -d '{"input": {"message": "Verify governed tool connectivity", "user_id": "test-user"}}'

6. Third-Party IdP Token Exchange (ext_proc / STS) and Agent Identity Auth Manager

6.1 External IdP (EntraID, Ping, Okta) to Google Cloud Token Swap (ext_proc)
  1. Workforce Identity Federation and Security Token Service (STS): Configure a Workforce Identity Pool and Provider (WorkforcePool, WorkforcePoolProvider) mapped to the corporate EntraID/Okta/Ping OIDC issuer and JWKS URI.

  2. Envoy ext_proc Service Extension Callout: Attach a Service Extension (LbTrafficExtension) on the ingress ALB that intercepts Authorization: Bearer <IdP_JWT>, calls https://sts.googleapis.com/v1/token (urn:ietf:params:oauth:grant-type:token-exchange), and swaps the corporate token for a short-lived Google Cloud STS token (see references/ingress_patterns_and_rewrites.md Section 7 for the complete LbTrafficExtension YAML and Python ext_proc implementation).

  3. Multi-Agent 3LO Token Propagation: Propagate end-user 3-legged OAuth (3LO) context across Agent2Agent (A2A) calls via Agent Identity Auth Manager rather than falling back to ambient service account privileges.

6.2 Agent Identity Auth Manager and X.509 SPIFFE Attestation
  1. Enable Auth Manager APIs and Add to VPC-SC Perimeter restricted_services: Run gcloud services enable aiplatform.googleapis.com agentidentity.googleapis.com agentidentitycredentials.googleapis.com and explicitly add both agentidentity.googleapis.com and agentidentitycredentials.googleapis.com to the VPC-SC perimeter restricted_services list so outbound credential brokering is governed by the perimeter.

  2. Configure AuthProvider: Create a managed AuthProvider (2LO client credentials, 3LO user consent flow, or vaulted API key) in Auth Manager (scoping workloadIds and IAM access strictly to the agent's principal:// URI; never hardcode OAuth client secrets or static API keys in Python code or container environment variables) and reference it in the Agent Registry AuthProviderBinding or ADK MCP tool specification so Agent Gateway injects outbound Authorization headers over the wire:

export PROJECT_ID="gov-hub-proj" PROJECT_NUMBER="111111111111" REGION="us-central1"
export ORG_ID="999999999999" ENGINE_ID="5555555555555555555" AUTH_PROVIDER_ID="downstream-api-oauth"
AGENT_PRINCIPAL="principal://agents.global.org-${ORG_ID}.system.id.goog/resources/aiplatform/projects/${PROJECT_NUMBER}/locations/${REGION}/reasoningEngines/${ENGINE_ID}"

curl -s -X POST "https://agentidentity.googleapis.com/v1/projects/${PROJECT_ID}/locations/${REGION}/authProviders?authProviderId=${AUTH_PROVIDER_ID}" \
  -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "Content-Type: application/json" \
  -d "{\"description\":\"Managed outbound OAuth provider for agent tool calls\",\"authProviderTypeParams\":{\"twoLeggedOauth\":{\"clientId\":\"${OAUTH_CLIENT_ID}\",\"clientSecret\":\"${OAUTH_CLIENT_SECRET}\",\"tokenUrl\":\"https://idp.example.com/oauth2/v2.0/token\"}},\"allowedScopes\":[\"https://api.internal.example.com/.default\"],\"workloadIds\":[\"${AGENT_PRINCIPAL}\"]}"
  1. SPIFFE X.509 URI vs. IAM Principal Translation Format:

    • X.509 Certificate SAN (SPIFFE URI): spiffe://agents.global.org-${ORG_ID}.system.id.goog/resources/aiplatform/projects/${PROJECT_NUMBER}/locations/${REGION}/reasoningEngines/${ENGINE_ID}

    • Google Cloud IAM and UAP Policy V2 Principal Format: principal://agents.global.org-${ORG_ID}.system.id.goog/resources/aiplatform/projects/${PROJECT_NUMBER}/locations/${REGION}/reasoningEngines/${ENGINE_ID} (always use the full system.id.goog/resources/aiplatform/projects/${PROJECT_NUMBER}/locations/${REGION}/reasoningEngines/${ENGINE_ID} path with numeric PROJECT_NUMBER, never a shortened vertex/reasoning-engine/<name> slug).


7. Data Residency, Regional Endpoints, Sovereign Cloud and Global Anycast Failover

7.1 Regional Sovereignty, Air-Gapped GDC/TPC and Global Anycast Failover
  1. Sovereign Data Residency (APRA, MAS, GDPR, EU): Align the Agent Runtime region, Agent Gateway region, and Model Armor callout endpoint (modelarmor.${REGION}.rep.googleapis.com:443) within the mandated sovereign boundary.

  2. Google Distributed Cloud (GDC) Air-Gapped and Trusted Partner Cloud (TPC): Where global agentregistry.googleapis.com is unavailable, deploy the Two-Tier Regional Internal ALB + Next-Hop SWP + Local Envoy ext_proc pattern inside the sovereign VPC perimeter with Private CA TrustConfig roots.

  3. Multi-Region Active/Active and Global Anycast Routing: Front regional Tier-2 Internal ALBs (each routing to a co-located regional Agent Runtime + Egress Agent Gateway stack in us-central1 and us-east4) with a single Tier-1 Global External ALB using a global anycast IP and health-checked Cross-Region PSC NEG failover.

  4. Spanner and Data-Plane Service Account Impersonation: Grant the agent principal roles/iam.serviceAccountTokenCreator on a dedicated IAM Service Account holding roles/spanner.databaseUser.

7.2 Observability, BigQuery dry_run Cost Guard and Data-Tier Governance
  1. Privacy-Preserving W3C Trace Propagation: Set ADK_CAPTURE_MESSAGE_CONTENT_IN_SPANS="false" in deploymentSpec.env so OpenTelemetry W3C traceparent spans correlate latency across Ingress, Agent Runtime, Agent Gateway, and MCP tool hops in Cloud Trace without recording raw user prompts or PII/PHI in span attributes.

  2. BigQuery Pre-Execution dry_run Cost and Read-Only Guard: When agents query bigquery.googleapis.com/mcp or analytical SQL tools, execute a pre-flight QueryJobConfig(dry_run=True, use_query_cache=False) check to verify statement_type == "SELECT" and enforce a maximum_bytes_billed ceiling with caller attribution labels before running the query:

from google.cloud import bigquery

def run_governed_query(client: bigquery.Client, sql: str, max_bytes: int, caller: str) -> list[dict]:
  dry_job = client.query(sql, job_config=bigquery.QueryJobConfig(dry_run=True, use_query_cache=False))
  if dry_job.statement_type != "SELECT" or (dry_job.total_bytes_processed or 0) > max_bytes:
    raise PermissionError("Blocked non-SELECT or over-budget BigQuery query")
  job_cfg = bigquery.QueryJobConfig(maximum_bytes_billed=max_bytes, labels={"caller": caller})
  return [dict(row) for row in client.query(sql, job_config=job_cfg).result()]
  1. Cloud SQL (pgvector) and Spanner Tool Spoke Access: Place database backends inside the Tool Spoke (MCP_PROJECT_ID), connect via Private Service Connect (PSC) endpoints, and authenticate using IAM database authentication (roles/cloudsql.instanceUser / roles/spanner.databaseUser) via short-lived SA impersonation rather than static database passwords.


8. Day-2 Operations: Updating Agent Connectivity Templates In-Place and Control-Plane Mutex Locks

8.1 In-Place PATCH via updateMask=agentConnectivityTemplate

Never use legacy update_mask=traffic_select,network_config or destroy/recreate an active Agent Gateway. Grant roles/compute.networkUser (networksecurity.addressGroups.use, networksecurity.addressGroups.get) on the new ACT's auto-created addressGroups/act-${NEW_TEMPLATE_ID} via the Network Security v1 :getIamPolicy / :setIamPolicy REST API first (see references/topologies_and_project_layouts.md Section 3.1), then submit an in-place PATCH with updateMask=agentConnectivityTemplate:

PATCH_RESP=$(curl -s -X PATCH \
  "https://networkservices.googleapis.com/v1/projects/${PROJECT_NUMBER}/locations/${REGION}/agentGateways/${GATEWAY_ID}?updateMask=agentConnectivityTemplate" \
  -H "Authorization: Bearer $(gcloud auth print-access-token)" \
  -H "X-Goog-User-Project: ${PROJECT_ID}" \
  -H "Content-Type: application/json" \
  -d "{\"name\":\"projects/${PROJECT_NUMBER}/locations/${REGION}/agentGateways/${GATEWAY_ID}\",\"agentConnectivityTemplate\":\"projects/${PROJECT_NUMBER}/locations/${REGION}/agentConnectivityTemplates/${NEW_TEMPLATE_ID}\"}")
OP_NAME=$(echo "${PATCH_RESP}" | jq -r '.name')
gcloud network-services operations wait "${OP_NAME}" --location="${REGION}" --project="${PROJECT_ID}"
8.2 Handling Control-Plane Resource Mutation Mutex Locks (HTTP 409 ABORTED)

The Network Services control plane enforces a per-resource mutex lock (HTTP 409 ABORTED: unable to queue the operation; an operation is already in progress). Before queueing sequential mutations, list active operations at https://networkservices.googleapis.com/v1/projects/${PROJECT_NUMBER}/locations/${REGION}/operations and poll until done: true.


9. Avoiding Dangling Reference Locks on ACT Deletion (FROM_AGENT_GATEWAY*)

Deleting an ACT immediately after issuing an Agent Gateway DELETE fails with HTTP 400 FAILED_PRECONDITION: Resource ... is already being used by resource(s) .../agentGateways/... because Network Services retains an internal FROM_AGENT_GATEWAY<ID> lock until the gateway deletion LRO and Agent Runtime DeprovisionAgentGatewayBinding workflow settle:

  1. Delete ReasoningEngine First with ?force=true and poll its LRO to completion.

  2. Wait for Agent Gateway Deletion LRO + 20s Settle Window (sleep 20 cooldown) before calling DELETE on the parent ACT.

  3. Wait 180s After ACT Deletion (sleep 180 cooldown) before deleting the PSC-I Network Attachment so tenant router NICs detach cleanly.


10. Teardown and Clean Recreation Lifecycle

graph TD
    Step1["1. Delete Agent Runtime Instances (?force=true)"] --> Step2["2. Delete AuthzPolicies & UAP PolicyBindings"]
    Step2 --> Step3["3. Delete Agent Gateway (Poll LRO + 20s Settle) & AuthzExtensions"]
    Step3 --> Step4["4. Delete ACT (Poll LRO + 180s Drain) & act-TEMPLATE_ID AddressGroup"]
    Step4 --> Step5["5. Delete Agent Registry Services & PSC-I Network Attachment"]
    Step5 --> Step6["6. Delete PBR Routes, SWP Gateway, Cloud NAT, Subnets & VPC"]
10.1 Complete Reverse-Dependency CLI Teardown Script
# 1. Force-delete active Agent Runtime instance (drops child sessions cleanly) and poll LRO
RE_DEL_RESP=$(curl -s -X DELETE \
  "https://${REGION}-aiplatform.googleapis.com/v1/projects/${PROJECT_NUMBER}/locations/${REGION}/reasoningEngines/${RE_ID}?force=true" \
  -H "Authorization: Bearer $(gcloud auth print-access-token)" \
  -H "X-Goog-User-Project: ${PROJECT_ID}")
RE_OP=$(echo "${RE_DEL_RESP}" | jq -r '.name // empty')
while [[ -n "${RE_OP}" ]]; do
  OP_JSON=$(curl -s -X GET "https://${REGION}-aiplatform.googleapis.com/v1/${RE_OP}" \
    -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "X-Goog-User-Project: ${PROJECT_ID}")
  [[ "$(echo "${OP_JSON}" | jq -r '.done // false')" == "true" ]] && break
  sleep 10
done

# 2. Delete AuthzPolicies, Agent Gateway (poll LRO + 20s control-plane settle), and AuthzExtensions
gcloud network-security authz-policies delete "${AUTHZ_POLICY_NAME}" --location="${REGION}" --project="${PROJECT_ID}" --quiet
GW_OP=$(curl -s -X DELETE \
  "https://networkservices.googleapis.com/v1/projects/${PROJECT_NUMBER}/locations/${REGION}/agentGateways/${GATEWAY_ID}" \
  -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "X-Goog-User-Project: ${PROJECT_ID}" | jq -r '.name')
gcloud network-services operations wait "${GW_OP}" --location="${REGION}" --project="${PROJECT_ID}"
gcloud service-extensions authz-extensions delete "${AUTHZ_EXT_NAME}" --location="${REGION}" --project="${PROJECT_ID}" --quiet
sleep 20

# 3. Delete ACT (poll LRO + 180s PSC-I NIC drain), auto-created addressGroup, Registry & Network Attachment
ACT_OP=$(curl -s -X DELETE \
  "https://networkservices.googleapis.com/v1/projects/${PROJECT_NUMBER}/locations/${REGION}/agentConnectivityTemplates/${TEMPLATE_ID}" \
  -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "X-Goog-User-Project: ${PROJECT_ID}" | jq -r '.name')
gcloud network-services operations wait "${ACT_OP}" --location="${REGION}" --project="${PROJECT_ID}"
gcloud network-security address-groups delete "act-${TEMPLATE_ID}" --location="${REGION}" --project="${PROJECT_ID}" --quiet || true
sleep 180
gcloud agent-registry services delete "googleapis" --location="${REGION}" --project="${PROJECT_ID}" --quiet
gcloud compute network-attachments delete "${ATTACHMENT_NAME}" --region="${REGION}" --project="${PROJECT_ID}" --quiet

11. Egress NAT Reflection and Cloud Run Ingress Routing Behavior

11.1 Cloud NAT vs Cloud Run Ingress Routing Behavior

[!IMPORTANT] Internal Google Cloud Ingress Routing Behavior: When an Agent Gateway or Compute Engine instance in Google Cloud calls a default Cloud Run domain (*.run.app), Google Cloud routes traffic internally to the Cloud Run ingress proxy, bypassing Cloud NAT and setting X-Forwarded-For: 0.0.0.0. To verify that outbound traffic reflects the Cloud NAT static external IP (STATIC_NAT_IP), test queries must target an external non-Google service (such as https://api.ipify.org) as part of the 3-phase verification runbook (references/topologies_and_project_layouts.md Section 10):

  1. Control-Plane Readiness: Verify via gcloud ... describe that the Agent Gateway state is ACTIVE, the PSC-I Network Attachment endpoint is ACCEPTED, and the consolidated googleapis service is registered in Agent Registry.

  2. Outbound TLS Peer and External NAT Probe: Verify that the agent container's outbound TLS connection terminates at 240.0.0.2 (Agent Gateway TLS Inspection CA) and an external reflector probe (https://api.ipify.org) returns the consumer Cloud NAT IP.

  3. Security Probes and Cloud Audit Log Receipts: Execute positive and negative security probes and verify server-side Cloud Audit Log deny receipts (protoPayload.status.code=7 on iap.googleapis.com and modelarmor.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, 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 or Google.

Download ZIP

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