Hugging Face Hub is a platform for sharing and using machine-learning models, datasets, and hosted applications. Its official command-line tool and Python client let developers and coding agents search, download, upload, manage, run inference with, and collaborate around those resources.
Borrowing it
Nothing to install: this file belongs to huggingface/huggingface_hub. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/huggingface/huggingface_hub/main/AGENTS.mdgit clone --depth 1 https://github.com/huggingface/huggingface_hubWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/instructions/huggingface/huggingface_hub/agents-md)<a href="https://agentmods.dev/instructions/huggingface/huggingface_hub/agents-md"><img src="https://agentmods.dev/badge/instructions/huggingface/huggingface_hub/agents-md/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/instructions/huggingface/huggingface_hub/agents-md"><img src="https://agentmods.dev/badge/instructions/huggingface/huggingface_hub/agents-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.02565 | $0.02565 |
| Opus 5.5 | $0.01026 | $0.01026 |
| Sonnet 5.5 | $0.00513 | $0.00513 |
| Haiku 4.5 | $0.00257 | $0.00257 |
Grade A, and why
huggingface_hub AGENTS.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 144 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Agent Guide for huggingface_hub
Project overview
Python client library for the Hugging Face Hub. Source code is in src/huggingface_hub/, tests in tests/.
Setup
- Virtualenv:
.venv(everything pre-installed in editable mode with dev extras). - Activate:
source .venv/bin/activate(or prefix commands with.venv/bin/python).
Key commands
| Command | What it does |
|---|---|
make style |
Auto-format code (ruff format + fix), update generated files (static imports, __all__, async client, CLI reference) |
make quality |
Check formatting, linting, generated files, and type-check (ty check src) |
pytest tests/test_<module>.py |
Run a specific test file |
pytest tests/test_<module>.py -k "test_name" |
Run a single test |
pytest tests/ |
Run all tests (slow, many require network/auth) |
Always run make style then make quality before committing.
Code structure
Core modules (src/huggingface_hub/)
__init__.py— Public API surface. Static imports are auto-generated byutils/check_static_imports.py; runmake styleto update.hf_api.py— MainHfApiclass (~11k lines). Repo CRUD, uploads, downloads, discussions, PRs, collections, and more. Most Hub operations live here.file_download.py—hf_hub_download, caching logic, ETag/metadata resolution, xet download support._snapshot_download.py—snapshot_download(download an entire repo)._commit_api.py— Low-level commit operations (CommitOperationAdd,CommitOperationDelete,CommitOperationCopy), LFS upload handling._commit_scheduler.py— Background scheduled commits._upload_large_folder.py— Chunked upload for very large folders (deprecated;upload_foldernow handles large/resumable uploads).hf_file_system.py—HfFileSystem(fsspec-based POSIX-like filesystem for Hub repos).hub_mixin.py—ModelHubMixinbase class for ML framework integration (save/load to Hub).repocard.py/repocard_data.py—RepoCard,ModelCard,DatasetCardand their metadata.community.py—Discussion,DiscussionCommentand event deserialization.lfs.py— Git LFS batch upload utilities._login.py—login(),logout(),notebook_login(), token management._inference_endpoints.py— Inference endpoint CRUD and scaling._jobs_api.py— Training jobs API._space_api.py— Space runtime/hardware/storage types._webhooks_server.py/_webhooks_payload.py— Webhook server and payload definitions.constants.py— All environment-variable-driven constants (timeouts, cache paths, endpoints).errors.py— Custom exception hierarchy (HfHubHTTPError,RepositoryNotFoundError, etc.).
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 2mo ago First seen · 144 lines · 2,565 tokens per session scan A 01f752a05361
huggingface_hub AGENTS.md is an instructions file published in the GitHub repository huggingface/huggingface_hub (4,033 stars, last pushed yesterday), licensed Apache-2.0. It adds 2,565 tokens to every session, about $0.0103 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
huggingface_hub AGENTS.md compared with instructions from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| huggingface_hub AGENTS.mdhuggingface/huggingface_hub | Instructions file | 4.0k | yesterday | Apache-2.0 | A | 2,565 | Codex, OpenCode |
| vscode buildNext.instructions.mdmicrosoft/vscode | Instructions file | 195k | yesterday | MIT | A | 9,719 | GitHub Copilot |
| next.js AGENTS.mdvercel/next.js | Instructions file | 143k | yesterday | MIT | A | 7,461 | Codex, OpenCode |
| langchain AGENTS.mdlangchain-ai/langchain | Instructions file | 149k | yesterday | MIT | A | 4,680 | Codex, OpenCode |
| vscode oss-third-party-notices.instructions.mdmicrosoft/vscode | Instructions file | 195k | yesterday | MIT | A | 5,516 | GitHub Copilot |
| vscode copilot-instructions.mdmicrosoft/vscode | Instructions file | 195k | yesterday | MIT | A | 3,093 | GitHub Copilot |
| deepseek-harness AGENTS.mddeepseek-ai/deepseek-harness | Instructions file | 274k | 2d ago | MIT | A | 4,313 | Codex, OpenCode |