> [!NOTE]
> **Note:** We recommend that you instead [use
> Unified Access Policies (UAPs)](https://docs.cloud.google.com/gemini-enterprise-agent-platform/govern/policies/iam-overview-uap) to manage access to Agent Gateway.

You can create IAM allow policies and deny policies that
Agent Gateway uses to securely govern agentic communication between
your agents and other services, including other agents, MCP servers, and
endpoints. Agent Gateway uses Identity-Aware Proxy (IAP) to
enforce the policies. IAP also
[enforces end-to-end agent identity authentication and authorization
security](https://docs.cloud.google.com/gemini-enterprise-agent-platform/govern/policies/iam-overview#end-to-end-security).

To create an IAM policy for Agent Gateway, see
[Create IAM
policies](https://docs.cloud.google.com/gemini-enterprise-agent-platform/govern/policies/configure-iam-policies).

You can also create a Principal Access Boundary (PAB) on the agent identity.
Agent Gateway can use IAP to enforce
Principal Access Boundary policies.

## Enable Agent Gateway

To use agentic communication policies, you must [set up
Agent Gateway](https://docs.cloud.google.com/gemini-enterprise-agent-platform/govern/gateways/set-up-agent-gateway).

We recommend that you configure Agent Gateway in dry-run mode
(`iamEnforcementMode: "DRY_RUN"`, or **Audit-only** in the
Google Cloud console) in a staging environment to verify that your policies
are working as expected. In dry-run mode, IAP logs disallowed
agentic communications to Cloud Audit Logs but doesn't block them. For
instructions on querying dry-run violation logs across controls, see [Audit
dry-run policy violations across
controls](https://docs.cloud.google.com/gemini-enterprise-agent-platform/govern/policies/dry-run-report).

When you are satisfied that the policies are functioning correctly, you can
enable active enforcement by selecting **Enforce policies** in the
Google Cloud console (which writes `iamEnforcementMode: "ENFORCED"` when
creating a gateway, or removes `iamEnforcementMode` when updating an
existing gateway), or by removing `iamEnforcementMode` in your
authorization extension metadata. In active enforcement mode, agentic
communications that violate the policy are disallowed and communications
to the resource are blocked.

## Policy components

Policies have the following components:

- **Agents** : In your IAM allow policies, source agents are
  defined by their agent identity (specifically, the identity of the agent
  initiating communication with a service). To learn how different types of
  agents receive identities, see [Agent
  identity](https://docs.cloud.google.com/gemini-enterprise-agent-platform/scale/runtime/agent-identity). Agent identities are
  represented by [principal identifiers](https://docs.cloud.google.com/iam/docs/principal-identifiers.md.txt) that
  contain the SPIFFE-formatted identity of the agent---for example,
  `principal://agents.global.org-...`. Note that agent identifiers in URN format
  (such as `urn:agent:...`) are used solely for inventory and catalog lookup and
  are not used in IAM policy bindings. When you use the
  gcloud CLI to configure the IAM policy, the agent
  principal is the member that you grant access to.

  Gemini Enterprise agents and Agent Runtime instances are
  automatically assigned an Agent Identity and registered in
  Agent Registry.
- **Agent Registry resource** : The Agent Registry
  service that you're granting allow or deny access on. In IAM
  allow and deny policies, Agent Registry services are referred to as
  *resources*. The resource can be an entire registry within a project or an
  individual service, which can be an MCP server, agent, or endpoint.

  Individual services must be registered in
  Agent Registry before they can be referenced in an
  IAM policy. This registration is validated at bind time (when
  the policy binding is created or updated). If you reference a service that is
  not registered, policy creation fails immediately with a requested entity not
  found (`NOT_FOUND`) error.

  When you configure policies using the gcloud CLI CLI or Terraform,
  target resources are specified by their registry-minted paths or IDs (using
  flags like `--agent`, `--endpoint`, or `--mcp-server`), rather than their
  logical URN identifiers. At runtime, the security gateway matches traffic
  destinations by their exact hostname instead of using URNs.

  If you regionalize your agent registries, then your IAM
  allow policy applies only to the resources that are in the registry's region.
- **Role** : Agentic communication policies always grant the [IAP-secured
  Egressor
  (`roles/iap.egressor`)](https://docs.cloud.google.com/iam/docs/roles-permissions/iap#iap.egressor) role on
  the service resource.

- **Condition** : You can optionally configure a condition on the
  IAM allow policy to further restrict what the agent can access.
  In the Google Cloud console, you can use the **Condition builder** to create
  a condition by selecting UI elements. Alternatively, you can use
  the **Condition editor** to enter more complex conditions as Common Expression
  Language (CEL) expressions.

  The following table lists the attribute names that you can use to construct
  CEL expressions. Because the direct field-access style (such as
  `request.mcp.toolName`) is not supported, you must use the
  `api.getAttribute()` function to retrieve the value of each attribute.

  For more information about how to configure allow policies with conditions,
  see [Configure IAM agent
  policies](https://docs.cloud.google.com/gemini-enterprise-agent-platform/govern/policies/configure-iam-policies).

  | Attribute name | Description and CEL example |
  |---|---|
  | `mcp.toolName` | Name of the specific tool being called. For example: `request.mcp.toolName == 'GetCalendarEvents'` |
  | `iap.googleapis.com/mcp.resourceName` | Name of the resource being accessed. For example: `api.getAttribute('iap.googleapis.com/mcp.resourceName', '') == 'my-resource'` |
  | `iap.googleapis.com/mcp.promptName` | Prompt name being used. For example: `api.getAttribute('iap.googleapis.com/mcp.promptName', '') == 'my-prompt'` |
  | `mcp.method` | The specific MCP operation (e.g., tools/call, resources/read). |
  | `iap.googleapis.com/mcp.tool.isReadOnly` `iap.googleapis.com/mcp.tool.isDestructive` `iap.googleapis.com/mcp.tool.isIdempotent` `iap.googleapis.com/mcp.tool.isOpenWorld` | Boolean flags indicating the type of operation. For example: `api.getAttribute('iap.googleapis.com/mcp.tool.isReadOnly', false) == true` |
  | `request.auth.type` | Enum indicating the protocol (e.g., 'MCP'). |

## Create policies

In the **Policies** page in the Google Cloud console, you create
IAM allow policies and deny policies that Agent Gateway
uses to govern agentic communications.

In the gcloud CLI, you can configure both IAM allow
and IAM deny policies that Agent Gateway uses to govern
agentic communications.

### Policies in the Google Cloud console

To create IAM policies by using the Google Cloud console, see
[Configure IAM
policies](https://docs.cloud.google.com/gemini-enterprise-agent-platform/govern/policies/configure-iam-policies#create-ag-iam-policy).

### Policies in the gcloud CLI

To create IAM policies by using the gcloud CLI, see
[Configure IAM
policies](https://docs.cloud.google.com/gemini-enterprise-agent-platform/govern/policies/configure-iam-policies#create-ag-iam-policy).

## End-to-end authentication and authorization

IAP and Context-Aware Access provide default end-to-end
agent identity authentication and authorization by using the following
protocols:

- Mutual TLS (mTLS)

- Demonstrating Proof of Possession (DPoP)

Agent identities are provisioned with an X.509 certificate and a
certificate-bound token. IAP enforces that agent identities use
mutual TLS (mTLS) to authenticate to Agent Gateway. When the
gateway allows the agent to egress and access Google Cloud APIs, MCP
servers, other agents, and endpoints, the agent attempts access outside of the
mTLS boundary. To help protect communication, Context-Aware Access enforces a
Google-managed Context-Aware Access policy. The policy requires DPoP to validate
the certificate-bound token that is bound to the agent identity. To learn more
about how Context-Aware Access provides end-to-end mTLS and DPoP security, see
[Context-Aware Access agent
security](https://docs.cloud.google.com/access-context-manager/docs/caa-agent-security).

## What's next

- [Codelab: Secure cross-cloud agentic AI applications](https://codelabs.developers.google.com/next26/aiinfra-learning-pod/screen1-securing-cross-cloud-agentic)
- [Agent Gateway overview](https://docs.cloud.google.com/gemini-enterprise-agent-platform/govern/gateways/agent-gateway-overview.md.txt)
- [Security controls for Generative AI](https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/security-controls.md.txt)