hf CLI adapts selected command output for coding agents
Introduced 2026-04-02 · score 0.97
HOW TO USE IT
When an agent needs parseable output from a migrated `hf` command, rely on auto-detection or pass `--format agent`, `json`, or `quiet`. Use `agent` for untruncated TSV, `json` for structured output, or `quiet` for IDs only.
hf models ls --limit 5 --format agenthf models ls --search bert --limit 2 --jsonhf models ls --limit 5 --format quietWHY THIS HELPS
Inspect Hub models, datasets, Spaces, papers, or authentication details from a coding-agent workflow that needs parseable CLI output.
BEFORE THIS CHANGE
The release note says output was designed for humans, with ANSI colors, padded tables, and truncated cells, making it harder for agents to parse.
REQUIREMENTS AND LIMITATIONS
- Version: v1.9.0
- --format <value>: Select output format. Documented values: `auto` (default), `human`, `agent`, `json`, `quiet`. `auto` selects agent output when invoked by an AI agent; `agent` produces untruncated TSV, `json` structured JSON, and `quiet` IDs only. The docs do not say these values are mutually exclusive; they describe one selected format.
- --json: Alias for `--format json`.
- -q, --quiet: Alias for `--format quiet`; prints IDs one per line.
- --limit INTEGER: Limit the number of results returned.
- --search TEXT: Filter model list by search query.
- Prerequisite: Install the `huggingface_hub` package or the standalone `hf` CLI installer to use the CLI.
- Automatic detection and migrated output behavior are described for the listed commands; more commands are to be migrated later.
FIRST-PARTY EVIDENCE
- https://github.com/huggingface/huggingface_hub/releases/tag/v1.9.0
- https://github.com/huggingface/huggingface_hub/pull/4015
- https://huggingface.co/docs/huggingface_hub/main/guides/cli
- https://github.com/huggingface/huggingface_hub/blob/main/docs/source/en/package_reference/cli.md
Check the installed version and the source before using it. Entry JSON