設定 Agent Registry

如要在 Agent Registry 註冊及探索 AI 代理、Model Context Protocol (MCP) 伺服器、獨立技能和端點,必須在 Google Cloud 專案啟用 Agent Registry API。啟用 Agent Registry 的專案會做為管理專案。透過代理程式註冊資料庫管理專案,您可以自動探索在該專案中部署的支援工作負載,並手動註冊託管於獨立 Google Cloud 專案、地端部署環境或外部雲端的遠端元件。

事前準備

如要設定 Agent Registry,請使用現有專案或建立新專案。

必要的角色

如要取得設定 Agent Registry 所需的權限,請要求管理員在 Google Cloud 專案中授予您下列 IAM 角色:

如要進一步瞭解如何授予角色,請參閱「管理專案、資料夾和組織的存取權」。

您或許也能透過自訂角色或其他預先定義的角色,取得必要權限。

設定 Google Cloud CLI 環境

如要使用 gcloud CLI 執行 Agent Registry,請按照下列步驟操作:

  1. 在 Google Cloud 控制台啟用 Cloud Shell。

    啟用 Cloud Shell

    Google Cloud 控制台底部會開啟 Cloud Shell 工作階段,並顯示指令列提示。Cloud Shell 是已安裝 Google Cloud CLI 的殼層環境,並已設定適用於您目前專案的值。工作階段可能要幾秒鐘的時間才能初始化。

  2. 使用 gcloud components update 指令,將 gcloud CLI 更新至最新版本:

    gcloud components update
    
  3. 如要使用預先發布版功能,請使用 gcloud components install 指令安裝 alpha 元件:

    gcloud components install alpha
    

啟用 Agent Registry API

控制台

啟用 API 所需的角色

您必須具備 serviceusage.services.enable 權限,才能啟用 API。如果您建立了專案,可能已透過「擁有者」角色 (roles/owner) 取得這項權限。否則,您可以透過「Service Usage 管理員」角色 (roles/serviceusage.serviceUsageAdmin) 取得這項權限。瞭解如何授予角色。

啟用 API

gcloud

使用 gcloud services enable 指令,在專案中啟用 Agent Registry API:

gcloud services enable agentregistry.googleapis.com \
    --project=PROJECT_ID

將 PROJECT_ID 替換為您的專案 ID。

啟用 Agent Registry API 後,即可開始在這項專案註冊及探索代理。

授予權限

如要查看及管理代理登錄檔中的資源,您必須授予使用者適當的 Identity and Access Management (IAM) 權限。

請將下列一或多個 Agent Registry 角色授予使用者:

  • Agent Registry API 檢視者 (roles/agentregistry.viewer):查看及搜尋代理、MCP 伺服器、工具、獨立技能、技能修訂版本、發布者、端點和繫結。
  • Agent Registry API 編輯者 (roles/agentregistry.editor):查看及編輯 Agent Registry 資源,包括註冊、更新和刪除代理、MCP 伺服器、工具、端點、獨立技能和技能修訂版本。
  • Agent Registry API 管理員 (roles/agentregistry.admin):可對 Agent Registry 資源執行所有動作,包括註冊及管理代理、MCP 伺服器、工具、端點、獨立技能、技能修訂版本、繫結和技能 IAM 政策。
  • Agent Registry 使用者 (roles/agentregistry.user):可查看所有 Agent Registry 資源,以及建立、更新和刪除獨立技能和技能修訂版本,但無法編輯代理、MCP 伺服器或端點。

如要瞭解如何授予專案的 IAM 角色,請參閱「管理專案、資料夾和組織的存取權」。

變更 Agent Registry 專案

如要變更使用 Agent Registry 的專案,並移除舊專案的依附元件,請在舊專案中停用 Agent Registry API。在舊專案中停用 Agent Registry API 後,即可在其他專案中啟用。您的資料不會遷移,您必須在這個新專案中重新建立資源。

停用 Agent Registry API

如果不想再使用 Agent Registry,請在專案中停用 Agent Registry API:

控制台

  1. 前往 Google Cloud 控制台的 Agent Registry API 管理頁面:

    前往 Agent Registry API

  2. 在專案挑選器中,選取您設定 Agent Registry 的 Google Cloud 專案。

  3. 點選「停用 API」。

  4. 在確認對話方塊中,點選「停用」。

gcloud

使用 gcloud services disable 指令,在專案中停用 Agent Registry API:

gcloud services disable agentregistry.googleapis.com \
    --project=PROJECT_ID

將 PROJECT_ID 替換為專案 ID。

後續步驟