google-agents-cli-publish
它能做什么
这项技能指导把已部署的智能体注册到 Gemini 应用和 Agent Registry。适合希望自己的智能体出现在 Gemini 中并可供使用的开发者。
适用场景
- ✓当你的智能体已部署,并想把它注册到 Gemini 时。
- ✓当你想在 Agent Registry 中列出、更新或删除智能体时。
- ✓当你想为智能体注册 MCP 服务器的时候。
技能链接
https://github.com/google/agents-cli/blob/main/skills/google-agents-cli-publish/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请把我已部署的 ADK 智能体注册到 Gemini,让用户可以在 Gemini 应用中使用它。”
每周 5 个新技能,1 分钟读完。
工作原理
这项技能会先检查智能体已部署且可以访问,然后使用 agents 命令行工具进行注册。对于 Agent Runtime,它会读取部署详情文件,自动找到该智能体。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Gemini Registration
Requires: A deployed agent. For Agent Runtime in Gemini platform,
deployment_metadata.json(created byagents-cli deploy) enables auto-detection. For Cloud Run or GKE, provide the agent card URL and flags directly.
Prerequisites
- Agent must be deployed — the agent must be running and reachable
- Gemini app must exist — Create one in the Google Cloud console before registering
deployment_metadata.json(Agent Runtime only) — Created automatically byagents-cli deploy; contains the Agent Runtime ID, deployment target, the A2A flag, and the agent directory- Text-based agent — Live/voice (bidi) agents are not supported by the Gemini app, which has no
/run_livetransport. Register a text-based agent instead.
Required Permissions for A2A on Cloud Run
roles/run.servicesInvokergranted to the Discovery Engine service account (service-<PROJECT_NUMBER>@gcp-sa-discoveryengine.iam.gserviceaccount.com) on the Cloud Run service.
Registration Modes
A2A Registration
Every scaffolded agent serves the Agent-to-Agent protocol. A2A is the default — and only — registration type on Cloud Run and GKE (no reasoning engine to invoke natively). It also works on Agent Runtime via --registration-type a2a. For an ADK agent there the CLI warns against it, because the Gemini app can invoke Agent Runtime natively via :streamQuery — prefer ADK registration in that case. For an agent built on another framework there is no ADK app to invoke natively, so A2A is the right mode on every target and the warning is expected. Pass the agent card URL and the command fetches the card and registers it; display name and description default to the card's name/description.
# A2A on Cloud Run / GKE. The card path depends on the project's language:
# Python -> /a2a/{app_name}/.well-known/agent-card.json
# Go -> /.well-known/agent-card.json
agents-cli publish gemini \
--agent-card-url https://my-service-abc123.us-east1.run.app/a2a/app/.well-known/agent-card.json \
--gemini-app-id projects/123456/locations/global/collections/default_collection/engines/my-app
Pass --display-name / --description to override the card defaults. On Agent Runtime, the card URL auto-builds from deployment_metadata.json if you omit --agent-card-url.
ADK Registration (default on Agent Runtime)
ADK projects only. The agent must be deployed to Agent Runtime as an ADK app, since registration invokes it through
:streamQuery. An agent on another framework registers over A2A, so deploy it to Cloud Run or GKE and publish from there.
This is the default and recommended registration for ADK agents on Agent Runtime: the Gemini app invokes the agent natively via :streamQuery on its reasoning engine resource, authenticating end-to-end. Under the hood, :streamQuery dispatches to the AdkApp's streaming_agent_run_with_events method — when debugging an ADK invocation, search the runtime's reasoning_engine_stderr logs for that method name to trace the failure. It's also the path to use when the agent needs an OAuth authorization (--authorization-id). The agent is registered directly via its reasoning engine resource name; no agent card URL is needed.
agents-cli publish gemini \
--registration-type adk \
--agent-runtime-id projects/123456/locations/us-east1/reasoningEngines/789 \
--gemini-app-id projects/123456/locations/global/collections/default_collection/engines/my-app \
--display-name "My Agent" \
--description "Handles customer queries" \
--tool-description "Answers questions about products"
Programmatic Mode (CI/CD)
The command is non-interactive by default — pass all required values via flags or environment variables. This makes it safe for CI/CD pipelines.
Via flags
agents-cli publish gemini \
--agent-runtime-id "$AGENT_RUNTIME_ID" \
--gemini-app-id "$GEMINI_APP_ID" \
--display-name "Production Agent" \
--registration-type adk
Via environment variables
Most flags have an env var alternative (--metadata-file, --interactive, and --list do not):
export AGENT_RUNTIME_ID="projects/123456/locations/us-east1/reasoningEngines/789"
export GEMINI_APP_ID="projects/123456/locations/global/collections/default_collection/engines/my-app"
export GEMINI_DISPLAY_NAME="Production Agent"
export GEMINI_DESCRIPTION="Handles customer queries"
agents-cli pub
常见问题
注册前必须满足什么条件?
智能体必须已经部署并可以访问,并且 Cloud 控制台中必须已经存在 Gemini 应用。
它支持实时语音智能体吗?
不支持。描述中说明,不支持实时或语音智能体,因此需要基于文本的智能体。
在 Cloud Run 上需要额外权限吗?
需要。Discovery Engine 服务账号需要有调用 Cloud Run 服务的权限。
详情
作者的原始描述
This skill should be used when the user wants to "publish an agent", "publish my ADK agent", "register an agent with Gemini", "publish to Gemini" (formerly Gemini Enterprise), or needs guidance on the agents-cli publish gemini command. Also use when the user wants to "manage agents in Agent Registry", "list/update/delete registered agents", or "register an MCP server". Covers ADK vs A2A registration modes, programmatic and interactive usage, flag reference, auto-detection from deployment metadata, Agent Registry fleet management, and troubleshooting. Part of the agents-cli skills suite. Do NOT
repo: google/agents-cli
热度
- GitHub 星标
- 6.3k
- 排名
- #14372
- 许可证
- Apache-2.0
- 更新时间
- 2026/10/27
评论
- …
同一仓库的更多技能
google-agents-cli-adk-code
6.3k帮你的智能体使用 Google ADK 为 AI 智能体编写代码,包括工具、回调、状态和编排模式。
google-agents-cli-deploy
6.3k帮你的智能体把 AI 智能体部署到 Google Cloud,涵盖 Agent Runtime、Cloud Run、GKE、密钥、CI/CD 和故障排查。
google-agents-cli-eval
6.3k帮你的智能体用测试数据集和评分来评估 AI 智能体,并找出回答出错的原因。
google-agents-cli-observability
6.3k帮你的智能体为已部署在 Google Cloud 上的 AI 智能体设置追踪、日志和监控,让你看到它在做什么。