Designing the hf CLI as an agent-optimized way to work with the Hub Hugging Face redesigned its `hf` command-line interface to optimize it for AI coding agents, which now account for significant traffic on the Hub. The new CLI auto-detects when an agent is driving it and adjusts its output format accordingly, stripping ANSI colors and truncation to provide dense, structured data. Benchmarks show the agent-optimized CLI uses up to six times fewer tokens than a baseline approach using `curl` or the Python SDK, making it more efficient for complex, multi-step tasks. Designing the hf CLI as an agent-optimized way to work with the Hub Update on GitHub https://github.com/huggingface/blog/blob/main/hf-cli-for-agents.md hf is the official command-line entrypoint to the Hugging Face Hub. Anything you can do on the Hub from the Python SDK, you can do from your terminal: download and upload models, datasets and Spaces; create and manage repos, branches, tags and pull requests; run Jobs on HF infrastructure; manage Buckets, Collections, webhooks and Inference Endpoints. The hf CLI has been primarily built for our users over the years. But it's now increasingly used by coding agents : Claude Code, Codex, Cursor and more. So we rebuilt it to make it work for both audiences at once. This blog post summarizes what we did, and how we benchmarked it. We found that on complex, multi-step tasks the no-CLI baseline an agent hand-rolling curl or the Python SDK uses up to 6× as many tokens as the hf CLI. AI agent traffic on the Hub We started tracking agent usage of the Hub in April 2026. The hf CLI and the huggingface hub Python SDK it's built on detects when a coding agent is driving it by reading the environment variables agents set: CLAUDECODE / CLAUDE CODE for Claude Code, CODEX SANDBOX for Codex, plus Cursor, Gemini, Pi, and the universal AI AGENT . That single signal does two jobs: it shapes the CLI's output more on that below and it tags each Hub request with an agent/