github huggingface/huggingface_hub v1.9.0.rc0
[v1.9.0] Agent-Aware CLI, Spaces Volumes, and more

pre-release4 hours ago

🚀 Spaces Volumes: Mount Models, Datasets, and Buckets Directly

Hugging Face Spaces now support mounting volumes, giving your Space direct filesystem access to models, datasets, and storage buckets. This replaces the deprecated persistent storage feature.

from huggingface_hub import HfApi, Volume

api = HfApi()
api.set_space_volumes(
    repo_id="username/my-space",
    volumes=[
        Volume(type="model", source="username/my-model", mount_path="/models", read_only=True),
        Volume(type="bucket", source="username/my-bucket", mount_path="/data"),
    ],
)

Volumes can also be set at creation time via create_repo(space_volumes=...) and duplicate_repo(space_volumes=...), and from the CLI with the --volume / -v flag:

# Create a Space with volumes mounted
hf repos create my-space --type space --space-sdk gradio \
    -v hf://gpt2:/models -v hf://buckets/org/b:/data

# Duplicate a Space with volumes
hf repos duplicate org/my-space my-space --type space \
    -v hf://gpt2:/models -v hf://buckets/org/b:/data

🤖 The hf CLI Now Auto-Detects AI Agents and Adapts Its Output

AI coding agents (Claude Code, Cursor, Codex, Copilot, Gemini, ...) increasingly use the hf CLI to interact with the Hub. Until now, the output was designed for humans - ANSI colors, padded tables, emoji booleans, truncated cells - making it hard for agents to parse reliably.

Starting with v1.9, the CLI automatically detects when it's running inside an agent and adapts its output: no ANSI, no truncation, tab-separated tables, compact JSON, full timestamps. No configuration needed - it just works. This is only a first step toward making the hf CLI the primary entry point to the Hugging Face Hub for AI agents!

Agent mode is auto-detected but you can also force a mode explicitly with --format:

hf models ls --limit 5                  # auto-detect
hf models ls --limit 5 --format agent   # force agent-friendly output
hf models ls --limit 5 --format json    # structured JSON
hf models ls --limit 5 --format quiet   # IDs only, great for piping

Here's what an agent sees compared to a human:

hf auth whoami

# Human
✓ Logged in
  user: Wauplin
  orgs: huggingface, awesome-org

# Agent
user=Wauplin orgs=huggingface,awesome-org

# JSON
{"user": "Wauplin", "orgs": ["huggingface", "awesome-org"]}

hf models ls --author google --limit 3

# Human
ID                         DOWNLOADS TRENDING_SCORE
-------------------------- --------- --------------
google/embeddinggemma-300m 1213145   17            
google/gemma-3-4b-it       1512637   16            
google/gemma-3-27b-it      988618    12   

# Agent (TSV, no truncation, no ANSI)
id      downloads       trending_score
google/embeddinggemma-300m      1213145 17
google/gemma-3-4b-it    1512637 16
google/gemma-3-27b-it   988618  12

hf models info google/gemma-3-27b-it

# Human — pretty-printed JSON (indent=2)
{
  "id": "google/gemma-3-27b-it",
  "author": "google",
  ...
}

# Agent — compact JSON (~40% fewer tokens)
{"id": "google/gemma-3-27b-it", "author": "google", "card_data": ...}

Commands migrated so far: hf models ls|info, hf datasets ls|info|parquet|sql, hf spaces ls|info, hf papers ls|search|info, hf auth whoami. More commands will be migrated soon

🧩 Install Agent Skills from the Hugging Face Marketplace

The hf skills add command now supports installing skills directly from the Hugging Face skills marketplace (https://github.com/huggingface/skills) - pre-built tools that give AI agents new capabilities.

# Install a marketplace skill
hf skills add gradio

# Install with Claude Code integration
hf skills add huggingface-gradio --claude

# Upgrade all installed skills
hf skills upgrade

🔧 More CLI Improvements

🔧 Other Improvements

  • Clarify 404 access guidance in errors by @Pierrci in #4010
  • Add HF_HUB_DISABLE_SYMLINKS env variable to force no-symlink cache by @Wauplin in #4032
  • Add CACHEDIR.TAG to cache directories by @Wauplin in #4030
  • Support None type in strict dataclass by @Wauplin in #3987
  • Reject bool/int cross-type confusion in @strict dataclass validation by @Wauplin in #3992

🐛 Bug Fixes

📖 Documentation

  • Add tip about AI agents skill to CLI guide by @gary149 in #3970
  • Link to Hub local cache docs from manage-cache guide by @Wauplin in #3989
  • Note that environment variables are read at import time by @Wauplin in #3990
  • Add DatasetLeaderboardEntry and EvalResultEntry to docs reference by @pcuenca in #3982
  • Fix typos and outdated references in CONTRIBUTING.md by @GopalGB in #4009
  • no explicit models/ in hf:// protocol by @lhoestq in #3980
  • Add CLAUDE.md symlink pointing to AGENTS.md by @hanouticelina in #4013

🏗️ Internal

Don't miss a new huggingface_hub release

NewReleases is sending notifications on new releases.