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 < 您的命令> 提供的 CLI 工作流程。 两个形状可以在同一扩展中共存,大多数非三角扩展使用两者的组合。
扩展通过Git寄存器而不是通过专用的包登记册来分配。 该设计借鉴了gemini-cli项目使用的扩展模型。 没有中央索引可以公布,没有软件包格式可以维持,也没有所有权名册可以申请。 任何Git寄存器内的任何目录都可以作为扩展,Git处理版本,pinning,和发行。 对于企业平台团队来说,这意味着创建一个内部平台扩展存储器并将其开发者对准它,没有外部登记册与之协调。
扩展可以多种方式引用,取决于其居住地点和开发者希望如何使用:
# 第一者短手,解决 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恢复了销售商的工作副本而无需推进针头,这保证了CI和本地开发运行比特对比特相同的代码。 为了在履带参考文献上推进最新承诺的标注,开发商运行了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 #自动加载的工程镜覆盖
Qagents-cli-manifest.yaml # 项目配置(部署目标等)
GEMINI.md#项目编码-agent指南
# LangGraph dev服务器配置
├── pyproject.toml # langchain,朗格法,langchain-google-genai
QQ Dockerfile # 与任何 ADK 项目相同的 CMD
QQ 应用程序/
QQ Qagent. py # 导出 root agent:编译状态图形
QQQ快速 api app.py #在A2A上曝光‘app:FastAPI'
QQ 应用程序/ 功能
# LangGraph Agent Executor 和 A2A 路线
#云迹和GenAI记录
• 脚本/
* 运行.py # 替换“ agents- cli 运行”
QQ eval generate.py # 滴入替换“ agents- cli eval 生成”
# # # # # 发布。 py # Agent - Runtime
测试/测试
eval/数据集/基本数据集.json
部署/# Terraform 基础设施模块
时间轴:
Qagents/技能/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 Atlas. All rights belong to the original author.