Extensions — override or extend agents-cli
An extension overrides or adds a built-in command. It's a directory containing an agents-cli-extension.yaml, so any git repo can serve as a registry.
Two things you can do: author an extension (start ad-hoc in the current repo, publish it later), or adopt an existing one.
Author an ad-hoc extension (no separate repo)
Drop a single file, agents-cli-extension.yaml, at the project root (next to agents-cli-manifest.yaml). It's auto-loaded at project scope, so no extension add is needed. Commit it and teammates and CI get the same overrides.
Only one, at that exact path, and always project scope. For a second one, or to install a local extension globally, move it into its own directory and agents-cli extension add local@./path --global; #name picks one out of a directory holding several.
Publish it for other repos: move the same file (and its scripts) into its own git repo and tag it — others then agents-cli extension add <org>/<repo>#<name> --ref v1.0.0. The file doesn't change; ad-hoc and shared are the same format.
Schema by example (agents-cli-extension/v1alpha1)
Everything below is optional except run on a command (a non-empty list). Unknown keys are rejected, so a typo fails loudly instead of silently doing nothing.
Machine-readable equivalent: schemas/agents-cli-extension-v1alpha1.schema.json in the agents-cli repo, generated from the same models the loader uses. Point a yaml-language-server modeline at it for editor validation.
# yaml-language-server: $schema=https://raw.githubusercontent.com/google/agents-cli/main/schemas/agents-cli-extension-v1alpha1.schema.json
schema: agents-cli-extension/v1alpha1
name: my-extension
description: What this extension does.
requires:
agents_cli: ">=1.3,<2" # example - derive from `agents-cli --version`, see below
on_incompatible: warn # warn (install + warn) | error (refuse at add/update, block its commands if the CLI drifts out)
commands:
override: # replace a built-in; user argv passes through verbatim
deploy:
run: ["uv", "run", "scripts/custom_deploy.py"]
description: SBOM upload, then the built-in deploy.
eval.generate: # dotted name = a subcommand (group.sub)
run: ["uv", "run", "scripts/eval_generate.py"]
description: Framework-specific inference runner.
add: # a brand-new command that doesn't exist yet
compliance-report:
run: ["python", "scripts/compliance_report.py"]
description: Generate the quarterly compliance report.
Rules that matter
Adopt an existing extension
agents-cli extension add <ref> [--global] [--ref <branch|tag|sha|:latest>] [--yes]
agents-cli extension list # what's active, its scope, and its commands
agents-cli extension update [<name>] [--to <branch|tag|sha|version|:latest>] # advance or move the pin and replace its skills
agents-cli extension remove <name> [--global] # drop it, its vendored copy, and skills no other scope uses
agents-cli info # shows active extensions + sources + conflicts
Reference forms
| Form | Meaning |
|---|
acme/acli-extensions | any org/repo on github.com |
acme/acli-extensions#soc2-deploy | select one extension from a multi-extension repo |
https://git.example.com/acme/acli-extensions | any git host — https://, http:// or ssh:// |
git@git.example.com:acme/acli-extensions | the same host, in scp form |
local@../my-extension | a local path (for development) |
pypi@acme-extensions | the newest release of a package on PyPI or your package index |
pypi@acme-extensions==1.2.0 | a specific release of that package |
pypi@acme-extensions==1.2.0#core/soc2 | select one extension from a multi-extension package |
google/agents-cli-extensions#core/<name>/template | a first-party extension, such as core/langchain/template |
<name> | deprecated first-party shorthand for an extension in the google/agents-cli repo; use google/agents-cli-extensions#core/<name>/template instead |
--ref <branch|tag|sha> | pin a branch, tag, or commit SHA of a git reference |
--ref :latest | pin the latest release, as the shorthand does without --ref (shorthand and pypi@ only) |
A URL is cloned with your ambient git configuration, so whatever already authenticates you to that host (credential helper, ssh agent) applies — agents-cli neither asks for nor stores credentials.
A pypi@ reference installs an extension from a wheel:
- The index is the first of
UV_DEFAULT_INDEX, UV_INDEX_URL, PIP_INDEX_URL that is set, else PyPI. Credentials in the index URL go only to that host.
- The version goes in the reference (
==<version>); --ref doesn't apply.
- Without
#<folder>, the wheel's root extension or its only extension is used; when it holds several, the error lists the references to pick from.
- With
#<folder>, <folder>/template/ is used when <folder>/ itself holds no extension (#core/langchain selects core/langchain/template/).
- The wheel is only read, never built, so installing runs no package code.
An extension changes commands. To run a different agent framework, scaffold from that framework's template instead (agents-cli create my-agent --agent <org>/<repo>@<tag> --deployment-target <target>); the template carries its own agents-cli-extension.yaml, so nothing is installed machine-wide.
Scopes
- Project scope (default) — committed to this repo only (recorded in
agents-cli-extensions.yaml, working copy vendored under extensions/), so it can't affect your other projects and CI/teammates get it. Commit both files so it works offline (install re-fetches if missing — see Pinning and updates).
- User scope (
--global) — ~/.config/agents-cli/. Applies to every project on the machine, and works before a project exists (e.g. to apply an override before a project exists). Because a global override changes commands everywhere, prefer project scope unless you truly want it machine-wide.
- When both scopes define the same command, project wins;
agents-cli info shows the source.
Trust
- Extensions from
google/agents-cli, google/agents-cli-extensions and google/adk-recipes are trusted automatically at a release tag (vX.Y.Z). The shorthand form (extension add <name>) pins one by default; --ref main, another branch, a commit, or an org/repo/URL without --ref prompts.
- The
pypi@google-agents-cli-extensions package is trusted automatically at any version when it comes from the PyPI index.
- Every other reference — any other repo or URL, any other
pypi@ package, and a local path — prompts before install (its commands run arbitrary code when invoked). --yes skips the prompt (blanket trust — use only for automation/bootstrap).
Pinning and updates
extension add resolves the reference to an exact pin and records it under extensions: in agents-cli-extensions.yaml (its own file at both scopes, so the writer can never touch your project manifest), vendoring a working copy under extensions/.
- A git entry records
source / ref / sha; sha is the commit.
- A
pypi@ entry records source / version / sha; source holds the ==<version> pin, version is that release, and sha is the wheel's sha256.
agents-cli install fetches any missing vendored copy from the pinned SHA — CI and fresh checkouts get the exact reviewed code, command overrides and skills. It never advances a pin.
- It never replaces an existing git or
pypi@ copy. If the copy's stamp file doesn't match the pin, it warns and leaves the copy and its skills alone: delete the copy and rerun install to use the pin, or run extension update <name> --to <ref> to move it. A local@ copy is re-copied when its source changed. A symlink or file at a copy's path is always left alone.
- It also deletes the skills of extensions that are no longer recorded.
- It deletes none when an extension list for that skills folder cannot be fully read, or when the project's or the user's
.agents/skills folder is reached through a link.
- A project whose
.agents folder links to ~/.agents is protected only while install runs in that project. install in another project can delete its skills from ~/.agents/skills, and install in that project brings them back.
- A skill folder with a
.agents-cli-extension file belongs to the extension: extension add, extension update and agents-cli install replace it whole. To change a skill, copy its folder under a new name.
extension update [name] re-resolves pins, re-prompting for third-party trust, and replaces the extension's skills with the new version's. If the new skills cannot be installed, it keeps the old pin. Nothing updates in the background.
- A git extension advances to the latest commit of the same tracked ref (e.g. a branch); a pinned tag/SHA re-resolves to itself.
- A
pypi@ extension stays on its ==<version> pin.
--to moves the named extension's pin: a git extension to a branch, tag, or SHA; a pypi@ extension to a release (--to 1.3.0 or --to ==1.3.0).
--to :latest moves a first-party extension to the latest release that is not newer than your agents-cli, and a pypi@ extension to the newest release on its index; without a name it moves every first-party and pypi@ extension and skips the rest. It records the release it picked, so run it again to pick up later releases.
extension remove <name> [--global] drops the entry and deletes the working copy and the skills it owns. It removes from one scope per call: project before user without --global, user scope only with --global. If the home folder is a project and the extension is still installed at both scopes, remove keeps the shared skills until the other scope is removed too.
Tracking a version:
agents-cli extension add acme/acli-extensions#soc2 --ref v1.2.0 # pin a tag (recommended)
agents-cli extension add acme/acli-extensions#soc2 --ref main # follow a branch
agents-cli extension update soc2 # advance within the tracked ref
agents-cli extension update soc2 --to v1.3.0 # move to another tag
agents-cli extension add acme/acli-extensions#soc2 --ref v1.2.0 # roll back the same way
A failed re-add rolls back to nothing rather than to the previous pin, so re-add the old ref to
restore it.