
An Agent Gateway controls traffic in one direction, determined by its governedAccessPath setting. In CLIENT_TO_AGENT mode, the gateway governs inbound traffic coming into an agent from users. In AGENT_TO_ANYWHERE mode, the gateway governs outbound traffic leaving the agent toward tools, APIs, and other agents. Because each mode applies to only one direction, a Client-to-Agent gateway never sees outbound calls from the agent, and an Agent-to-Anywhere gateway never sees incoming user prompts. On the Professional Agentic Architect exam, architecture choices around traffic governance depend on matching the direction of the traffic to the corresponding gateway mode.
A gateway configured with CLIENT_TO_AGENT sits in front of an agent and inspects incoming user messages before the agent sees or processes them. To screen those prompts for prompt injection and jailbreak attempts, a Model Armor template is attached to the gateway. The template defines the prompt injection and jailbreak filters that the gateway enforces on each incoming prompt.
Two configuration constraints apply to Model Armor integration on Agent Gateway. First, the Model Armor template must exist in the same region as the gateway. A template cannot serve a gateway in any other region, so a template has to exist in each region where a gateway that uses it runs. Second, Agent Gateway works with Model Armor templates rather than floor settings, so floor settings alone do not screen incoming traffic to the agent.
Placing the policy in the gateway and its attached Model Armor template allows a security team to manage prompt screening centrally without modifying the agent's code. Calling the sanitize API directly from a callback inside the agent's code is an alternative, but that keeps policy enforcement inside application code. A direct sanitize API call also makes Model Armor act as a detector only, leaving the agent's own code responsible for deciding what to block.
A gateway configured with AGENT_TO_ANYWHERE operates in egress mode as a single enforcement point between an agent and the tools, APIs, and other agents it calls. Whenever the agent sends an outbound request, the gateway checks the destination against Agent Registry and evaluates the egress access policies for the agent's identity. Agent Registry catalogs MCP servers, external REST endpoints, and other agents such as partner agents reached over A2A.
Agent-to-Anywhere mode enforces a default-deny posture. When no matching access policy exists for the agent's identity and the target destination, the gateway denies the request. Any newly introduced destination stays blocked until it is approved, cataloged in Agent Registry, and granted an egress policy for that agent's identity, all without requiring changes to the agent's code.
Other Google Cloud controls and application checks do not replace an Agent-to-Anywhere gateway for outbound agent governance:
Default-deny enforcement moves the decision about what an agent can reach out of the agent's code. A destination is callable through the gateway only when it is cataloged in Agent Registry and an egress access policy for the agent's identity allows it. Code changes alone never open a path, so bringing a new MCP server, REST endpoint, or partner agent into an agent's design always includes two steps outside the code: registering the destination in Agent Registry and granting the agent's identity an egress access policy for it.
Other features on the gateway path have narrower jobs. Model Armor on the gateway screens the content of tools/call and prompts/get requests, not tools/list, so it filters what a request contains rather than deciding which destinations an agent may reach. The MCP Tool User role applies to Google Cloud MCP servers, while access to third-party servers through the gateway is decided by Agent Registry and egress access policies. For the Professional Agentic Architect exam, keeping catalog and policy checks separate from content screening and IAM roles makes it easier to place each control correctly.
Agent Runtime requires Agent Identity before a gateway can be bound to an agent, so identity and gateway settings are decided together when an ADK agent is deployed to Agent Runtime with agents-cli. Each relevant agents-cli deploy setting controls one thing:
--agent-identity gives the agent its own Agent Identity. A new deployment that sets neither identity flag has Agent Identity turned off, and --no-agent-identity turns it off explicitly. Without Agent Identity, no gateway binding can work.--agent-gateway-egress binds the agent's outbound traffic to a gateway whose governedAccessPath is AGENT_TO_ANYWHERE. The corresponding ingress flag binds a gateway to inbound traffic instead.Because each gateway mode governs a single direction, the binding flag has to match the direction the gateway was created for, and Agent Identity has to be turned on for any binding to take effect.
Our Professional Agentic Architect practice exams test Agent Gateway modes alongside Model Armor templates and Agent Registry access policies, with detailed explanations that drill these distinctions.