Repository navigation
feat(demos/agent-gateway-shared-vpc): add Agent Gateway egress governance with Shared VPC (CUJ2 Extension) - #218
Draft
augustoscit wants to merge 6 commits into
Conversation
…ance Terraform modules
…n and deployment guide
…for Model Armor RAI filters
…upport pre-configured Shared VPC
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the click-to-deploy Shared VPC egress governance demo (CUJ2 Extension) for the Gemini Enterprise Agent Platform.
This demo demonstrates how to implement an enterprise-grade, multi-project outbound network governance architecture for AI agents deployed on Vertex AI Agent Engine (Reasoning Engine). By leveraging Google Cloud Shared VPC, it enforces strict separation of duties between a centralized Networking Host Project (VPC, SWP, Cloud NAT with static IP, Private DNS) and a Governance Service Project (Agent Gateway, Model Armor guardrails, Agent Registry, and Agent Runtime), while routing internal Google APIs over Private Google Access (PGA).
What this does
Deploys a complete end-to-end multi-project outbound network governance solution via Terraform:
Decoupled Two-Project Enterprise Architecture (Shared VPC):
google_compute_shared_vpc_host_project), subnets (workload, PSC-I/26, SWP proxy-only/24), Secure Web Proxy inNEXT_HOP_ROUTING_MODE, GatewaySecurityPolicy, Cloud Router, Cloud NAT (MANUAL_ONLY with reserved static external IP), and Private Cloud DNS zone forgoogleapis.com.(Private Google Access).google_compute_shared_vpc_service_project), cross-project PSC-I Network Attachment, Agent Gateway inAGENT_TO_ANYWHEREmode, nativeCENTRALIZEDAgentConnectivityTemplate, Model Armor guardrail templates, Cloud Run FastMCP service, and Vertex AI Reasoning Engine.roles/compute.networkUserandroles/dns.peeron the Networking Host Project for the Governance project's service agents (gcp-sa-agentgateway,gcp-sa-aiplatform-re, and default Cloud Services SA).googleand aliasedgoogle.networking) withuser_project_override = trueand explicit per-projectbilling_project, eliminating local ADC quota conflicts and cross-project permission collisions.Cross-Project Egress Network Governance via Agent Gateway & ACT (CENTRALIZED):
AGENT_TO_ANYWHEREmode connected across projects via a Private Service Connect (PSC-Interface) Network Attachment deployed in the Governance project but bound to the Shared VPC subnet in the Host project.AgentConnectivityTemplatewithvpcEgress: ALL_TRAFFICand nativedeployment_model = "CENTRALIZED"(utilizing the latesthashicorp/googleprovider features), routing 100% of runtime egress through the Shared VPC.random_id(e.g.,agent-gateway-act-<hex>), completely isolating fresh deployments from pre-GA alpha tombstone reference locks.scripts/manage_agent_gateway.sh), eliminatinggcloud alpha(v1alpha1) LRO timeout bugs and achieving provisioning in ~4 minutes.Dual-Path Routing & Private Google Access Bypass (PBR):
199.36.153.8/30(resolved by private Cloud DNS*.googleapis.com.in Host project) and routes internal Google API traffic (Vertex AI, Cloud Trace, IAM) directly via Private Google Access (DEFAULT_ROUTING), avoiding NAT and SSL handshake failures.*.a.run.app) to the internal IP of the Secure Web Proxy (10.0.0.2:443).L7 Inspection, Content Safety & Reserved Static Egress IP:
NEXT_HOP_ROUTING_MODEwith aGatewaySecurityPolicyallowing vetted hosts.MANUAL_ONLYmode with an external reserved static IP (<name_prefix>-nat-ip), ensuring remote servers and firewalls can verify the agent's deterministic identity.Agent Gateway Default-Deny Override (Allow-All AuthzPolicy):
action = ALLOW,when = 'true') to the Agent Gateway via declarative lifecycle scripts. This delegates L7 inspection and policy enforcement to the customer Shared VPC SWP and Model Armor, overriding the gateway's internaldefault_denieddrop.Software Bug Agent & Cloud Run MCP Service:
SafeAdkApppatchingsocket.getaddrinfoto force pure IPv4 resolution, preventingaiohappyeyeballssocket unreachable errors (Errno 101).min_instance_count = 1andsession_affinity = true. The agent client setstimeout = 30.0to eliminate cold-start timeouts.Resilient Multi-Project Teardown Automation:
connectionEndpointsevery 10s (up to 45 attempts) to guarantee PSC interfaces fully detach before deleting the Network Attachment across projects, preventing Error 412.FAILED_PRECONDITION) to wait for Vertex AI Reasoning Engine decoupling before deleting the gateway.Testing
terraform apply(Foundation, Shared VPC, cross-project IAM, SWP, Cloud NAT, Cloud Run MCP, Model Armor, Agent Registry, Agent Gateway with ACT).uv run python deploy_agent.py --build-only.terraform apply -var deploy_reasoning_engine=true(Vertex AI Reasoning Engine in Governance project).List all open P1 bugs assigned to alice@quantumroast.example.list_ticketstool through the Governance project Agent Gateway, Host project Shared VPC PSC-I subnet, SWP, and Cloud NAT, returning the formatted Markdown table of P1 bugs.terraform output -raw nat_static_ip).networkservices.googleapis.com/gateway_requests(HTTP 200 CONNECT/POST) and Model Armor safety telemetry.terraform destroy -var deploy_reasoning_engine=truewith zero dangling resources across both Host and Service projects.