ant is Anthropic's official command-line tool for the Claude API. It has been referenced in passing across Anthropic's Managed Agents documentation for a while, always as the CLI-tab alternative next to curl and the language SDKs, but it hasn't had a guide of its own on this site. This one covers the full surface: installing it, authenticating, the command pattern every resource follows, and where it's actually a better fit than curl or an SDK script.
As of 25 August 2026 the latest release is v1.26.1 (19 August 2026), confirmed directly against the GitHub releases page and Anthropic's own CLI quickstart, which pins the same version number in its install example.
What ant actually is
Every resource the Claude API exposes, messages, models, files, and the beta Managed Agents surface (agents, sessions, environments, deployments, skills), is a subcommand. Compared to curl, ant builds request bodies from typed flags or piped YAML instead of hand-written JSON, inlines file contents into string fields with an @path reference, extracts response fields with a built-in transform so you don't need a separate tool such as jq, and paginates list endpoints automatically.
It's written in Go, MIT-licensed, and hosted at github.com/anthropics/anthropic-cli.
Installing ant
Three install routes, verified against Anthropic's own quickstart page:
# macOS, via Homebrew
brew install anthropics/tap/ant
# Linux or WSL, a release binary
VERSION=1.26.1
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
case $(uname -m) in
x86_64) ARCH=amd64 ;;
aarch64) ARCH=arm64 ;;
esac
curl -fsSL "https://github.com/anthropics/anthropic-cli/releases/download/v${VERSION}/ant_${VERSION}_${OS}_${ARCH}.tar.gz" \
| sudo tar -xz -C /usr/local/bin ant
# From source, needs Go 1.25 or later
go install github.com/anthropics/anthropic-cli/cmd/ant@latest
The go install route places the binary in $(go env GOPATH)/bin, which you may need to add to your PATH. All three routes work on macOS, Linux and Windows. Confirm the install with:
ant --version
Authenticating
ant auth login opens a browser-based OAuth flow against the Claude Console and stores the resulting credentials locally, so there's no API key to create or rotate for local development:
ant auth login
# On a remote host with no browser
ant auth login --no-browser
# Bind directly to a workspace and skip the picker
ant auth login --workspace-id wrkspc_01...
During the flow you pick an organisation and a workspace, and the issued token is scoped to that workspace, so the CLI only sees resources belonging to it. ant auth status reports which credential source and workspace are currently active, useful when a command reaches for the wrong one.
The alternative is the same ANTHROPIC_API_KEY environment variable every Claude API SDK reads:
export ANTHROPIC_API_KEY=sk-ant-api03-...
If the variable is set, it overrides any logged-in profile. For CI, servers and containers, Anthropic points to Workload Identity Federation instead of interactive login, since OAuth login is meant for a person at a terminal.
To work across more than one workspace, log in under a named profile per workspace and switch with ant profile activate <name>, or override for a single command with --profile or ANTHROPIC_PROFILE.
The command pattern: resource action
Every command follows the same shape:
ant <resource>[:<subresource>] <action> [flags]
ant models list
ant messages create --model claude-opus-5 --max-tokens 1024 ...
ant beta:agents retrieve --agent-id agent_01...
ant beta:sessions:events list --session-id session_01...
Resources still in beta, including agents, sessions, deployments and environments under Managed Agents, live under a beta: prefix. Commands in that namespace automatically send the right anthropic-beta header for you (currently managed-agents-2026-04-01 for most of that surface), so you don't pass it by hand. ant --help lists every resource; append --help to any subcommand for its flags.
Your first request
ant messages create \
--model claude-opus-5 \
--max-tokens 1024 \
--message '{role: user, content: "Hello, Claude"}'
{
"model": "claude-opus-5",
"id": "msg_01YMmR5XodC5nTqMxLZMKaq6",
"type": "message",
"role": "assistant",
"content": [{"type": "text", "text": "Hello! How are you doing today? Is there something I can help you with?"}],
"stop_reason": "end_turn",
"usage": {"input_tokens": 27, "output_tokens": 20}
}
Output is pretty-printed JSON when stdout is a terminal. List and retrieve commands instead open an interactive explorer, a fold-and-search TUI (arrow keys expand and collapse nodes, / searches, q exits), by default when connected to a terminal, falling back to pretty JSON when piped. Force either explicitly with --format, which accepts auto, json, jsonl, yaml, pretty, raw or explore.
Passing request bodies: flags, stdin, or a file
Which mechanism to use depends on the shape of the data:
Flags, for scalar fields and short structured values. Structured fields accept a relaxed YAML-like syntax or strict JSON:
ant beta:sessions create \
--agent '{type: agent, id: agent_011CYm1BLqPXpQRk5khsSXrs, version: 1}' \
--environment-id env_01595EKxaaTTGwwY3kyXdtbs \
--title "CLI docs test session"
Repeatable flags build arrays: each --tool appends one element.
Stdin, for nested or multiline bodies. A heredoc is the convenient form:
ant beta:agents create <<'YAML'
name: Research Agent
model: claude-opus-5
system: |
You are a research assistant. Cite sources for every claim.
tools:
- type: agent_toolset_20260401
YAML
Fields from stdin merge with flags, with flags taking precedence. Quote the heredoc delimiter (<<'YAML') to stop shell variable expansion inside the body.
File references, with @path to inline a file's contents into a string field:
ant beta:agents create \
--name "Researcher" --model '{id: claude-opus-5}' \
--system @./prompts/researcher.txt
ant detects the file type and base64-encodes binary files automatically. Force plain text with @file:// or force base64 with @data://. Escape a literal leading @ with a backslash.
Filtering output with --transform
--transform reshapes a response using a GJSON path, the CLI's built-in stand-in for a separate jq step. On list endpoints the transform runs against each item, not the envelope:
ant beta:agents list --transform "{id,name,model}" --format jsonl
{"id": "agent_011CYm1BLqPX...", "name": "Docs CLI Test Agent", "model": "claude-opus-5"}
{"id": "agent_011CYkVwfaEt...", "name": "Coding Assistant", "model": "claude-opus-5"}
Pair --transform with -r/--raw-output to pull a single field out as a plain string, ready to assign to a shell variable, exactly the pattern most Managed Agents scripting examples use to chain resource creation:
AGENT_ID=$(ant beta:agents create \
--name "My Agent" \
--model '{id: claude-opus-5}' \
--transform id --raw-output)
printf '%s\n' "$AGENT_ID"
# agent_011CYm1BLqPXpQRk5khsSXrs
--raw-output is not the same as --format raw: the former strips JSON quotes from a string result, the latter prints the raw response body without auto-pagination.
Add --debug to any command to print the exact HTTP request and response, with the API key redacted, when something isn't behaving as expected.
Where ant fits next to curl, the SDKs, and Claude Code
| Tool | What it's for |
|---|---|
curl | Hand-written requests against the raw HTTP API. No typing, no pagination, no output shaping. |
| A Claude API SDK (Python, TypeScript, and others) | Building an application that calls Claude. Full control, in your own language, inside your own process. |
ant | Scripting and one-off calls against the API from a terminal. Typed input, automatic pagination, built-in output filtering. Not a library you import. |
| Claude Code | An agentic coding assistant. It can call the Claude API for you as part of doing engineering work in a repository; it isn't a general Claude API client itself. |
If you're setting up Claude Managed Agents resources by hand, ant is generally the fastest way to create an agent, environment and session from a terminal without writing throwaway curl scripts, and every example on Anthropic's Managed Agents docs pages includes an ant tab alongside the SDKs.
Using ant with Agent Skills
ant skills create uploads a custom skill to your workspace and hands back the skill_* ID you reference from a Managed Agent's skills array:
ant skills create --file example_skill.zip
The skill is a zip of a SKILL.md plus any bundled scripts or references, the same folder structure covered in how to write your own agent skill. Anthropic's pre-built document skills (pptx, xlsx, docx, pdf) are already available in every workspace and don't need this step; it's only for skills you author yourself. As with any skill you didn't write, read SKILL.md and anything under scripts/ before uploading it to a workspace where it can run against real infrastructure. Our Agent Skills security guide covers what to check.
Shell completion
The CLI ships completion scripts for bash, zsh, fish and PowerShell:
# zsh
ant @completion zsh > "${fpath[1]}/_ant"
# bash
ant @completion bash > /etc/bash_completion.d/ant
# fish
ant @completion fish > ~/.config/fish/completions/ant.fish
Troubleshooting
ant picks the wrong workspace. Run ant auth status to see which credential source and workspace are active. If ANTHROPIC_API_KEY is set in your environment, it silently overrides any logged-in profile and every command uses that key's workspace regardless of --profile. Unset it before switching between profiles.
A structured flag value fails to parse. The relaxed YAML-like syntax still needs balanced braces and, for anything with a colon inside a string (a URL, for instance), quotes around the value. When in doubt, pipe a heredoc instead of fighting flag syntax.
--transform returns nothing on a list command. Confirm the path targets a field on each item, not the pagination envelope; on list endpoints the transform runs per item, not once against the whole response. --format raw is the one mode where it targets the envelope instead.
Go install fails. Check go version against the 1.25 floor; the source install has no fallback for older toolchains, and the release binary or Homebrew route is the fix if you can't upgrade Go locally.
Where to go next
Anthropic's own CLI quickstart, using the CLI and authentication pages are the primary references and cover scripting patterns this piece doesn't, including version-controlling API resources as YAML files. For the Managed Agents concepts ant scripts against, read Claude Managed Agents explained, and for running one on a schedule, see running a Claude Managed Agent on a schedule with scheduled deployments. If you're after the skill format itself rather than the API tooling around it, start at what are agent skills or browse the catalogue at getclaudeskills.com/skills.
Verified 25 August 2026 directly against Anthropic's CLI quickstart, using-the-CLI and authentication pages at platform.claude.com, the anthropic-cli GitHub repository's README, and its releases page (v1.26.1, 19 August 2026).
