You can create Identity and Access Management (IAM) Unified Access Policies (Access policies) that govern agentic communication between agents and destination resources, such as agent registries, MCP servers, agents, and registered and unregistered endpoints.
Agent Gateway uses Identity-Aware Proxy (IAP) to evaluate and enforce Access policies.
In the Google Cloud console, you can use the Policies page to create Agent Gateway IAM Unified Access Policies (Access policies). Access policies can contain allow rules, deny rules, or both.
You can use the Google Cloud CLI and the REST API to create IAM Access policies by first creating JSON-formatted policy files, creating the policies, and binding them with projects that contain your Agent Gateway instances.
To learn how to update and delete Access policies, see Manage IAM Access policies.
Before you begin
Before you create an IAM Access policy, do the following:
You must turn the enforcement off for the Disable binding access policy to resource (
constraints/iam.managed.disableAccessPolicyBindings) managed constraint. By default, this boolean constraint is enabled for new organizations, and prevents you from binding an IAM v3 API access policy to a resource. For more information, see Updating policies with boolean rules.Set up a Google Cloud billing project.
Enable the required APIs:
gcloud services enable \ agentregistry.googleapis.com \ aiplatform.googleapis.com \ iam.googleapis.com \ networkservices.googleapis.comMake sure that you have set up an Agent Gateway and IAP using an IAP v2 policy. We recommend that you initially configure Agent Gateway in dry-run mode. For more information about Agent Gateway, see Agent Gateway overview.
Populate your Agent Registry with target destination resources, such as agents, MCP servers, and endpoints.
Determine the agent identities of the source agents that you want to manage access from. To manage access from an entire registry using the Google Cloud console, select the project that contains the registry.
Required roles
To get the permissions that you need to configure Agent Platform for AI agents, ask your administrator to grant you the following IAM roles on your project:
-
Create Agent Gateway instances:
IAP Policy Admin (
roles/iap.admin) or Network Security Admin (roles/networksecurity.admin) -
Create and bind Access policies:
Access Policy Admin (
roles/iam.accessPolicyAdmin) -
Bind policy to a project:
Project IAM Admin (
roles/resourcemanager.projectIamAdmin)
For more information about granting roles, see Manage access to projects, folders, and organizations.
You might also be able to get the required permissions through custom roles or other predefined roles.
Create IAM Access policies
Access policies let you configure multiple rules. Each rule can have an allow effect or a deny effect.
Create an Access policy with an allow rule
You can create an Access policy with an allow rule using the Google Cloud console, the gcloud CLI, or the REST API.
Console
To create an Access policy in the Google Cloud console, do the following:
-
In the Google Cloud console, go to the Policies page:
- In the project selector, select the project that contains the agent gateways that will use the Access policy.
- To add an IAM Access policy for Agent Gateway egress, click Create.
-
In Policy details, do the following:
- Click the Policy field.
- In the drop-down list, select Create new policy.
- In the Policy name field, enter the name of the policy. The policy ID is automatically generated based on the policy name.
- Optional: Click Edit to edit the policy ID. In the Policy ID field, you can change the name of the policy ID.
- In Add Rules, expand the default rule, Rule 1 or click Add a rule.
- Create one or more rules for your Access policy. View examples of different policies.
- To create your policy, click Create.
After you save your policy, the following happens:
The IAM
iap.resources.egressViaIAPpermission is granted to the principals in your policy.The policy is automatically bound to the selected project.
All Agent Gateway instances in this project can enforce any policy associated with the project.
gcloud
To create an Access policy in the gcloud CLI, do the following:
Create a JSON-formatted policy file. Access policies can contain one or more rules. Each rule controls access from one or more agent principals to one or more target resources.
[ { "description": "RULE_DESCRIPTION", "effect": "RULE_EFFECT", "principals": [ AGENT_PRINCIPALS ], "operation": { "permissions": ["iap.googleapis.com/resources.egressViaIAP"] }, "conditions": { "iap.googleapis.com": { "expression": "CEL_EXPRESSION" } } } ]Replace the following:
-
RULE_DESCRIPTION: the description of the rule -
RULE_EFFECT: the effect of the rule, which is eitherALLOWorDENY -
AGENT_PRINCIPALS: the principals for the source agent identity. Agent principals can be an array of one or more individual principals or principal sets:-
Built-in agent identities:
principal://TRUST_DOMAIN/AGENT_UNIQUE_IDENTIFIERThe structure of
AGENT_UNIQUE_IDENTIFIERdepends on the Google Cloud service hosting the agent:- Agent Runtime (Reasoning Engine):
principal://agents.global.org-123456789012.system.id.goog/resources/aiplatform/projects/9876543210/locations/us-central1/reasoningEngines/my-agent - Gemini Enterprise (Discovery Engine):
principal://agents.global.org-123456789012.system.id.goog/resources/discoveryengine/projects/9876543210/locations/global/engines/my-engine/assistants/default_assistant/agents/default/core_assistant - Cloud Run (Agent Identity):
principal://agents.global.org-123456789012.system.id.goog/resources/run/projects/9876543210/locations/us-central1/services/my-cloud-run-agent
Replace the following:
-
TRUST_DOMAIN: the trust domain of the project or organization that contains the agent principal (for example,agents.global.org-ORGANIZATION_ID.system.id.googoragents.global.proj-PROJECT_NUMBER.system.id.goog) -
AGENT_UNIQUE_IDENTIFIER: the resource URI path of the agent instance
- Agent Runtime (Reasoning Engine):
-
Workload Identity Federation (custom or external agents):
principal://iam.googleapis.com/projects/PROJECT_NUMBER/locations/global/workloadIdentityPools/POOL_ID/subject/SUBJECT—for example,principal://iam.googleapis.com/projects/1234567890/locations/global/workloadIdentityPools/my-agent-identity/subject/ns/default/sa/my-agentReplace the following:
-
PROJECT_NUMBER: the project number of the project that contains the workload identity pool -
POOL_ID: the ID of the workload identity pool -
SUBJECT: the subject identifier of the agent principal
-
-
Built-in agent identities:
-
CONDITION: the condition parameter, formatted as follows:"conditions": { "iap.googleapis.com": { "expression": "CEL_EXPRESSION" } }Replace
CEL_EXPRESSIONwith a conditional expression—for example:"destination.agent_registry.mcp_server.name == '/projects/corp-apim-prod/locations/us-east1/mcpServers/finance-data-service' && destination.agent_registry.mcp_server.tool.name == 'updateRecord'"
This expression must be a valid CEL expression. It must evaluate to
truefor access to be allowed.
In all agent egress policies, you must set the permission to
iap.resources.egressViaIAP.For more information, see Access policy rules and Example policies.
-
To create the Access policy, run the following command:
gcloud iam access-policies create POLICY_NAME \ --details-rules=POLICY_FILE \ --project=PROJECT_ID \ --location=globalReplace the following:
-
POLICY_NAME: the name of the policy -
POLICY_FILE: the path to the policy file—for example:my-policy.json PROJECT_ID: the project ID that contains the policy
-
REST API
To create and bind a policy using the REST API, do the following:
Save the JSON-formatted policy details to a file named
agent-access-policy.json:{ "details": { "rules": [ RULES ] } }Replace
RULESwith one or more rules.To create the Access policy, make a
POSTrequest to theaccessPoliciesendpoint:curl -X POST \ "https://iam.googleapis.com/v3beta/projects/PROJECT_ID/locations/global/accessPolicies?accessPolicyId=POLICY_NAME" \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "Content-Type: application/json" \ -d @agent-access-policy.json
Replace the following:
PROJECT_ID: the project IDPOLICY_NAME: the policy name
Create a combination allow and deny Access policy
You can configure an Access policy containing both allow and deny rules by using the Google Cloud console, the gcloud CLI, and the REST API.
Console
To create an Access policy with both allow and deny rules in the Google Cloud console, do the following:
-
In Add Rules, configure the allow rule:
- In Rule description, enter the description for the allow rule.
- In Rule effect, select Allow.
- Select the agent principals and target resources, and add the allow CEL conditions.
- To save the allow rule, click Save.
-
To add the deny rule, click Add a rule:
- In Rule description, enter the description for the deny rule.
- In Rule effect, select Deny.
- Select the agent principals and target resources, and add the deny CEL conditions.
- To save the deny rule, click Save.
- To create the policy, click Create.
gcloud
To create an Access policy file containing both allow and deny rules, do the following:
Save the following to your JSON-formatted policy file:
[ { "description": "ALLOW_RULE_DESCRIPTION", "effect": "ALLOW", "principals": [ "AGENT_PRINCIPALS_ALLOW" ], "operation": { "permissions": ["iap.googleapis.com/resources.egressViaIAP"] }, "conditions": { "iap.googleapis.com": { "expression": "CEL_EXPRESSION_ALLOW" } } }, { "description": "DENY_RULE_DESCRIPTION", "effect": "DENY", "principals": [ "AGENT_PRINCIPALS_DENY" ], "operation": { "permissions": ["iap.googleapis.com/resources.egressViaIAP"] }, "conditions": { "iap.googleapis.com": { "expression": "CEL_EXPRESSION_DENY" } } } ]Replace the following:
ALLOW_RULE_DESCRIPTION: the description of the allow ruleDENY_RULE_DESCRIPTION: the description of the deny ruleAGENT_PRINCIPALS_ALLOW: the agent principals that you want to allow—for example,principal://agents.global.proj-PROJECT_NUMBER.system.id.goog/resources/aiplatform/projects/PROJECT_ID/locations/LOCATION/reasoningEngines/AGENT_NAMEAGENT_PRINCIPALS_DENY: the agent principals that you want to deny—for example,principal://agents.global.proj-PROJECT_NUMBER.system.id.goog/resources/aiplatform/projects/PROJECT_ID/locations/LOCATION/reasoningEngines/AGENT_NAMECEL_EXPRESSION_ALLOW: the CEL expression for the allow rule—for example,destination.agent_registry.mcp_server.name == "/projects/my-project/locations/us-east1/mcpServers/finance-data-service" && destination.agent_registry.mcp_server.tool.name == "getStatements"CEL_EXPRESSION_DENY: the CEL expression for the deny rule—for example,destination.agent_registry.mcp_server.name == "/projects/my-project/locations/us-east1/mcpServers/finance-data-service" && destination.agent_registry.mcp_server.tool.name == "updateRecord"
To create the Access policy, run the following command:
gcloud iam access-policies create POLICY_NAME \ --details-rules=POLICY_FILE \ --project=PROJECT_ID \ --location=globalReplace the following:
-
POLICY_NAME: the name of the policy -
POLICY_FILE: the path to the policy file—for example:my-policy.json PROJECT_ID: the project ID that contains the policy
-
To activate the policy, bind the Access policy to your project.
REST API
To create an Access policy containing both allow and deny rules using the REST API, do the following:
Save the following to a JSON-formatted policy file named
agent-access-policy.json:{ "details": { "rules": [ { "description": "ALLOW_RULE_DESCRIPTION", "effect": "ALLOW", "principals": [ "AGENT_PRINCIPALS_ALLOW" ], "operation": { "permissions": ["iap.googleapis.com/resources.egressViaIAP"] }, "conditions": { "iap.googleapis.com": { "expression": "CEL_EXPRESSION_ALLOW" } } }, { "description": "DENY_RULE_DESCRIPTION", "effect": "DENY", "principals": [ "AGENT_PRINCIPALS_DENY" ], "operation": { "permissions": ["iap.googleapis.com/resources.egressViaIAP"] }, "conditions": { "iap.googleapis.com": { "expression": "CEL_EXPRESSION_DENY" } } } ] } }Replace the following:
ALLOW_RULE_DESCRIPTION: the description of the allow ruleDENY_RULE_DESCRIPTION: the description of the deny ruleAGENT_PRINCIPALS_ALLOW: the agent principals that you want to allowAGENT_PRINCIPALS_DENY: the agent principals that you want to denyCEL_EXPRESSION_ALLOW: the CEL expression for the allow ruleCEL_EXPRESSION_DENY: the CEL expression for the deny rule
To create the policy, run the following
curlcommand:curl -X POST \ "https://iam.googleapis.com/v3beta/projects/PROJECT_ID/locations/global/accessPolicies?accessPolicyId=POLICY_NAME" \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "Content-Type: application/json" \ -d @agent-access-policy.json
Replace the following:
PROJECT_ID: the project IDPOLICY_NAME: the policy name
To activate the policy, bind the Access policy to your project.
Bind an Access policy to a project
Console
After you save your policy, the following happens:
The IAM
iap.resources.egressViaIAPpermission is granted to the principals in your policy.The policy is automatically bound to the selected project.
All Agent Gateway instances in this project can enforce any policy associated with the project.
gcloud
To bind the policy to the target resource, run the following command:
gcloud iam policy-bindings create BINDING_NAME \
--policy="projects/PROJECT_ID/locations/global/accessPolicies/POLICY_NAME" \
--target-resource="TARGET_RESOURCE" \
--project=PROJECT_ID \
--location=global
Replace the following:
BINDING_NAME: the name for your policy binding-
PROJECT_ID: your Google Cloud project ID -
POLICY_NAME: the name of your access policy -
TARGET_RESOURCE: the full resource URI for the project, formatted as follows://cloudresourcemanager.googleapis.com/projects/PROJECT_ID
REST API
To bind the policy to the target resource, make a POST request to the
policyBindings endpoint:
curl -X POST \
"https://iam.googleapis.com/v3beta/projects/PROJECT_ID/locations/global/policyBindings?policyBindingId=BINDING_NAME" \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
-d '{
"policy": "projects/PROJECT_ID/locations/global/accessPolicies/POLICY_NAME",
"target": {
"resource": "TARGET_RESOURCE"
}
}'
Replace the following:
PROJECT_ID: the project IDBINDING_NAME: a name for the bindingPOLICY_NAME: the name of the policy that you created earlier in this documentTARGET_RESOURCE: the full resource URI for the binding target, which can be one of the following:- Project:
//cloudresourcemanager.googleapis.com/projects/PROJECT_ID - Agent Gateway:
//networkservices.googleapis.com/projects/PROJECT_ID/locations/LOCATION/agentGateways/GATEWAY_NAME
- Project:
Create rules
Access policies can contain one or more rules. Each rule controls access from one or more agent principals to one or more target resources.
Console
In the Google Cloud console, edit your Access policy and do the following:
- Edit your existing rule. To add a rule, click Add a rule.
- Rule description: a human-readable description for this rule
-
Select principals: The source agent principals that the
rule manages access from. Principals can be one of the following:
- All agents in this project: All agents that exist in the current project.
- Individual agents: One or more specific principals that you can select. Agents are defined by their agent identities.
-
Custom principal set: One or more principal sets that
you can specify by entering a principal identifier.
Principal identifiers must start with
principalSet://and refer to agent identities.
-
Effect: the rule's effect, which can be one of the
following:
- Allow: allows the principals to access the resources
- Deny: disallows the principals from accessing the resources
-
Select resources: One or more types of destination
resources that you can select. Resource types include the following:
- Registry: All resources that are registered in an Agent Registry location
- Agent: A destination agent that is registered in Agent Registry
-
MCP server: A destination MCP server that is registered in Agent Registry. You can use conditions to further control MCP server access.
- Endpoint: A destination endpoint that is registered in Agent Registry
-
Unregistered endpoint: A destination endpoint that is not registered in Agent Registry and is accessed through an external URL. You can use conditions to further control unregistered endpoint access.
gcloud
Rules in a JSON-formatted file have the following general format:
{
"description": "RULE_DESCRIPTION",
"effect": "EFFECT",
"principals": [
"AGENT_PRINCIPALS"
],
"operation": {
"permissions": ["iap.googleapis.com/resources.egressViaIAP"]
},
"conditions": {
"iap.googleapis.com": {
"expression": "CONDITION"
}
}
}
The policy file contains the following:
RULE_DESCRIPTION: a human-readable description for this ruleEFFECT: the rule's effect, which can be one of the following:ALLOWallows the principal to access the resourcesDENYdisallows the principal from accessing the resourcesCONDITION: a CEL expression that conditionally evaluates to true or false. If the expression evaluates to true, then the rule goes into effect. Conditions can also contain references to specific resources that principals can access:destination.agent_registry: the destination resource is registered in Agent Registry.destination.unregistered: the destination resource is unregistered. It is accessed through a URL. Access can be controlled in the condition.
To learn more about conditions, see Conditions. Learn more about conditions attributes in CEL attributes.
REST API
To create and bind a policy using the REST API, do the following:
Save the JSON-formatted policy details to a file named
agent-access-policy.json:{ "details": { "rules": [ { "description": "RULE_DESCRIPTION", "effect": "EFFECT", "principals": [ "AGENT_PRINCIPALS" ], "operation": { "permissions": ["iap.googleapis.com/resources.egressViaIAP"] }, "conditions": { "iap.googleapis.com": { "expression": "CONDITION" } } } ] } }Add one or more rules to the
detailsfield. In each rule, replace the following:RULE_DESCRIPTION: one or more rulesEFFECT: the rule's effect, which can be one of the following:ALLOWallows the principal to access the resourcesDENYdisallows the principal from accessing the resources
AGENT_PRINCIPALS: the agent principals that you want to grant access to.CONDITION: a CEL expression that conditionally evaluates to true or false. If the expression evaluates to true, then the rule goes into effect. Conditions can also contain references to specific resources that principals can access:destination.agent_registry: the destination resource is registered in Agent Registry.destination.unregistered: the destination resource is unregistered. It is accessed through a URL. Access can be controlled in the condition.
To learn more about conditions, see Conditions. Learn more about conditions attributes in CEL attributes.
To create the Access policy, make a
POSTrequest to theaccessPoliciesendpoint:curl -X POST \ "https://iam.googleapis.com/v3beta/projects/PROJECT_ID/locations/global/accessPolicies?accessPolicyId=POLICY_NAME" \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "Content-Type: application/json" \ -d @agent-access-policy.json
Replace the following:
PROJECT_ID: the project IDPOLICY_NAME: the policy name
To bind the policy to the target resource, make a
POSTrequest to thepolicyBindingsendpoint:curl -X POST \ "https://iam.googleapis.com/v3beta/projects/PROJECT_ID/locations/global/policyBindings?policyBindingId=BINDING_NAME" \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "Content-Type: application/json" \ -d '{ "policy": "projects/PROJECT_ID/locations/global/accessPolicies/POLICY_NAME", "target": { "resource": "TARGET_RESOURCE" } }'Replace the following:
PROJECT_ID: the project IDBINDING_NAME: a name for the bindingPOLICY_NAME: the name of the policy that you created earlier in this documentTARGET_RESOURCE: the full resource URI for the project formatted as follows://cloudresourcemanager.googleapis.com/projects/PROJECT_ID
Create conditions
Conditions are Boolean CEL expressions that determine access from agent principals to certain resources.
Console
In the Google Cloud console you can create conditions by doing the following:
In the Select resource(s) section of your rule, select one of the following tabs:
Standard: In the Standard tab, select one or more resource types and then use the condition builder or the condition editor to create a condition.
Custom: In the Custom tab, you can use the condition editor to create a custom condition in which you can use CEL attributes to specify your destination resources and other conditions.
To save the condition along with your rule, click Save.
gcloud
In the policy file, conditions determine which destination resources your agent principals can access and under what conditions they are accessed.
Conditions are defined in the conditions field of a rule. For example:
"conditions": {
"iap.googleapis.com": {
"expression": "destination.agent_registry.mcp_server.name == '/projects/my-project/locations/us-east1/mcpServers/finance-data-service' && destination.agent_registry.mcp_server.tool.name == 'getStatements'"
}
}
For more information, see Example policies.
REST API
In the policy file, conditions determine which destination resources your agent principals can access and under what conditions they are accessed.
Conditions are defined in the conditions field of a rule. For example:
"conditions": {
"iap.googleapis.com": {
"expression": "destination.agent_registry.mcp_server.name == '/projects/my-project/locations/us-east1/mcpServers/finance-data-service' && destination.agent_registry.mcp_server.tool.name == 'getStatements'"
}
}
For more information, see Example policies.
Test and verify Access policies
After you create and bind your policies, verify that your agent can access the resources by doing the following:
Trigger actions from your agents to test the rules in your Access policy. Make sure that you test that allow effect rules and deny effect rules perform as you expect.
Inspect Cloud Audit Logs for IAP entries by filtering logs with the following query:
protoPayload.metadata.iapPolicyVersion="v2" protoPayload.serviceName="iap.googleapis.com" resource.labels.project_id="PROJECT_ID"
Replace
PROJECT_IDwith your project ID.The log entries display the access decision, principal, target, and CEL expression evaluation details. We recommend that, during testing, you use
DRY_RUNmode so that policy violations don't block access.Adjust policy rules based on evaluation results in the audit logs.
After you confirm that your rules operate as expected, update your gateway service extension metadata, and set
iamEnforcementModeto"ENFORCE".
Example policies
The following are examples of egress policies for agent principal interactions:
- Agent to registry
- Agent to agent
- Agent to MCP server
- Agent to endpoint
- Agent to unregistered endpoint
For instructions on creating and binding policies, see Create Access policies.
Create an agent-to-registry Access policy
An agent-to-registry policy lets your agent access all of the agents, MCP servers, and endpoints in a specific Agent Registry location in a project.
Console
To create an agent-to-registry policy in the Google Cloud console, do the following:
-
In the Google Cloud console, go to the Policies page:
- In the project selector, select the project that contains the agent gateways that will use the Access policy.
-
In Policy details, select a policy or create a new one. If
you're creating a new policy, enter a policy name—for example,
allow-registry-access. -
In Add Rules, configure the rule:
- Rule description:
Allow all agents in project to access us-central1 registry - Rule effect: Allow
- Select principals: In Principal sets, select All agents in this project.
- Select resource(s): Select Standard > Registry, and select
us-central1.
- Rule description:
- To save the rule, click Save.
- To create the policy, click Create.
To learn how to create and bind policies, see Create IAM Access policies.
gcloud
The following example policy shows an Access policy rule that allows all agents in a project access to all destination resources in a specific registry:
{
[
{
"description": "Allow all agents in project 9876543210 to access all destination resources in the us-central1 registry",
"effect": "ALLOW",
"principals": [
"principalSet://agents.global.org-123456789012.system.id.goog/attribute.platformContainer/aiplatform/projects/9876543210"
],
"operation": {
"permissions": ["iap.googleapis.com/resources.egressViaIAP"]
},
"conditions": {
"iap.googleapis.com": {
"expression": "destination.is_registered == true && destination.agent_registry.location == 'us-central1'"
}
}
}
]
}
To activate the policy, bind the Access policy to your project.
REST API
To create an Access policy that allows all agents in a project access to all destination resources in a specific registry, do the following:
Save the following to a JSON-formatted policy file named
agent-access-policy.json:{ "details": { "rules": [ { "description": "Allow all agents in project 9876543210 to access all destination resources in the us-central1 registry", "effect": "ALLOW", "principals": [ "principalSet://agents.global.org-123456789012.system.id.goog/attribute.platformContainer/aiplatform/projects/9876543210" ], "operation": { "permissions": ["iap.googleapis.com/resources.egressViaIAP"] }, "conditions": { "iap.googleapis.com": { "expression": "destination.is_registered == true && destination.agent_registry.location == 'us-central1'" } } } ] } }To create the policy, run the following
curlcommand:curl -X POST \ "https://iam.googleapis.com/v3beta/projects/PROJECT_ID/locations/global/accessPolicies?accessPolicyId=POLICY_NAME" \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "Content-Type: application/json" \ -d @agent-access-policy.json
Replace the following:
PROJECT_ID: the project IDPOLICY_NAME: the policy name
To activate the policy, bind the Access policy to your project.
Agent-to-registry CEL attributes
The following table describes the CEL attributes that you can use in an agent-to-registry rule condition:
| Attribute | Details | ||||||
|---|---|---|---|---|---|---|---|
destination.is_registered |
|
||||||
destination.agent_registry.resource_type |
|
||||||
destination.agent_registry.location |
|
||||||
destination.agent_registry.project_id |
|
Create an agent-to-agent egress Access policy
An agent-to-agent policy allows a source agent to invoke a target agent registered in Agent Registry.
Console
To create an agent-to-agent policy in the Google Cloud console, do the following:
-
In the Google Cloud console, go to the Policies page:
- In the project selector, select the project that contains the agent gateways that will use the Access policy.
-
In Policy details, select a policy or create a new one. If
you're creating a new policy, enter a policy name—for example,
allow-orchestrator-to-support-agent. -
In Add Rules, configure the rule:
- Rule description:
Allow orchestrator agent to invoke customer-support agent - Rule effect: Allow
- Select principals: Select Specific agents, and select
orchestrator-agent. - Select resource(s): Select Standard > Agent, and select
customer-support-agent.
- Rule description:
- To save the rule, click Save.
- To create the policy, click Create.
To activate the policy, bind the Access policy to your project.
gcloud
The following example policy shows an IAM allow rule that allows an orchestrator agent to invoke a specific subagent registered in the Agent Registry:
{
[
{
"description": "Allow orchestrator agent to invoke customer-support agent",
"effect": "ALLOW",
"principals": [
"principal://agents.global.org-123456789012.system.id.goog/resources/aiplatform/projects/9876543210/locations/us-central1/reasoningEngines/orchestrator-agent"
],
"operation": {
"permissions": ["iap.googleapis.com/resources.egressViaIAP"]
},
"conditions": {
"iap.googleapis.com": {
"expression": "destination.agent_registry.agent.name == '/projects/9876543210/locations/us-central1/agents/customer-support-agent'"
}
}
}
]
}
To create and bind the policy by using the gcloud CLI, see Create IAM Access policies.
REST API
To create an IAM policy with an allow rule that allows an orchestrator agent to invoke a specific subagent registered in the Agent Registry, do the following:
Save the following to a JSON-formatted policy file named
agent-access-policy.json:{ "details": { "rules": [ { "description": "Allow orchestrator agent to invoke customer-support agent", "effect": "ALLOW", "principals": [ "principal://agents.global.org-123456789012.system.id.goog/resources/aiplatform/projects/9876543210/locations/us-central1/reasoningEngines/orchestrator-agent" ], "operation": { "permissions": ["iap.googleapis.com/resources.egressViaIAP"] }, "conditions": { "iap.googleapis.com": { "expression": "destination.agent_registry.agent.name == '/projects/9876543210/locations/us-central1/agents/customer-support-agent'" } } } ] } }To create the policy, run the following
curlcommand:curl -X POST \ "https://iam.googleapis.com/v3beta/projects/PROJECT_ID/locations/global/accessPolicies?accessPolicyId=POLICY_NAME" \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "Content-Type: application/json" \ -d @agent-access-policy.json
Replace the following:
PROJECT_ID: the project IDPOLICY_NAME: the policy name
To activate the policy, bind the Access policy to your project.
Agent-to-agent CEL attributes
The following table describes the CEL attributes that you can use in an agent-to-agent policy condition:
| Attribute | Details | ||||||
|---|---|---|---|---|---|---|---|
destination.agent_registry.agent.name |
|
Create an agent-to-MCP server egress Access policy
An agent-to-MCP server egress policy controls access from an agent to specific tools or annotations on a Model Context Protocol (MCP) server.
Console
To create an agent-to-MCP server policy in the Google Cloud console, do the following:
-
In the Google Cloud console, go to the Policies page:
- In the project selector, select the project that contains the agent gateways that will use the Access policy.
-
In Policy details, select a policy or create a new one. If
you're creating a new policy, enter a policy name—for example,
allow-github-read-only. -
In Add Rules, configure the rule:
- Rule description:
Allow read-only access to GitHubTool on MCP server - Rule effect: Allow
- Select principals: Select the agent principal—for example,
my-ae-agent. - Select resource(s): Select the Custom tab.
-
Conditions: In the condition editor, enter:
destination.agent_registry.mcp_server.tool.name == 'GitHubTool' && destination.agent_registry.mcp_server.tool.annotations.read_only_hint == true
- Rule description:
- To save the rule, click Save.
- To create the policy, click Create.
To activate the policy, bind the Access policy to your project.
gcloud
The following example policy shows an IAM allow rule that
allows a Workload Identity Federation-formatted agent principal
read-only access to a tool called GitHubTool:
{
[
{
"description": "Allow read-only access to GitHubTool on MCP server",
"effect": "ALLOW",
"principals": [
"principal://iam.googleapis.com/projects/9876543210/locations/global/workloadIdentityPools/POOL_ID/subject/ns/default/sa/my-ae-agent"
],
"operation": {
"permissions": ["iap.googleapis.com/resources.egressViaIAP"]
},
"conditions": {
"iap.googleapis.com": {
"expression": "destination.agent_registry.mcp_server.tool.name == 'GitHubTool' && destination.agent_registry.mcp_server.tool.annotations.read_only_hint == true"
}
}
}
]
}
Replace the following:
POOL_ID: the workload identity pool ID. Depending on your pool type, format the ID as follows:- Google-managed pool:
PROJECT_ID.svc.id.goog - Self-managed pool:
POOL_NAME.global.POOL_HOST_PROJECT_NUMBER.workload.id.goog
To create and bind the policy by using the gcloud CLI, see Create IAM Access policies.
REST API
To create an IAM Access policy that allows an agent using
Workload Identity Federation read-only access to a tool called GitHubTool,
do the following:
Save the following to a JSON-formatted policy file named
agent-access-policy.json:{ "details": { "rules": [ { "description": "Allow read-only access to GitHubTool on MCP server", "effect": "ALLOW", "principals": [ "principal://iam.googleapis.com/projects/9876543210/locations/global/workloadIdentityPools/POOL_ID/subject/ns/default/sa/my-ae-agent" ], "operation": { "permissions": ["iap.googleapis.com/resources.egressViaIAP"] }, "conditions": { "iap.googleapis.com": { "expression": "destination.agent_registry.mcp_server.tool.name == 'GitHubTool' && destination.agent_registry.mcp_server.tool.annotations.read_only_hint == true" } } } ] } }To create the policy, run the following
curlcommand:curl -X POST \ "https://iam.googleapis.com/v3beta/projects/PROJECT_ID/locations/global/accessPolicies?accessPolicyId=POLICY_NAME" \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "Content-Type: application/json" \ -d @agent-access-policy.json
Replace the following:
POOL_ID: the workload identity pool ID. Depending on your pool type, format the ID as follows:- Google-managed pool:
PROJECT_ID.svc.id.goog - Self-managed pool:
POOL_NAME.global.POOL_HOST_PROJECT_NUMBER.workload.id.goog PROJECT_ID: the project IDPOLICY_NAME: the policy name
To create and bind the policy by using the REST API, see Create Access policies.
Agent-to-MCP CEL attributes
The following table describes the CEL attributes that you can use in an agent-to-MCP server policy condition:
| Attribute | Details | ||||||
|---|---|---|---|---|---|---|---|
destination.agent_registry.mcp_server.name |
|
||||||
destination.agent_registry.mcp_server.method |
|
||||||
destination.agent_registry.mcp_server.tool.name |
|
||||||
destination.agent_registry.mcp_server.tool.annotations.read_only_hint
|
|
||||||
destination.agent_registry.mcp_server.tool.annotations.destructive_hint
|
|
||||||
destination.agent_registry.mcp_server.tool.annotations.idempotent_hint
|
|
||||||
destination.agent_registry.mcp_server.tool.annotations.open_world_hint
|
|
||||||
destination.agent_registry.mcp_server.prompt.name |
|
||||||
destination.agent_registry.mcp_server.resource.name |
|
Create an agent-to-endpoint egress Access policy
An agent-to-endpoint egress policy allows an agent to access a registered service endpoint in Agent Registry.
Console
To create an agent-to-endpoint policy in the Google Cloud console, do the following:
-
In the Google Cloud console, go to the Policies page:
- In the project selector, select the project that contains the agent gateways that will use the Access policy.
-
In Policy details, select a policy or create a new one. If
you're creating a new policy, enter a policy name—for example,
allow-translator-to-endpoint. -
In Add Rules, configure the rule:
-
Rule description:
Allow translator agent to access translation endpoint - Rule effect: Allow
-
Select principals: Select Specific agents,
and select
translator-agent. - Select resource(s): Select the Custom tab.
-
Conditions: In the condition editor, enter:
destination.agent_registry.endpoint.name == '/projects/9876543210/locations/us-central1/endpoints/translation-service'
-
Rule description:
- To save the rule, click Save.
- To create the policy, click Create.
To activate the policy, bind the Access policy to your project.
gcloud
The following example shows an IAM allow policy that allows an agent to access a registered service endpoint:
[
{
"description": "Allow translator agent access to registered translation endpoint",
"effect": "ALLOW",
"principals": [
"principal://agents.global.org-123456789012.system.id.goog/resources/aiplatform/projects/9876543210/locations/us-central1/reasoningEngines/translator-agent"
],
"operation": {
"permissions": ["iap.googleapis.com/resources.egressViaIAP"]
},
"conditions": {
"iap.googleapis.com": {
"expression": "destination.agent_registry.endpoint.name == '/projects/9876543210/locations/us-central1/endpoints/translation-service'"
}
}
}
]
To activate the policy, bind the Access policy to your project.
REST API
To create an IAM allow policy that allows an agent to access a registered service endpoint, do the following:
Save the following to a JSON-formatted policy file named
agent-access-policy.json:{ "details": { "rules": [ { "description": "Allow translator agent access to registered translation endpoint", "effect": "ALLOW", "principals": [ "principal://agents.global.org-123456789012.system.id.goog/resources/aiplatform/projects/9876543210/locations/us-central1/reasoningEngines/translator-agent" ], "operation": { "permissions": ["iap.googleapis.com/resources.egressViaIAP"] }, "conditions": { "iap.googleapis.com": { "expression": "destination.agent_registry.endpoint.name == '/projects/9876543210/locations/us-central1/endpoints/translation-service'" } } } ] } }To create the policy, run the following
curlcommand:curl -X POST \ "https://iam.googleapis.com/v3beta/projects/PROJECT_ID/locations/global/accessPolicies?accessPolicyId=POLICY_NAME" \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "Content-Type: application/json" \ -d @agent-access-policy.json
Replace the following:
PROJECT_ID: the project IDPOLICY_NAME: the policy name
To activate the policy, bind the Access policy to your project.
Agent-to-endpoint CEL attributes
The following table describes the CEL attributes that you can use in an agent-to-endpoint policy condition:
| Attribute | Details | ||||||
|---|---|---|---|---|---|---|---|
destination.agent_registry.endpoint.name |
|
Create an agent-to-unregistered endpoint Access policy
An agent-to-unregistered endpoint policy allows an agent to access external, third-party APIs and endpoints that aren't registered in Agent Registry.
Console
To create an agent-to-unregistered endpoint policy in the Google Cloud console, do the following:
-
In the Google Cloud console, go to the Policies page:
- In the project selector, select the project that contains the agent gateways that will use the Access policy.
-
In Policy details, select a policy or create a new one. If
you're creating a new policy, enter a policy name—for example,
allow-ocr-api-access. -
In Add Rules, configure the rule:
- Rule description:
Allow POST access to external OCR service - Rule effect: Allow
- Select principals: Select the agent principal (for example,
my-ae-agent). - Select resource(s): Select Standard > Unregistered endpoint.
- Conditions: Click the Custom tab.
- In the condition editor, enter:
destination.unregistered.host.endsWith('example-ocr.com') && destination.unregistered.path.startsWith('/v2/process') && destination.unregistered.method == 'POST'
- Rule description:
- To save the rule, click Save.
- To create the policy, click Create.
To activate the policy, bind the Access policy to your project.
gcloud
The following example shows an Access policy that allows an agent to
access an unregistered endpoint with a path that starts with /v2/process and
ends with example-ocr.com:
[
{
"description": "Allow POST access to unregistered OCR endpoint",
"effect": "ALLOW",
"principals": [
"principal://iam.googleapis.com/projects/9876543210/locations/global/workloadIdentityPools/POOL_ID/subject/ns/default/sa/my-ae-agent"
],
"operation": {
"permissions": ["iap.googleapis.com/resources.egressViaIAP"]
},
"conditions": {
"iap.googleapis.com": {
"expression": "destination.unregistered.host.endsWith('example-ocr.com') && destination.unregistered.path.startsWith('/v2/process') && destination.unregistered.method == 'POST'"
}
}
}
]
Replace the following:
POOL_ID: the workload identity pool ID. Depending on your pool type, format the ID as follows:- Google-managed pool:
PROJECT_ID.svc.id.goog - Self-managed pool:
POOL_NAME.global.POOL_HOST_PROJECT_NUMBER.workload.id.goog
To activate the policy, bind the Access policy to your project.
REST API
To create an Access policy that allows an agent to access an unregistered
endpoint with a path that starts with /v2/process and ends with example-ocr.com,
do the following:
Save the following to a JSON-formatted policy file named
agent-access-policy.json:{ "details": { "rules": [ { "description": "Allow POST access to unregistered OCR endpoint", "effect": "ALLOW", "principals": [ "principal://iam.googleapis.com/projects/9876543210/locations/global/workloadIdentityPools/POOL_ID/subject/ns/default/sa/my-ae-agent" ], "operation": { "permissions": ["iap.googleapis.com/resources.egressViaIAP"] }, "conditions": { "iap.googleapis.com": { "expression": "destination.unregistered.host.endsWith('example-ocr.com') && destination.unregistered.path.startsWith('/v2/process') && destination.unregistered.method == 'POST'" } } } ] } }To create the policy, run the following
curlcommand:curl -X POST \ "https://iam.googleapis.com/v3beta/projects/PROJECT_ID/locations/global/accessPolicies?accessPolicyId=POLICY_NAME" \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "Content-Type: application/json" \ -d @agent-access-policy.json
Replace the following:
POOL_ID: the workload identity pool ID. Depending on your pool type, format the ID as follows:- Google-managed pool:
PROJECT_ID.svc.id.goog - Self-managed pool:
POOL_NAME.global.POOL_HOST_PROJECT_NUMBER.workload.id.goog PROJECT_ID: the project IDPOLICY_NAME: the policy name
To activate the policy, bind the Access policy to your project.
Agent-to-unregistered endpoint CEL attributes
The following table describes the CEL attributes that you can use in an agent-to-unregistered endpoint policy condition:
| Attribute | Details | ||||||
|---|---|---|---|---|---|---|---|
destination.unregistered.host |
|
||||||
destination.unregistered.path |
|
||||||
destination.unregistered.method |
|