AGENT SKILL

ADK 智能体代码编写

google-agents-cli-adk-code

当用户想要"编写智能体代码"、"使用 ADK 构建智能体"、"添加工具"、"创建回调"、"定义智能体"、"使用状态管理",且项目需要 ADK(Agent Development Kit)API 模式与代码示例时,应使用本技能。它提供智能体类型、工具定义、编排模式、回调、状态管理、图工作流 API(graph Workflow API)以及可供学习的参考配方(reference recipes)的快速参考。请勿用于脚手架搭建(请使用 google-agents-cli-scaffold)或部署(请使用 google-agents-cli-deploy)。

适用职业AI 工程师
使用场景智能体开发
License 许可
Apache-2.0
所属仓库
google/agents-cli
最近更新
2026-11-12
Stars
★ 6.3k
Forks
731

01 前言 Front Matter

name
google-agents-cli-adk-code
metadata
{ "author": "Google", "license": "Apache-2.0", "version": "1.14.0", "requires": { "bins": [ "agents-cli" ], "install": "uv tool install google-agents-cli" } }
description
This skill should be used when the user wants to "write agent code", "build an agent with ADK", "add a tool", "create a callback", "define an agent", "use state management" — in a project that needs ADK (Agent Development Kit) API patterns and code examples. It provides a quick reference for agent types, tool definitions, orchestration patterns, callbacks, state management, the graph Workflow API, and reference recipes to study. Do NOT use for scaffolding (use google-agents-cli-scaffold) or deployment (use google-agents-cli-deploy).

02 资源文件 6

03 SKILL.md 正文

ADK Code Reference

Activate /google-agents-cli-workflow first.

1. Study Recipes (No Project Needed)

Python — read the topic index in references/recipes.md before answering "how do I build X". Worked implementations exist for: sandboxed/per-user code execution, agent-loadable SKILL.md skills, cross-session memory, approval gates before risky actions, tool guardrails, per-user credentials, and scheduled/event-driven runs.

Go — read the upstream examples/. clone the repo and read the one matching the capability you need before implementing it.

2. Prerequisites for Writing Code

Do NOT write agent code until a project is scaffolded.

  1. Verify project: run agents-cli info (proceed if config exists).
  2. No project: load /google-agents-cli-workflow and agree the spec with the user (its Phase 0) before you scaffold.
  3. Existing code: run agents-cli scaffold enhance ..

Quick Reference — Most Common Patterns

See references/adk-python.md and references/adk-go.md for Python and Go code examples, respectively.


References

Use the cheatsheets for common patterns. For deep knowledge, fetch the docs index or inspect the installed package.

Reference Language When to read
references/recipes.md Python Topic-indexed catalog of ADK reference recipes. Read in workflow Phase 1 — before scaffolding and before writing code — maps a capability to the recipe that implements it.
references/adk-python.md Python Core ADK API: Agent, tools, callbacks, plugins, state, artifacts, multi-agent systems, SequentialAgent / ParallelAgent / LoopAgent, custom BaseAgent, ManagedAgent (server-hosted first-party agents), A2A protocol, A2UI. Default for most agents.
references/adk-python-workflows.md Python Graph-based Workflow API (ADK Python 2.0): nodes, edges, fan-out/fan-in, HITL, parallel processing. Use when you need explicit graph topology.
references/adk-python-live.md Python Live and voice agents: Runner.run_live, LiveRequestQueue, model and regional availability, voice/speech_config, VAD, session limits, /run_live serving. Use for real-time voice or video agents.
references/adk-go.md Go Core ADK Go API: llmagent, tools, callbacks, plugins, state, artifacts, multi-agent systems, sequential/parallel/loop agents, custom agents, the runner, serving over HTTP, A2A protocol, and ambient triggers. Default for most agents.
references/adk-go-workflows.md Go Graph-based Workflow API: nodes, edges, fan-out/fan-in, HITL, parallel processing. Use when you need explicit graph topology.
examples/ Go Runnable upstream programs — the closest thing to a recipe catalog for Go.
curl https://adk.dev/llms.txt Python Docs index (every page title + URL). Fetch it, then WebFetch the specific page for anything beyond the cheatsheets.
Installed ADK package Python Exact signatures and symbols — inspect the source (see "Inspecting ADK Source Code" in references/adk-python.md).

Related Skills

  • /google-agents-cli-workflow — Development workflow, coding guidelines, and operational rules
  • /google-agents-cli-scaffold — Project creation and enhancement with agents-cli scaffold create / scaffold enhance
  • /google-agents-cli-eval — Evaluation methodology, dataset schema, and the eval-fix loop
  • /google-agents-cli-deploy — Deployment targets, CI/CD pipelines, and production workflows

