Skip to main content
The HF Buckets VFS mounts a Hugging Face Bucket at some prefix such as /hf/. Listing and writes use OpenDAL (the hf-buckets extra). Reads stream from the Hub. For credential setup, see HF Buckets Setup.

Install

Config

HfBucketsVFS(config) takes an HfBucketsConfig object with the bucket in namespace/bucket-name form plus an optional access token. timeout is how many seconds one Hub request may go without progress: connecting, waiting for the answer, or between two chunks of a download. A large file that keeps arriving is never cut off, and 0 turns the bound off. Both READ and WRITE modes are supported out of the box. Fields marked secret are redacted in snapshots.

VFS.md

The VFS.md an agent reads with HF Buckets mounted at /<path>.

Virtual Filesystem

Supported Unix Commands for VFS

Unix commands work on each path as on a local filesystem, as far as the path supports them:

Limitations of Unix Commands for VFS

Where a path differs from a local filesystem:Run man <cmd> or <cmd> --help for one command’s usage.
The HF Buckets VFS maps bucket object keys to virtual paths under the mount prefix. For example, if bucket your-user/my-data contains:
Then mounting at /hf/ exposes:
Path mapping: virtual /hf/data/file.txt maps to bucket key data/file.txt.

Cache

The HF Buckets VFS uses IndexCacheStore with index_ttl = 600 (10 minutes). Directory listings are cached and populate file-size/type entries that stat reads via a fast path, so a readdir followed by per-entry stat calls (which is what ls, FUSE getattr, and most shell commands trigger) costs one HTTP request instead of N. A configured index: replaces this lifetime with its own ttl, and the mount’s ttl: caps it.

Integration

What Hugging Face buckets answers through its own API, so fewer files are read. Integration explains each command.

Example

Shell Commands

The HF Buckets VFS supports the full set of shell commands since it operates on real file content (text, binary, JSON, CSV, etc.). Large files benefit from range reads to avoid downloading entire objects.

Read Commands

Text Processing

File Operations

Path Utilities

Compression

Encoding

Use Cases

  • AI agents accessing HF datasets: Mount HF Buckets for agents to read and process datasets stored on the Hub
  • Data pipelines: Read and write HF bucket objects with shell-like commands
  • Sandboxed bucket access: Restrict agent operations to a specific bucket and prefix
  • FUSE mounting: Expose HF Buckets through a virtual FUSE mount for external tools

Scoping a VFS to a key prefix

Pass key_prefix: str | None = None to HfBucketsConfig to transparently scope every operation to a subpath of the bucket:
When set, every read/write/list/stat operation is transparently scoped to that bucket subpath. Agents see clean paths like /data/notes.md; the underlying bucket key is users/{user_id}/data/notes.md. Useful for multi-tenant systems. Normalization: leading slashes are stripped and a trailing slash is added automatically. Both None and an empty string are treated as “no prefix.”