Claude Platform's 'ant' CLI Brings the Full Claude API to Your Terminal
Anthropic's Claude Platform documents 'ant', a command-line tool that exposes every Claude API resource as a subcommand. It sends Messages requests, browses responses, version-controls agents and environments, and runs a self-hosted Managed Agents worker, with Claude Code able to drive it natively.
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, version-control agents and environments, and run a self-hosted Managed Agents worker -- all without hand-writing JSON or reaching for curl (Claude Platform CLI docs).
The tool was surfaced via a ClaudeDevs announcement on June 2, 2026 (ClaudeDevs). The durable details below come from the official Claude Platform documentation, which is the source of truth for what the CLI actually does.
What the 'ant' CLI Is
The ant CLI is a terminal client for the Claude API. According to the docs, "every API resource is exposed as a subcommand, with output formatting, response filtering, and support for YAML or JSON file input that make it practical for both interactive exploration and automation" (CLI docs).
Compared with calling the API by hand with curl, ant lets you build request bodies from typed flags or piped YAML instead of hand-written JSON, inline file contents into string fields with an @path reference, and extract fields from the response with a built-in --transform query -- no separate JSON tooling required. List endpoints paginate automatically, and Claude Code understands how to drive ant natively (CLI docs).
Sending Your First Request
The docs' first example is a plain Messages API call. Commands follow a resource action pattern, with nested resources separated by colons (CLI docs):
ant messages create \
--model claude-opus-4-8 \
--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; and repeatable flags like --tool build arrays (CLI docs).
Authentication and Workspaces
ant offers two ways to authenticate. ant auth login runs a browser-based OAuth flow against the Claude Console and stores credentials locally; on a remote host you pass --no-browser to paste the code back into the terminal. Alternatively, the CLI reads your key from the ANTHROPIC_API_KEY environment variable (CLI docs).
An interactive-login token is bound to a single workspace. To work across workspaces you log in under named profiles and switch between them with ant profile activate or a per-command --profile flag. ant auth status reports which credential source and workspace won, which is the documented way to diagnose a wrong-workspace call (CLI docs).
Reshaping and Browsing Output
The CLI is built to compose with shell tooling. --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 (CLI docs).
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. For browsing large responses interactively, --format explore opens a fold-and-search TUI (CLI docs).
Version-Controlling API Resources
A second documented workflow is keeping API resources -- skills, agents, environments, deployments -- in your repository as YAML and syncing them with the Claude API in CI. You write an agent definition to a .agent.yaml file, create it with ant beta:agents create < summarizer.agent.yaml, and update it later with the agent ID and current version as flags (CLI docs).
ant beta:agents create < summarizer.agent.yaml
The same pattern applies to environments, after which you start a session targeting the environment, send a user message with ant beta:sessions:events send, and read the conversation back with ant beta:sessions:events list (CLI docs).
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 -- run by the ant CLI or an Anthropic SDK -- claims items from the queue, spawns an execution context, downloads the agent's skills, runs the tool calls, and posts the results back (self-hosted sandboxes).
VERSION=1.10.0
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m | sed -e 's/x86_64/amd64/' -e 's/aarch64/arm64/')
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) 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). Anthropic notes the ant CLI supports the always-on polling pattern only; the SDK additionally supports a webhook-triggered handler (self-hosted sandboxes).
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 . |
--on-work | Script to call per claimed work item instead of running tools in-process |
--unrestricted-paths | Allow tool calls to access paths outside --workdir |
--max-idle | How long to wait after the session goes idle before shutting down; defaults to 60s |
--log-format | Log output format; use json for structured ingestion |
Driving 'ant' From Claude Code
Claude Code knows out of the box how to use ant. With the CLI installed and authenticated, you can ask Claude Code to operate on your API resources directly -- for example, "List my recent agent sessions and summarize which ones errored" or "Upload every PDF in ./reports to the Files API and print the resulting IDs." Claude Code shells out to ant, parses the structured output, and reasons over the results with no custom integration code (CLI docs).
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, it turns API resources into version-controllable YAML you can sync 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 -- a single long-running process that needs only outbound HTTPS, no inbound firewall rules, and no custom agent loop. 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 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 finer programmatic control over per-session sandboxing (self-hosted sandboxes).
Availability
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, so those Managed Agents capabilities are in beta, not general availability (CLI docs).
| Item | Status |
|---|---|
ant CLI for the Claude API | Documented; messages, models, and other core resources callable directly |
Managed Agents resources (beta: namespace) | Beta (anthropic-beta header sent automatically) |
ant self-hosted worker | Documented; always-on polling pattern only |
| Webhook-triggered worker | SDK only (Python, TypeScript, Go) |
Sources
- ClaudeDevs announcement post (June 2, 2026): https://x.com/ClaudeDevs/status/2061877343078244459
- Claude Platform docs, "CLI": https://platform.claude.com/docs/en/api/sdks/cli
- Claude Platform docs, "Self-hosted sandboxes": https://platform.claude.com/docs/en/managed-agents/self-hosted-sandboxes
- 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
Read next
Keep building the workspace playbookClaude 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 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. Every API resource is exposed as a subcommand, so you can send Messages requests, list models, manage files, and operate Managed Agents resources directly from your terminal.
Can 'ant' call the Messages API from the terminal?
Yes. The docs show 'ant messages create' with a model, max-tokens, and a message body built from typed flags or piped YAML. The full response prints as JSON, and you can reshape it with a GJSON --transform query.
How do you authenticate the 'ant' CLI?
You can run 'ant auth login' for a browser-based OAuth flow against the Claude Console, or set the ANTHROPIC_API_KEY environment variable. 'ant auth status' reports which credential source and workspace are active.
Are the agent commands generally available?
The agents, sessions, environments, and skills commands sit under the 'beta:' namespace and send the appropriate anthropic-beta header automatically, so those Managed Agents features are in beta. Core resources like messages and models are not gated behind the beta prefix.