Designs, deploys, and secures Google Cloud Agent Gateway solutions. Use when the user needs to configure multi-agent security, ingress (CLIENT_TO_AGENT), or egress (AGENT_TO_ANYWHERE) patterns involving Model Armor, IAP, and Agent Registry. Don't use for general Cloud Load Balancing or basic VPC setup not related to Agent Gateways.
Permissions
Files
Designs, deploys, and secures Google Cloud Agent Gateway solutions. Use when the user needs to configure multi-agent security, ingress (CLIENT_TO_AGENT), or egress (AGENT_TO_ANYWHERE) patterns involving Model Armor, IAP, and Agent Registry. Don't use for general Cloud Load Balancing or basic VPC setup not related to Agent Gateways.
Version history
gcloud beta network-services agent-gateways). Omitting
these prefixes causes commands to fail because Agent Gateway features are
located in specialized, non-default namespaces.modelarmor.googleapis.com in the API
enablement list when setting up guardrails. Excluding it prevents Model
Armor policies and filters from successfully attaching to the Gateway.curl. Egress gateways rely on runtime SDK lifecycle handling and JWT
context that a standard curl command cannot simulate correctly.model-armor-config.yaml, always include both
piAndJailbreakFilterSettings and sdpFilterSettings (filterEnforcement: ENFORCE). Invalid or missing filters cause deployment validation failures
or lead to silent bypasses of the guardrails.private_ip_google_access = true enabled in Terraform. Disabling this blocks connectivity to
Google-managed endpoints, causing total routing failures for agents.gcloud, kubectl, terraform, or curl)
against real cloud resources during design. You are generating plan
configurations, not executing them.[!IMPORTANT] Just-In-Time (JIT) Resource Loading Protocol: Inspect template files in assets/ and executable scripts in scripts/ using
view_fileas needed for extended configurations, deployment scripts, and test suites.
Always generate files with these exact names when requested:
agw-ingress-config.yaml
(assets/agw-ingress-config.yaml)agw-egress-config.yaml
(assets/agw-egress-config.yaml)agw-authz-extension.yaml
(assets/agw-authz-extension.yaml)agw-authz-policy.yaml
(assets/agw-authz-policy.yaml)model-armor-config.yaml
(assets/model-armor-config.yaml)sgp-policy.yaml (assets/sgp-policy.yaml)iap-policy.json (assets/iap-policy.json)model-armor-payload.json
(assets/model-armor-payload.json)dual_ingress_egress_architecture_design)Ingress Pattern: CLIENT_TO_AGENT fronted by Ingress Control Plane
(Agent Gateway, Model Armor).
Egress Pattern: AGENT_TO_ANYWHERE utilizing Egress Control Plane
(Agent Gateway, roles/iap.egressor CEL policies, Cloud DNS) and Egress
Data Plane (PSC Interface, Cloud Run, PSC Google APIs Global Endpoint),
coordinated via Agent Registry & Agent Engine runtime.
Mermaid Diagram:
graph TD
Client["External Clients"] -->|HTTPS / MCP| GLB["Global Load Balancer"]
GLB --> Ingress["Ingress Agent Gateway (CLIENT_TO_AGENT)"]
Ingress --> MA["Model Armor (CONTENT_AUTHZ)"]
MA --> Agent["Agent Engine Agents (BillingAgent, SupportAgent, FraudAgent)"]
Agent --> Egress["Egress Agent Gateway (AGENT_TO_ANYWHERE)"]
Egress --> PSC["Private Service Connect Network Attachment"]
PSC --> Tools["Private MCP Tool Backends"]
ingress_and_egress_guardrail_policy_config)When requested for Ingress & Egress guardrail policy configs, you MUST generate and create all required files in the workspace:
agw-ingress-config.yaml
(assets/agw-ingress-config.yaml): Declares
governedAccessPath: CLIENT_TO_AGENT with protocols HTTP and MCP.agw-egress-config.yaml
(assets/agw-egress-config.yaml): Declares
governedAccessPath: AGENT_TO_ANYWHERE with protocol MCP.agw-authz-extension.yaml
(assets/agw-authz-extension.yaml):
Configures AuthzExtension service for IAP authorization.agw-authz-policy.yaml
(assets/agw-authz-policy.yaml): Configures
AuthzPolicy action ALLOW targeting both Ingress and Egress gateways.iap-policy.json (assets/iap-policy.json): Binds
roles/iap.egressor with CEL condition checking
iap.googleapis.com/mcp.toolName == 'get_account_balance' && iap.googleapis.com/mcp.tool.isReadOnly == true.model-armor-config.yaml
(assets/model-armor-config.yaml): Enables
piAndJailbreakFilterSettings and sdpFilterSettings with
filterEnforcement: ENFORCE.sgp-policy.yaml (assets/sgp-policy.yaml):
Implements Natural Language Constraints blocking transactions > $1000 and
sanitizing PII.ingress_and_egress_infrastructure_deployment)Inspect and provide the step-by-step gcloud CLI commands from
scripts/deploy_infrastructure.sh:
compute, networkservices, networksecurity,
modelarmor, iap, agentregistry, serviceextensions, and aiplatform.agw-ingress-config.yaml) and Egress
(agw-egress-config.yaml) via gcloud alpha network-services agent-gateways import.agw-authz-extension.yaml via gcloud beta service-extensions authz-extensions import.agw-authz-policy.yaml via gcloud beta network-security authz-policies import.ingress_and_egress_security_validation)When validating security for Ingress and Egress:
tools/call requests (get_account_balance) through the
Egress Gateway to verify HTTP 200 for allowed tools.model-armor-payload.json
(assets/model-armor-payload.json)
containing prompt injection/jailbreak instructions.troubleshooting_ingress_and_egress_failures)Ingress 403 (Client-to-Agent):
roles/iap.httpsResourceAccessor permission.Authorization: Bearer <TOKEN> header.Egress 403 (Agent-to-Anywhere):
roles/iap.egressor IAM bindings on the Agent
Identity, malformed principal ID, or mismatched CEL condition on tool
metadata.gcloud command from
scripts/fix_egress_iap.sh.hybrid_vpn_connectivity_egress_routing)private_ip_google_access = true), PSC network attachment, Cloud DNS
private forwarding for aws.internal., and HA VPN gateway/router.agw-egress-config.yaml): Generate configuration
declaring governedAccessPath: AGENT_TO_ANYWHERE, pointing to the PSC
network attachment, and referencing aws.internal. in dnsPeeringConfig
(see assets/agw-egress-config.yaml).agent_to_anywhere_config referencing
the Egress Gateway, enabling telemetry, and deploying HybridAgent using
types.IdentityType.AGENT_IDENTITY.private_egress_gke_internal_load_balancer)10.0.1.50, connecting via Agent Gateway PSC Interface + Cloud
DNS Private zone.10.0.1.50.governance_controls_model_armor_sgp)When configuring dual safety layers with Model Armor on Ingress and SGP on Egress:
model-armor-config.yaml
(assets/model-armor-config.yaml) with
piAndJailbreakFilterSettings and sdpFilterSettings (filterEnforcement: ENFORCE).sgp-policy.yaml
(assets/sgp-policy.yaml) with Natural Language
Constraints blocking transactions > $1000 and sanitizing PII.authzExtensions with sgpEnforcementMode set to ENFORCE.multi_agent_cloud_run_egress_routing)Do NOT produce a plan artifact or stop at planning. When configuring multi-agent Cloud Run egress routing, you MUST directly provide and generate ALL required components:
agw-egress-config-run.yaml): Generate
configuration declaring governedAccessPath: AGENT_TO_ANYWHERE, PSC network
attachment, and DNS peering for *.run.app (see
assets/agw-egress-config-run.yaml).marketing-tool-service,
sales-tool-service, support-tool-service) in the us-east4 Agent
Registry.iap-policy.json (Multi-Agent): Generate iap-policy.json
(assets/iap-policy-multi-agent.json)
containing all 3 principal:// bindings in the members list under
roles/iap.egressor.advanced_model_armor_filtering)For custom keyword matching, configure userDefinedFilterSettings (see
assets/model-armor-advanced.yaml).
known_traps_and_gotchas)network_attachment is ForceNew: Enabling Semantic Governance
Policies (SGP) or modifying network attachments after the initial Terraform
apply will force-recreate the gateway resource. If not managed carefully,
this can cause dependency deadlocks during destroy operations. Plan
infrastructure sequencing accordingly.In these kits
Works with
Claude, Codex, Cursor & more