OCT. 21, 2026 (英语).
结束新 Agents CLI 扩展系统的行走,并有一个工作好的 LangChain 实例和自定义部署政策
当我们发布 Agents CLI在Google Cloud Next '26时,我们围绕一个强烈的意见构建它:从一个想法到生产agent在Google Cloud上,应该取一个单一的统一指令表面。 对于使用Agent Development Kit(ADK)建设的团队来说,这种有见解的道路已经奏效了。 你运行agents-cli创建,写出agent逻辑,和飞船到云跑与可观察性,和evals wired上升,在大约30分钟。
agent框架景观在此后的几个月里变得更加多样化。 除了ADK之外,今天的开发者在LangChain和LangGraph之间取取,如深Agents等专业的新人,或针对特定商业领域定制的内部框架。 不同的团队更喜欢不同的框架,对绿地原型的正确选择很少是生产迁移的正确选择。 企业管理者也可能有他们希望对其所有开发团队执行的跨ADLC的治理政策,如:合规扫描,SSO门,模范风险管理跳。
一个团队能否从Agents CLI的部署,评价和可观察性工作中受益而不必被强迫采用ADK,也可以不被迫接受每个指令的默认行为?从1.5.0版本开始,答案是肯定的。 Agents CLI现在的飞船带有一个扩展系统,允许开发者在不伪造工具的情况下覆盖或添加命令。 版本 1.8.0 将首发方LangChain扩展,用其LangChain等同物来取而代之的框架相接指令,并让其余的生命周期未受影响。
我们从下面走两趟首先,用LangChain agents向您展示ADLC,我们将展示您如何利用先行扩展来通过Agents CLI生命周期来进行脚手架,运行,部署,以及评价LangChain agent. 然后,我们建造了自己的小扩展,将部署指令用一个软件模型(SBOM)扫描包起来,显示模式企业平台团队可以用来在每一个项目中执行自己的政策。 两次出行都使用同一种机制。
目前可用的大多数agent开发工具链都有一个局限性:它们对一个特定框架有看法,而周围的能力(部署目标、CI/CD管道、评价利用、可观察性接线)假定开发者采用了这一框架。 当您的框架与工具的假设相匹配时,有观点的路径会起作用。 当它没有,你留给三个坏选择。
首先是将CLI分叉出,保留了相去甚远的拷贝并重新在每一个上游发行上同步。 你支付永久的维护税,每一个上游的改进都必须被手提地地汇入分叉。 二是将CLI包裹在自定义脚本后,构建一个平行指令面来引用基础工具。 问题在于开发者(及其编码助理)忘记了包装并直接拨打基础工具,绕过所要的抽象。 第三是从零开始走开,从零开始建造一切,这可以消耗团队没有规划的几个工程工月,并且很少产生像上游工程那样被打磨出的工具。
问题显示在两种情况下上升。 一是企业客户采用Agents CLI:在被监管行业,一个中央平台团队经常要求每次部署引用都要用合规检查包裹,通过企业单一签注的登录路径,或者通过示范风险管理管道进行评价。 这些要求中,每一项在今天都得到落实,意味着要不是伪造CLI,就是要建造一个包装层。 另一个是大部分时间使用ADK的团队,但需要在特定项目上运行一个非ADK框架。 在Agents CLI指令表面内,有6个指令承担了ADK运行时间:操场,运行,以及4个eval子指令。 其他18个左右(脚手,以下,部署,发布,登录,和朋友)是框架不可知的。 没有扩展,为单一项目选择一个非ADK框架意味着失去全部24个访问权限。
扩展系统用一个机制来处理这两个问题。
Agents CLI扩展是一个Git寄存器中的目录,包含一个名为agents-cli-extension的单一文件。 雅姆尔。 文件声明哪个内建命令扩展名覆盖,哪个新命令它新增。 正式文件:
扩展是您如何将agents-cli适应一个它不携带——不同的agent框架,Org的部署政策,或者你自己的命令——而无需forking工具的工作流程。
扩展有两种形状,在"使用扩展"页面中描述。 命令会取代像操场、部署或eval生成这样的内置行为。 被推翻的命令收到用户的参数逐字,因此用户体验与本地命令保持一致。 一个新的命令会曝光目前没有作为 agents-cli <您的命令>提供的工作流程。 两个形状可以在同一扩展中并存,而大多数非三角扩展使用两者的组合。
扩展通过Git寄存器而不是通过专用的包登记册来分配。 该设计取自gemini-cli项目使用的扩展模型。 没有中央索引可以公布,没有软件包格式可以维护,也没有所有权名册可以申请。 任何Git寄存器内部的任何目录都可以作为扩展名,而Git处理版本,平起平起并发。 对于企业平台团队来说,这意味着创建一个内部平台扩展存储器并将其开发者指向它,没有外部登记册与之相协调。
扩展可以几种方式引用,取决于其居住地点和开发者希望如何使用:
# 第一者快手,解决了google/agents-cli寄存器
agents- cli 扩展名添加到 < name >
# GitHub 上的任何组织或仓库,包括自行托管的 Git 服务器
agents- cli 扩展添加 ACME/平面-扩展
agents- cli 扩展添加 ACME/ 平台- 扩展# soc2- 部署
# 本地路径,通常用于扩展开发
agents- cli 扩展添加本地@./我的扩展
纯文本
复制
QQname > 语法允许一个单一的Git寄存器持有多个扩展,由片段标识符选择其中之一。 企业平台寄存器常常将一个相关扩展的家族(一个用于部署,一个用于登录,一个用于脚手架创建)捆绑在一个共享所有权和释放cadence的单回波下。
扩展安装在两个瞄准镜上。 默认是项目范围,其中扩展及其锁文件条目被承诺给项目自己的寄存器。 队友和CI输油管在报到时取出。 替代品是用户范围,通过-global旗启用,其中扩展存储在用户的家用配置目录中并适用于机器上的每一项目。 用户范围是您在任何工程存在之前需要获得扩展时所达到的,例如配置 agents- cli 创建自身的框架靴子扩展。
当两个范围都定义了相同的指令时,项目范围获胜,而agents-cli信息会浮出每个活动指令的来源。 范围界定是故意明确的:扩展系统不会默默地合并或覆盖扩展,任何冲突都会在安装时间或扩展列表输出中向开发者出面。
扩展系统遵循uv或npm等包管理器的纪律:它解决了Git在安装时间对精确承诺的SHA的引用,将解析的SHA记录在一个锁文件上,并使用锁文件在每一次新鲜取出时将准确的被审查代码再做物质化。 agents-cli安装命令从被绑定的SHA恢复了被售出的工作副本而无需推进出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出出,出出出出出出出出出出入出出出出出出出出出出出出出出出出出出出出出出出出出出出出为了向有轨电车参考的最新承诺推进一针,开发者运行了agents-cli扩展更新,重新解析第三方信任的参考和再快。 整个生命周期在使用延长寿命段。
扩展系统在v1.8.0中被标记为实验。 在系统最终确定之前,显示的图案和命令表面仍然可能改变断裂方式,因此根据它而定的队伍应该将Agents CLI版本钉上。
LangChain先行扩展是一个项目模板:一个命令脚手架一个工作中的LangChain agent wired进入了Agents CLI生命周期。 由此而来的项目具有零google-adk依赖性,并被部署到Cloud Run通过ADK项目使用的同一条代码路径。 模板本身的描述如下:
运行 LangChain agents,LangGraph图,并深Agents通过agents-cli生命周期。
在现代的LangChain(1.0版及后版)中,状态管理层由LangGraph提供,因此三个框架共享了共同的图示。 该模板为三个社区提供相同的代码。
在开始之前,我们需要:
Python 3.11 或晚点
uV 软件包管理器
Google 云 SDK (克云)
Python
Google 时速还需要启用计费的云项目。 如果您还没有,可以在Coper.cloud.google.com创建。
如果Agents CLI尚未安装在开发机上,则可被安装在一个单一的命令上:
uvx google-agents- cli 设置
最后,我们用 Google Cloud 认证,并启用 APIs agent 在运行时间将依赖于:
gcloud auth 应用程序默认登录
gcloud 配置集工程您的 PROJECT ID
gcloud服务启用aiplatform.googleapis.com 运行.googleapis.com 文物资源.googleapis.com
脚手架和扩展安装是相同的操作。 我们不是先安装一个扩展,然后再安装一个脚手架,而是将agents-cli直接设定在扩展的模板上,并被固定在一个特定的放出标记上:
agents-cli 创建我的agent \
-agent google/agents-cli/扩展/langchain/template@v1.8.0\.
- 运行中
cd 我的agent agents-cli安装
输出确认脚手架成功:
Agents CLI v 1.8.0 (英语).
正在获取远程模板:google/agents-cli/extensions/langchain/template@v1.8.0
>正在验证 GCP 证书。..
> 连接到项目:您的项目
成功!成功吗?您的 agent 项目准备好了
脚手架工程已包含有 agents-cli-extension.yaml 在它的根部,在下次引用任何命令时,在项目范围上自动加载。 因为工程本身是扩展的安装,所以没有手动安装。 一个开发者脚手架LangChain项目不需要知道扩展系统的存在。 命令外观并感觉像原生的agents-cli创建引用,恰好产生LangChain项目而不是ADK项目。
这是脚手架制作的:
我的- agent/ (韩语)
agents-cli-extension.yaml #自动装入的工程-瞄准镜覆盖
agents-cli-manifest.yaml# 项目配置(部署目标等)
GEMINI.md#项目编码-agent指南
# LangGraph dev服务器配置
├── pyproject.toml#langchain,朗格法,langchain-google-genai
QQ Dockerfile # 与任何 ADK 项目相同的 CMD
应用程序/
agent.py # 导出 root agent:编译状态图形
#QQ快 api app.py #在A2A上曝光"app:FastAPI".
QQ 应用程序/ 设备
# LangGraph Agent 执行器和 A2A 路线
# Cloud Trace 和 GenAI 日志
脚本/
QQ跑.py # 滴入替换"agents-cli跑"
QQ eval generate.py # 滴入式替换为 “ agents- cli eval 生成 ”
# # # # 发布。 py # Agent - 运行时的拒绝包装
* 测试/
• eval/数据集/基本数据集。
部署/# Terraform 基础设施模块
时间轴:
.agents/技能/agents-cli-langchain/#项目自身编码-agent技能。
结构类似于ADK pro
本文由 AI宝盒自动抓取并翻译,版权归原作者所有;如需查看原文请点下方链接。
OCT. 21, 2026
End to end walkthrough of the new Agents CLI Extension System, with a worked LangChain example and a custom deploy policy
When we launched Agents CLI at Google Cloud Next '26, we built it around one strong opinion: going from an idea to a production agent on Google Cloud should take a single unified command surface. For teams building with Agent Development Kit (ADK), that opinionated path has worked. You run agents-cli create, write the agent logic, and ship to Cloud Run with observability and evals wired up, in about thirty minutes.
The agent framework landscape has grown more diverse in the months since. In addition to ADK, developers today pick between LangChain and LangGraph, specialized newcomers like Deep Agents, or in-house frameworks tailored to a specific business domain. Different teams prefer different frameworks, and the right choice for a greenfield prototype is rarely the right choice for a production migration. Enterprise admins may also have governance policies they want to enforce across the ADLC for all of their development teams, such as: a compliance scan, an SSO gate, a Model Risk Management hop.
Can a team benefit from the deployment, evaluation, and observability work in Agents CLI without being forced to adopt ADK, or without being forced to accept the default behavior of every command? Starting with version 1.5.0, the answer is yes. Agents CLI now ships with an Extension System that lets developers override or add commands without forking the tool. Version 1.8.0 ships the first-party LangChain extension, which replaces the framework-coupled commands with their LangChain equivalents and leaves the rest of the lifecycle untouched.
We will walk through two journeys below. First, to show you the ADLC with LangChain agents, we'll show you how you can scaffold, run, deploy, and evaluate a LangChain agent through the Agents CLI lifecycle using the first-party extension. Then we build our own small extension that wraps the deploy command with a Software Bill of Materials (SBOM) scan, demonstrating the pattern enterprise platform teams can use to enforce their own policies across every project. Both journeys use the same mechanism.
Most agent development toolchains available today share a limitation: they are opinionated about one specific framework, and the surrounding capabilities (deployment targets, CI/CD pipelines, evaluation harnesses, observability wiring) assume the developer has adopted that framework. When your framework matches the tool's assumption, the opinionated path works. When it does not, you're left with three bad options.
The first is to fork the CLI, maintaining a divergent copy and re-syncing it on every upstream release. You pay a permanent maintenance tax, and every upstream improvement has to be hand-merged into the fork. The second is to wrap the CLI behind custom scripts, building a parallel command surface that invokes the underlying tool. The problem is that developers (and their coding assistants) forget about the wrapper and call the underlying tool directly, bypassing the intended abstraction. The third is to walk away and build everything from scratch, which can consume several engineer-months of work that the team had not planned for, and which rarely produces tooling as polished as the upstream project.
The problem shows up in two scenarios. One is enterprise customers adopting Agents CLI: in regulated industries, a central platform team often requires that every deploy invocation be wrapped with a compliance check, that login route through corporate single sign-on, or that evaluations flow through a Model Risk Management pipeline. Each of these requirements, implemented today, means either forking the CLI or building a wrapper layer. The other is teams that use ADK most of the time but need to run a non-ADK framework on a specific project. Within the Agents CLI command surface, six commands assume the ADK runtime: playground, run, and four eval subcommands. The other eighteen or so (scaffold, infra, deploy, publish, login, and friends) are framework-agnostic. Without extensions, choosing a non-ADK framework for a single project meant losing access to all twenty-four.
The Extension System handles both with one mechanism.
An Agents CLI extension is a directory in a Git repository that contains a single file called agents-cli-extension.yaml. The file declares which built-in commands the extension overrides and which new commands it adds. From the official documentation:
Extensions are how you adapt agents-cli to a workflow it doesn't ship with — a different agent framework, an org's deploy policy, or a command of your own — without forking the tool.
Extensions take two shapes, described in the Using Extensions page. A command override replaces the behavior of a built-in like playground, deploy, or eval generate. The overridden command receives the user's arguments verbatim, so the user experience stays consistent with the native command. A new command exposes a workflow the CLI does not currently provide as agents-cli <your-command>. Both shapes can coexist in the same extension, and most non-trivial extensions use a combination of the two.
Extensions are distributed through Git repositories rather than through a dedicated package registry. The design draws from the extension model used by the gemini-cli project. There is no central index to publish to, no package format to maintain, and no ownership roster to apply for. Any directory inside any Git repository can serve as an extension, and Git handles the versioning, pinning, and distribution. For enterprise platform teams, this means creating an internal platform-extensions repository and pointing their developers at it, with no external registry to coordinate with.
An extension can be referenced in several ways, depending on where it lives and how the developer wants to use it:
# First-party shorthand, which resolves to the google/agents-cli repository
agents-cli extension add <name>
# Any organization or repository on GitHub, including self-hosted Git servers
agents-cli extension add acme/platform-extensions
agents-cli extension add acme/platform-extensions#soc2-deploy
# A local path, which is typically used during extension development
agents-cli extension add local@../my-extension
Plain text
Copied
The #<name> syntax lets a single Git repository hold multiple extensions, with the fragment identifier selecting one of them. Enterprise platform repositories often bundle together a family of related extensions (one for deploy, one for login, one for scaffold create) under a single repo with shared ownership and release cadence.
Extensions install at two scopes. The default is the project scope, where the extension and its lockfile entry are committed to the project's own repository. Teammates and CI pipelines pick it up on checkout. The alternative is the user scope, enabled via the --global flag, where the extension is stored in the user's home configuration directory and applies to every project on the machine. The user scope is the one you reach for when an extension needs to be available before any project exists, such as a framework bootstrap extension that configures agents-cli create itself.
When both scopes define the same command, the project scope wins, and agents-cli info surfaces the source of each active command. Scoping is deliberately explicit: the Extension System will not silently merge or override extensions, and any conflict surfaces to the developer at install time or in the extension list output.
The Extension System follows the discipline of package managers like uv or npm: it resolves a Git reference to an exact commit SHA at install time, records the resolved SHA in a lockfile, and uses the lockfile to re-materialize the exact reviewed code on every fresh checkout. The agents-cli install command restores the vendored working copy from the pinned SHA without advancing the pin, which guarantees that CI and local development run bit-for-bit identical code. To advance a pin to the latest commit on the tracked reference, the developer runs agents-cli extension update, which re-resolves the reference and re-prompts for third-party trust. The complete lifecycle is in the Using Extensions → Lifecycle section.
The Extension System is marked experimental in v1.8.0. The manifest schema and the command surface may still change in breaking ways before the system is finalized, so teams depending on it should pin their Agents CLI version.
The LangChain first-party extension is a project template: one command scaffolds a working LangChain agent wired into the Agents CLI lifecycle. The resulting project has zero google-adk dependency and deploys to Cloud Run through the same code path an ADK project uses. The template's own description reads:
Run LangChain agents, LangGraph graphs, and Deep Agents through the agents-cli lifecycle.
In modern LangChain (version 1.0 and later), the state management layer is provided by LangGraph, so the three frameworks share a common graph representation. The template serves all three communities with the same code.
Before we begin, we need:
Python 3.11 or later
uv package manager
Google Cloud SDK (gcloud)
Python
A Google Cloud project with billing enabled is also required. If you do not have one yet, it can be created at console.cloud.google.com.
If Agents CLI is not already installed on the development machine, it can be installed in a single command:
uvx google-agents-cli setup
Finally, we authenticate with Google Cloud and enable the APIs the agent will depend on at runtime:
gcloud auth application-default login
gcloud config set project YOUR_PROJECT_ID
gcloud services enable aiplatform.googleapis.com run.googleapis.com artifactregistry.googleapis.com
Scaffolding and extension installation are the same operation. Rather than installing an extension first and then scaffolding a project, we point agents-cli create directly at the extension's template, pinned to a specific release tag:
agents-cli create my-agent \
--agent google/agents-cli/extensions/langchain/template@v1.8.0 \
-d cloud_run
cd my-agent && agents-cli install
The output confirms the scaffold succeeded:
Agents CLI v1.8.0
Fetching remote template: google/agents-cli/extensions/langchain/template@v1.8.0
> Verifying GCP credentials...
> ✓ Connected to project: your-project
✅ Success! Your agent project is ready.
The scaffolded project already contains an agents-cli-extension.yaml at its root, which is auto-loaded at project scope the next time any command is invoked. There is nothing to install manually, because the project itself is the extension's installation. A developer scaffolding a LangChain project does not need to know the Extension System exists. The command looks and feels like a native agents-cli create invocation that happens to produce a LangChain project instead of an ADK one.
Here's what the scaffolder produced:
my-agent/
├── agents-cli-extension.yaml # auto-loaded project-scope overrides
├── agents-cli-manifest.yaml # project configuration (deployment target, etc.)
├── GEMINI.md # project's coding-agent guide
├── langgraph.json # LangGraph dev-server configuration
├── pyproject.toml # langchain, langgraph, langchain-google-genai
├── Dockerfile # identical CMD to any ADK project
├── app/
│ ├── agent.py # exports root_agent: CompiledStateGraph
│ ├── fast_api_app.py # exposes `app: FastAPI` on A2A
│ └── app_utils/
│ ├── a2a.py # LangGraphAgentExecutor and A2A routes
│ └── telemetry.py # Cloud Trace and GenAI logging
├── scripts/
│ ├── run.py # drop-in replacement for `agents-cli run`
│ ├── eval_generate.py # drop-in replacement for `agents-cli eval generate`
│ └── publish.py # Agent-Runtime-aware refusal wrapper
├── tests/
│ └── eval/datasets/basic-dataset.json
├── deployment/ # Terraform infrastructure modules
├── uv.lock
└── .agents/skills/agents-cli-langchain/ # the project's own coding-agent skill
The structure looks similar to an ADK pro
Auto-fetched and translated by AI Gem Box. All rights belong to the original author.