Designing the hf CLI as an Agent-Optimized Way to Work with the Hub
The Hugging Face Hub's official command-line entrypoint, hf, has been rebuilt to optimize its use for both human users and coding agents.

['The hf CLI is the official command-line entrypoint to the Hugging Face Hub, allowing users to perform various tasks such as downloading and uploading models, datasets, and Spaces; creating and managing repositories, branches, tags, and pull requests; running Jobs on HF infrastructure; and managing Buckets, Collections, webhooks, and Inference Endpoints. While it was initially built for human users, it is now increasingly used by coding agents like Claude Code, Codex, and Cursor. In response, the hf CLI has been rebuilt to make it work seamlessly for both audiences.', "To optimize the hf CLI for coding agents, the Hugging Face team started tracking agent usage of the Hub in April 2026.
The CLI detects when a coding agent is driving it by reading environment variables set by the agents. This detection allows the CLI to shape its output according to the user's needs and attribute traffic to the agent driving it. The two largest coding agents by distinct users are Claude Code and Codex, which are also the agents used in the benchmarking tests.", 'The hf CLI has been designed to provide different outputs for humans and coding agents.
Humans expect rich terminal output with ANSI color, padded tables, and progress bars, while agents prefer a more compact and structured output that is easy to parse. The CLI now auto-detects agent use and renders commands differently without requiring a flag. For humans, it provides aligned tables truncated to fit the terminal, with color cues for status.
For agents, it provides complete records in TSV format, without ANSI codes or truncation.', 'The hf CLI also provides hints and guidance to both humans and agents. For humans, these hints are convenient suggestions for the next steps. For agents, they are actionable instructions that can be executed directly, reducing the number of steps needed to complete a task.
The CLI also handles errors and timeouts differently for agents, providing a clear error message and suggested fix instead of failing silently.', "To measure the efficiency of the hf CLI for coding agents, the Hugging Face team conducted benchmarking tests using two popular agents, Claude Code and Codex. The tests compared the performance of the hf CLI with curl and the Python SDK, and showed that the hf CLI uses significantly fewer tokens, especially for complex, multi-step tasks. The tests also demonstrated that the hf CLI's skill, a compact reference of the command surface, can help agents complete tasks more efficiently by reducing the number of tool calls.", 'The Hugging Face team encourages developers to use the hf CLI for their agents, as it provides a more efficient and effective way to interact with the Hub.
By using the hf CLI and its skill, agents can complete tasks more quickly and accurately, and developers can build more reliable and scalable applications. The team also invites developers to register their agent harnesses to help improve the detection and attribution of agent traffic on the Hub.']
Source: Hugging Face