04 同仓库更多 Skills

google
google/agents-cli

ADK 智能体开发工作流

google-agents-cli-workflow

当用户想要“开发智能体”“使用 ADK 构建智能体”“在本地运行智能体”“调试智能体代码”“测试智能体”“部署智能体”“发布智能体”“监控智能体”,或需要 ADK(Agent Development Kit,智能体开发工具包)开发生命周期与编码规范时,应使用本技能。它是构建 ADK 智能体的入口。始终处于激活状态——提供完整工作流(搭建脚手架、构建、评估、部署、发布、观测)、代码保留规则、模型选择指南,以及 ADK 或任何智能体开发的故障排查步骤。

AI 工程师智能体开发
★ 6.3k
google
google/agents-cli

agents-cli 智能体项目脚手架

google-agents-cli-scaffold

当用户想要“创建智能体项目”、“启动新的 ADK 项目”、“帮我构建一个新智能体”、“为项目添加 CI/CD”、“添加部署”、“增强我的项目”或“升级我的项目”时,应使用本技能。属于 agents-cli 技能套件。涵盖 `agents-cli scaffold create`、`scaffold enhance` 和 `scaffold upgrade` 命令、模板选项、部署目标以及原型优先(prototype-first)的工作流程。请勿用于编写智能体代码(ADK 项目请使用 google-agents-cli-adk-code)或部署操作(请使用 google-agents-cli-deploy)。

AI 工程师智能体开发
★ 6.3k
google
google/agents-cli

agents-cli 智能体发布与注册

google-agents-cli-publish

当用户想要“发布智能体”、“发布我的 ADK 智能体”、“向 Gemini 注册智能体”、“发布到 Gemini”(原 Gemini Enterprise),或需要了解 agents-cli publish gemini 命令的用法时,应使用本技能。当用户想要“在 Agent Registry 中管理智能体”、“列出/更新/删除已注册智能体”或“注册 MCP 服务器”时也应使用。涵盖 ADK 与 A2A 两种注册模式、编程式与交互式用法、参数(flag)说明、从部署元数据自动检测、Agent Registry 机群管理以及故障排查。属于 agents-cli 技能套件。请勿用于部署(部署请使用 google-agents-cli-deploy)。

AI 工程师部署与发布管理
★ 6.3k
google
google/agents-cli

Agents CLI 智能体可观测性

google-agents-cli-observability

当用户想要『设置追踪(tracing)』『监控我的智能体』『配置日志记录』『添加可观测性』『调试生产流量』,或需要有关监控已部署智能体(包括 ADK(Agent Development Kit)智能体)的指导时,应使用本技能。涵盖 Cloud Trace、提示-响应日志(prompt-response logging)、BigQuery Agent Analytics、第三方集成(AgentOps、Phoenix、MLflow 等)和故障排查。属于 agents-cli 技能套件。不用于部署设置(使用 google-agents-cli-deploy)或 API 代码模式(使用 google-agents-cli-adk-code)。

AI 工程师运维监控与告警
★ 6.3k
google
google/agents-cli

Agents CLI 智能体评估

google-agents-cli-eval

当用户想要『运行评估』『评估我的智能体』『评估我的 ADK 智能体』『编写评估数据集』『分析评估失败』『比较评估结果』『优化智能体』,或需要有关 Gemini 平台评估方法论和质量飞轮(Quality Flywheel)的指导时,应使用本技能。涵盖评估指标、数据集模式(schema)、LLM 作为评判者(LLM-as-judge)评分和常见失败原因。适用于任何 agents-cli 项目,无论智能体用何种框架编写。不用于智能体 API 代码模式(ADK:使用 google-agents-cli-adk-code)、部署(使用 google-agents-cli-deploy)或项目脚手架(使用 google-agents-cli-scaffold)。

AI 工程师AI 模型评估与基准测试
★ 6.3k
google
google/agents-cli

Agents CLI 智能体部署

google-agents-cli-deploy

当用户想要『部署智能体』『部署我的 ADK 智能体』『设置 CI/CD』『配置密钥(secrets)』『排查部署故障』,或需要有关 Agent Runtime、Cloud Run 或 GKE 部署目标,或将智能体绑定到 Agent Gateway 的指导时,应使用本技能。涵盖部署工作流、服务账号、回滚和生产基础设施。适用于 agents-cli 部署的任何框架(ADK、LangChain 等)。属于 agents-cli 技能套件。不用于智能体 API 代码模式(ADK:使用 google-agents-cli-adk-code)、评估(使用 google-agents-cli-eval)或项目脚手架(使用 google-agents-cli-scaffold)。

AI 工程师部署与发布管理
★ 6.3k