为 Workspace MCP 入口设置 Agent Gateway

支持此功能的版本:Gemini Enterprise。

您可以配置 Google Cloud 云项目,以通过数据连接器连接到 Google Workspace MCP 服务器,并启用选择性加入的 Agent Gateway 和 Workspace 政策决策点 (PDP),以便对这些项目进行 Workspace 治理。

通过 Agent Gateway 设置 Workspace PDP 后,AI 智能体(例如 Gemini Enterprise 智能体)便可访问 Workspace 应用数据(例如 Google 云端硬盘),同时强制执行直接在 Google 管理控制台中配置的访问权限控制政策。

前提条件

在设置 Agent Gateway 之前,您需要满足以下条件:

  • 已启用 Gemini Enterprise 的 Google Cloud 云项目。
  • 经过身份验证的 gcloud CLI,有权在您的 Google Cloud 项目中启用 API 并管理网络服务、网络安全和服务扩展资源。
  • Google Workspace 管理员权限(安全管理员权限)。
  • 查看了如何在 Google Cloud 中设置 Agent Gateway。

第 1 步:创建或选择 Google Cloud 项目

  1. 在 Google Cloud 控制台中,新建一个 Google Cloud 云项目或选择一个现有项目进行此设置,并记下您的项目 ID(例如 my-project-id)。

第 2 步:启用所需的网络和安全 API

使用 gcloud 或 Cloud 控制台在 Google Cloud 项目中启用 Network Services API 和 Network Security API:

gcloud services enable networkservices.googleapis.com \
                       networksecurity.googleapis.com \
                       --project=PROJECT_ID

将 PROJECT_ID 替换为您的 Google Cloud 项目 ID。

第 3 步:启用 Agent Registry API 和 MCP

  1. 在 Google Cloud 控制台中,依次前往 API 和服务 然后 库。
  2. 搜索并启用 Agent Registry API (agentregistry.googleapis.com)。
  3. 启用 Google 云端硬盘 MCP 或工作流所需的其他 MCP 服务器。如需了解详情,请参阅注册 MCP 服务器。

重要提示:在启用选择性启用的 Agent Gateway 的情况下,Gemini Enterprise 仅将流量路由到标准的第一方 (1P) 和第三方 (3P) 数据连接器的网关。Workspace 数据治理不支持配置自定义数据连接器。

第 4 步:创建和导入 Agent Gateway 和授权资源

配置 Agent Gateway、授权扩展程序(Workspace 政策决策点)和授权政策资源。您可以使用 YAML 配置文件以声明方式定义这些资源,并使用 gcloud 导入它们:

  1. 创建 Agent Gateway 配置文件 (agent-gateway.yaml):

    name: AGENT_GATEWAY_NAME
    protocols:
    - MCP
    googleManaged:
      governedAccessPath: AGENT_TO_ANYWHERE
    registries:
      - //agentregistry.googleapis.com/projects/PROJECT_ID/locations/global
    

    将 AGENT_GATEWAY_NAME 替换为您的代理网关资源的名称(例如 ge-agent-gateway),并将 PROJECT_ID 替换为您的 Google Cloud 项目 ID。

  2. 创建指向工作区政策决策点 (ws-pdp-authz-extension.yaml) 的授权扩展程序配置文件:

    name: AUTHZ_EXT_NAME
    service: workspacepolicyengine.pa.googleapis.com
    failOpen: true
    timeout: 5s
    

    将 AUTHZ_EXT_NAME 替换为授权扩展服务的名称(例如 ws-pdp-authz-ext)。

  3. 创建授权政策配置文件 (ws-pdp-authz-policy.yaml),以将扩展程序与网关相关联:

    name: AUTHZ_POLICY_NAME
    target:
      resources:
      - "projects/PROJECT_ID/locations/LOCATION/agentGateways/AGENT_GATEWAY_NAME"
    policyProfile: CONTENT_AUTHZ
    action: CUSTOM
    customProvider:
      authzExtension:
        resources:
        - "projects/PROJECT_ID/locations/LOCATION/authzExtensions/AUTHZ_EXT_NAME"
    

    替换以下内容:

    • AUTHZ_POLICY_NAME:授权政策的名称(例如 ws-pdp-authz-policy)。
    • PROJECT_ID:您的 Google Cloud 项目 ID。
    • LOCATION:部署的区域(例如 us-central1)。
    • AGENT_GATEWAY_NAME:第 1 步中的代理网关的名称。
    • AUTHZ_EXT_NAME:第 2 步中的授权扩展程序名称。
  4. 使用 gcloud 导入 YAML 配置文件:

    # Import the Agent Gateway
    gcloud beta network-services agent-gateways import AGENT_GATEWAY_NAME \
      --source=agent-gateway.yaml \
      --location=LOCATION \
      --project=PROJECT_ID
    
    # Import the Authorization Extension
    gcloud beta service-extensions authz-extensions import AUTHZ_EXT_NAME \
      --source=ws-pdp-authz-extension.yaml \
      --location=LOCATION \
      --project=PROJECT_ID
    
    # Import the Authorization Policy
    gcloud beta network-security authz-policies import AUTHZ_POLICY_NAME \
      --source=ws-pdp-authz-policy.yaml \
      --location=LOCATION \
      --project=PROJECT_ID
    

第 5 步:验证 Agent Gateway 设置并获取资源名称

  1. 列出已部署的代理网关,以验证导入是否成功:

    gcloud beta network-services agent-gateways list --location=LOCATION --project=PROJECT_ID
    
  2. 描述 Agent Gateway 资源:

    gcloud beta network-services agent-gateways describe AGENT_GATEWAY_NAME --location=LOCATION --project=PROJECT_ID
    
  3. 复制完整的 Agent Gateway 资源名称(格式为 projects/PROJECT_ID/locations/LOCATION/agentGateways/AGENT_GATEWAY_NAME,例如 projects/my-project/locations/us-central1/agentGateways/ge-agent-gateway)。

第 6 步:连接到 Google Identity 提供方

  1. 在 Gen App Builder Engines 控制台中,依次前往设置 然后 身份验证。
  2. 将引擎连接到 Google 身份提供方。
  3. 如需查看其他文档,请参阅 Google Cloud 数据源访问权限控制。

第 7 步:在 Gemini Enterprise 实例中配置 Agent Gateway

  1. 在 Gemini Enterprise (GE) 实例中,前往关联的数据存储区。
  2. 在 MCP 服务器下,选择配置 Agent Gateway。
  3. 输入在第 5 步中获得的完整 Agent Gateway 资源名称(例如 projects/PROJECT_ID/locations/us-central1/agentGateways/ge-agent-gateway)。

第 8 步:在 Google 管理控制台中配置 Workspace 客服人员访问权限控制

设置 Agent Gateway 和 Workspace 政策决策点后,您可以直接在 Google 管理控制台中管理代理访问政策:

  1. 在 Google 管理控制台中,依次点击菜单图标 然后 智能体。
  2. 在设置标签页上,为所有 Gemini Enterprise 智能体配置默认访问权限政策。如需了解详情,请参阅控制对 Gemini Enterprise 代理的访问权限。
  3. 在智能体管理标签页上,将特定智能体添加到管理列表中,以配置个别访问权限(受信任或已屏蔽)。如需了解详情,请参阅为 Workspace 用户管理 Gemini Enterprise 智能体。