Claude Platform's 'ant' CLI Brings the Full Claude API to Your Terminal
Anthropic's 'ant' CLI exposes every Claude API resource as a terminal subcommand. As of September 2026 you install it through Homebrew, curl, or Go, authenticate by browser login, API key, or Workload Identity Federation, manage agents as code with 'ant apply' (CLI 1.30.0 or later), and run a self-hosted Managed Agents worker with 'ant beta:worker poll' or 'ant beta:worker run'.
Anthropic's Claude Platform documents ant, a command-line tool that brings the full Claude API to your terminal. Every API resource is exposed as a subcommand, so ant can send Messages requests, list models, upload files, manage agents and environments as code, and run a self-hosted Managed Agents worker, all without hand-writing JSON or reaching for curl (CLI quickstart).
The tool was surfaced through a ClaudeDevs post on June 2, 2026 (ClaudeDevs); the first tagged release on GitHub, v1.10.0, is dated May 28, 2026 (GitHub releases). The durable details below come from the official Claude Platform documentation, re-read on September 11, 2026. Since this page first published, Anthropic split the single CLI page into a five-page section, added Homebrew and Go install routes, added Workload Identity Federation and named profiles, replaced the pipe-YAML-into-create workflow with ant apply, and documented a second worker entrypoint for per-session sandboxes. Each change is folded in below.
Key Takeaways
antis a terminal client for the Claude API:ant <resource>[:<subresource>] <action> [flags], with typed flags or piped YAML for request bodies and a GJSON--transformfor responses.- Install through
brew install anthropics/tap/ant, a curl download from the GitHub releases (the docs pin 1.30.0; the newest tag on September 10, 2026 is v1.32.0), orgo install. - Authenticate with
ant auth login(browser OAuth, one workspace per profile),ANTHROPIC_API_KEY, or Workload Identity Federation for CI and servers. ant applymanages agents, environments, skills, memory stores, and deployments as files with a plan and aclaude-lock.json; it needs CLI 1.30.0 or later and--yesin CI.- Managed Agents resources stay in beta: the
beta:namespace sends themanaged-agents-2026-04-01header for you. - The self-hosted worker runs as
ant beta:worker poll(always-on) orant beta:worker run(one sandbox per session, driven by--on-work); the webhook-triggered pattern is SDK-only.
What the 'ant' CLI Is
The ant CLI is a terminal client for the Claude API. The quickstart puts it in one sentence: "Every API resource is exposed as a subcommand, with output formatting, response filtering, and YAML or JSON file input" (CLI quickstart). The docs now live in a "CLI, SDKs, and libraries" section alongside client SDKs for Python, TypeScript, C#, Go, Java, PHP, and Ruby (overview), split across a quickstart, an authentication page, a "Using the CLI" reference, a scripting page, and the ant apply page.
Compared with calling the API by hand with 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, and extracts fields from the response with a built-in --transform query, so you do not need jq. List endpoints paginate automatically (CLI quickstart), and Claude Code can use ant out of the box (CLI scripting and automation).
Installing and Sending Your First Request
The docs give three install routes (CLI quickstart):
| Route | Command |
|---|---|
| Homebrew (macOS) | brew install anthropics/tap/ant |
| curl (Linux/WSL) | Download ant_<version>_<os>_<arch>.tar.gz from the GitHub releases; the docs pin VERSION=1.30.0 |
| Go | go install github.com/anthropics/anthropic-cli/cmd/ant@latest (Go 1.25 or later) |
The newest tag on the releases page on September 10, 2026 is v1.32.0; 1.30.0, released September 3, is the floor for ant apply (GitHub releases; ant apply). ant @completion zsh|bash|fish|powershell generates shell completion scripts.
The docs' first example is a plain Messages API call. Commands follow a resource action pattern, with nested resources separated by colons (Using the CLI):
ant messages create \
--model claude-opus-5 \
--max-tokens 1024 \
--message '{role: user, content: "Hello, Claude"}'
The response is the full API object, pretty-printed when stdout is a terminal. Scalar fields map to flags; structured fields accept a relaxed YAML-like syntax or strict JSON; repeatable flags like --tool build arrays; and a piped JSON or YAML document supplies the whole body, with flags taking precedence over stdin (Using the CLI).
Authentication and Workspaces
ant auth login runs a browser-based OAuth flow against the Claude Console and stores credentials under $ANTHROPIC_CONFIG_DIR; on a remote host you pass --no-browser and paste the code back. --workspace-id wrkspc_... binds the login to a workspace and skips the picker, and --profile <name> creates a named profile. The CLI also reads ANTHROPIC_API_KEY, with --api-key for a single invocation and ANTHROPIC_BASE_URL or --base-url for a different host (CLI authentication options).
Anthropic draws a line between the two: "Interactive login is intended for local development and scripting on your own machine. For non-interactive workloads such as CI, servers, and containers, use Workload Identity Federation instead" (CLI authentication options). An Admin API session takes a dedicated profile with --scope "org:admin", and ant auth print-credentials --access-token prints a bearer token for curl calls.
An interactive-login token is bound to a single workspace. To work across workspaces you log in under named profiles and switch with ant profile activate, a per-command --profile, or ANTHROPIC_PROFILE. One rule to remember: "Profiles are only consulted when no API key is set", so ANTHROPIC_API_KEY in the environment overrides every profile. ant auth status reports which credential source and workspace won; it reports status rather than performing a health check, so do not script against its exit status (CLI authentication options).
Reshaping and Browsing Output
--format selects the output shape (auto, json, jsonl, yaml, pretty, raw, or explore), and --transform filters or reshapes a response with a GJSON path. On list endpoints the transform runs against each item rather than the pagination envelope. The interactive explorer, a fold-and-search TUI, is now the default for list and retrieve commands in a terminal: "List and retrieve commands default to the interactive explorer when writing to a terminal, and to pretty-printed JSON when piped", so pass --format auto or --format jsonl to get text in a terminal (Using the CLI).
ant beta:agents list \
--transform "{id,name,model}" \
--format jsonl
Pairing --transform id with --raw-output prints a bare ID with no quotes, ready to assign to a shell variable or pipe into head and xargs. --debug prints the full HTTP request and response to stderr with the API key redacted, and --format-error and --transform-error apply the same filtering to error responses (Using the CLI; CLI scripting and automation).
Version-Controlling API Resources
The documented way to keep agents, environments, skills, memory stores, and deployments in your repository is now ant apply. You write each resource as a file (an agent is a Markdown file with frontmatter for its configuration and the body as its system prompt), run ant apply, approve the plan, and commit the claude-lock.json it writes so the next run updates the same resources instead of creating new ones. It "requires CLI version 1.30.0 or later", and in CI you pass --yes because without a terminal it stops with cannot ask for confirmation without a terminal; re-run with --yes to apply, or --dry-run to see the plan only (ant apply). Our ant apply write-up covers the plan, lockfile, and CI workflow.
ant apply agents/summarizer.md
The earlier pattern this page described, piping a YAML file into ant beta:agents create, still runs, but the two do not mix: "ant apply can't adopt a resource you created in the Console or with ant beta:agents create. Only what's in the lockfile is managed, and applying a file that describes an existing agent creates a second one" (ant apply). Once the agent and environment exist, you start a session with ant beta:sessions create, send a user message with ant beta:sessions:events send, and read the conversation back with ant beta:sessions:events list, or watch it live with ant beta:sessions:events stream (CLI scripting and automation).
Running a Self-Hosted Managed Agents Worker
Beyond ad-hoc API calls, ant ships a pre-built worker for Claude Managed Agents running in a self_hosted environment. Managed Agents is Anthropic's pre-built harness for long-running, asynchronous work; the self_hosted environment moves tool execution onto your own infrastructure while orchestration stays on Anthropic's side (self-hosted sandboxes).
In that setup the environment acts as a work queue. When a session is assigned to it, Anthropic enqueues the session as a work item. A worker claims items from the queue, downloads the agent's skills, runs the tool calls, and posts the results back. Two patterns exist, and the CLI covers one: "The ant CLI supports the always-on pattern only; the SDK supports both always-on and webhook-triggered" (self-hosted sandboxes).
VERSION=1.30.0
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
ant beta:worker poll --workdir "/workspace"
The worker authenticates to its queue with an environment key (ANTHROPIC_ENVIRONMENT_KEY, generated in the Console only) and targets an environment ID (ANTHROPIC_ENVIRONMENT_ID); your separate Claude API key is used from outside the worker host to create sessions and read queue stats (self-hosted sandboxes).
For stronger isolation the docs add a second entrypoint, ant beta:worker run. You build an image with ant installed and ant beta:worker run as the entrypoint, then run the poller with --on-work ./spawn.sh; the poller injects ANTHROPIC_SESSION_ID, ANTHROPIC_WORK_ID, ANTHROPIC_ENVIRONMENT_ID, and ANTHROPIC_ENVIRONMENT_KEY into the spawn script and writes the claimed work item to its standard input as JSON, so each session gets a fresh sandbox. One limit: "The ant beta:worker run entrypoint does not mount memory stores"; sessions that attach memory stores need the SDK worker inside the per-session image (self-hosted sandboxes). A separate security model page now sets out the shared-responsibility split for self-hosted environments.
Worker Flags
The reference documents the flags for ant beta:worker that control where work runs and how the process behaves (Managed Agents reference):
| Flag | Purpose |
|---|---|
--environment-id | Environment to poll for work (also reads ANTHROPIC_ENVIRONMENT_ID) |
--environment-key | Authenticates the worker (also reads ANTHROPIC_ENVIRONMENT_KEY) |
--workdir | Directory where skills download and tools read/write; defaults to ., and the system default working directory is /workspace |
--on-work | Script to call per claimed work item instead of running tools in-process; receives session details as environment variables |
--unrestricted-paths | Allow the file tools to read and write paths outside --workdir; the docs note this check "is a guardrail for the file tools only, not a sandbox; it does not constrain bash" |
--max-idle | How long to wait after the session goes idle with an end_turn stop reason before shutting down; defaults to 60s |
--log-format | Log output format; json for structured ingestion, defaults to text |
Driving 'ant' From Claude Code
Claude Code can use ant out of the box. With the CLI installed and authenticated, you can ask Claude Code to operate on your API resources directly; the docs' examples are "List my recent agent sessions and summarize which ones errored", "Upload every PDF in ./reports to the Files API and print the resulting IDs", and "Pull the events for session session_01... and tell me where the agent got stuck". As the scripting page puts it, "Claude Code shells out to ant, parses the structured output, and reasons over the results (no custom integration code required)" (CLI scripting and automation).
Why It Matters
ant lowers the floor for working with the Claude API. For interactive exploration, it replaces curl plus jq with typed flags and a built-in --transform. For automation, ant apply turns API resources into reviewable files with a lockfile you can reconcile from CI. And for teams that need agent tool execution to stay inside their security perimeter, the same binary runs a self-hosted Managed Agents worker, either as a single long-running poller that needs only outbound HTTPS or as a per-session sandbox entrypoint. It pairs with the broader self-hosted-sandbox push Anthropic shipped in May 2026 (self-hosted sandboxes and MCP tunnels).
Reach for ant when you want a terminal-native Claude API client, resources-as-code with ant apply, or the simplest always-on Managed Agents worker. Reach for an Anthropic SDK (Python, TypeScript, or Go) when you need the webhook-triggered worker pattern or memory stores inside a per-session sandbox (self-hosted sandboxes).
Availability
As of September 11, 2026, core resources such as messages and models are called directly. Beta resources (agents, sessions, deployments, environments, and skills) live under the beta: prefix, and commands in that namespace automatically send the appropriate anthropic-beta header. The overview is explicit: "Claude Managed Agents is in beta. All Managed Agents endpoints require the managed-agents-2026-04-01 beta header" (Managed Agents overview; Using the CLI).
| Item | Status (September 11, 2026) |
|---|---|
ant CLI for the Claude API | Documented; newest GitHub release v1.32.0 (September 10, 2026); messages, models, and other core resources callable directly |
ant apply (resources as code) | Documented; requires CLI 1.30.0 or later |
Managed Agents resources (beta: namespace) | Beta (managed-agents-2026-04-01 header sent automatically) |
ant beta:worker poll | Documented; always-on polling pattern |
ant beta:worker run | Documented; per-session sandbox entrypoint, no memory-store mounts |
| Webhook-triggered worker | SDK only (Python, TypeScript, Go) |
Sources
- ClaudeDevs post (June 2, 2026): https://x.com/ClaudeDevs/status/2061877343078244459 (on September 11, 2026 the URL returned a JavaScript shell with none of the post text; the announcement date rests on this post alone, and every other claim on this page rests on the docs and releases below)
- Claude Platform docs, "CLI quickstart" (the former
api/sdks/cliURL redirects here): https://platform.claude.com/docs/en/cli-sdks-libraries/cli/quickstart - Claude Platform docs, "CLI authentication options": https://platform.claude.com/docs/en/cli-sdks-libraries/cli/authentication
- Claude Platform docs, "Using the CLI": https://platform.claude.com/docs/en/cli-sdks-libraries/cli/using
- Claude Platform docs, "CLI scripting and automation": https://platform.claude.com/docs/en/cli-sdks-libraries/cli/scripting
- Claude Platform docs, "Manage resources as code with ant apply": https://platform.claude.com/docs/en/cli-sdks-libraries/cli/apply
- Claude Platform docs, "CLI, SDKs, and libraries" overview: https://platform.claude.com/docs/en/cli-sdks-libraries/overview
- Claude Platform docs, "Self-hosted sandboxes": https://platform.claude.com/docs/en/managed-agents/self-hosted-sandboxes
- Claude Platform docs, "Security model" (self-hosted sandboxes): https://platform.claude.com/docs/en/managed-agents/self-hosted-sandboxes-security
- Claude Platform docs, "Reference" (self-hosted worker CLI flags): https://platform.claude.com/docs/en/managed-agents/reference
- Claude Platform docs, "Claude Managed Agents overview": https://platform.claude.com/docs/en/managed-agents/overview
- GitHub, anthropics/anthropic-cli releases (v1.10.0 May 28, 2026; v1.30.0 September 3, 2026; v1.32.0 September 10, 2026): https://github.com/anthropics/anthropic-cli/releases
Read next
Related coverage- Claude
Claude's ant CLI Can Now Manage Agent Resources as Code
Anthropic added `ant apply` to the Claude CLI, letting teams declare Managed Agent environments, agents, skills, memory stores, and deployments in a repository and reconcile them with the Claude API.
- Claude
Claude Managed Agents Add Self-Hosted Sandboxes (Public Beta) and MCP Tunnels (Research Preview)
Anthropic says Claude Managed Agents can now run tool execution in a sandbox you control (public beta) and connect to private MCP servers via MCP tunnels (research preview). The update targets enterprise security requirements by keeping execution and private services within an organization's perimeter.
- Claude Code
Claude Code adds dynamic workflows (research preview) for large parallel agent runs
Dynamic workflows in Claude Code let Claude write orchestration scripts, fan out work across tens to hundreds of parallel subagents, verify results, and resume long-running jobs.
Frequently Asked Questions
What is the 'ant' CLI?
It is Anthropic's command-line tool for the Claude API, documented on the Claude Platform under CLI, SDKs, and libraries. Every API resource is exposed as a subcommand, so you can send Messages requests, list models, upload files, and operate Managed Agents resources directly from your terminal.
How do you install the 'ant' CLI?
As of September 2026 the docs give three routes: 'brew install anthropics/tap/ant' on macOS, a curl download of the release tarball from the anthropics/anthropic-cli GitHub releases on Linux (the docs pin 1.30.0), or 'go install github.com/anthropics/anthropic-cli/cmd/ant@latest' with Go 1.25 or later.
How do you authenticate the 'ant' CLI?
Run 'ant auth login' for a browser-based OAuth flow against the Claude Console, or set ANTHROPIC_API_KEY. For CI, servers, and containers, Anthropic's docs point to Workload Identity Federation instead. Named profiles hold one workspace each, and 'ant auth status' reports which credential source and workspace won.
What is 'ant apply'?
It creates and updates agents, environments, skills, memory stores, and deployments from files in your repository, shows a plan, and writes a claude-lock.json so later runs update the same resources. It requires CLI 1.30.0 or later and cannot adopt resources created in the Console or with 'ant beta:agents create'.
Are the agent commands generally available?
No. As of September 2026, Claude Managed Agents is in beta, and the agents, sessions, environments, deployments, and skills commands sit under the 'beta:' namespace, sending the managed-agents-2026-04-01 header automatically. Core resources such as messages and models are not gated behind the beta prefix.