Skip to main content

The agentic filesystem. Safe file operations, knowledge graphs, and semantic search — unified for AI agents.

Project description

vfs: The Agentic File System

PyPI version Python Tests License Coverage

pip install vfs-py

vfs is an in-process file system that mounts data from multiple sources to enable agentic search and operations through a Unix-like interface.

from vfs import VFSClient, LocalFileSystem, DatabaseFileSystem

g = VFSClient()

localfs = LocalFileSystem()
dbfs = DatabaseFileSystem(engine_url="sqlite+aiosqlite:///knowledge.db")

g.add_mount('/workspace', localfs)
g.add_mount('/enterprise', dbfs)

g.cli('write /workspace/auth.py "def login(user, password): return authenticate(user, password)"')
g.cli('read /enterprise/security-policy.md')
g.cli('search "how does user login work?" --k 10')
g.cli('grep "authenticate" | pagerank | top 15')

g.close()

Every CLI command maps directly to a Python method.

  • g.cli('write ...') calls g.write()
  • g.cli('search ...') calls g.semantic_search()
  • pipelines like grep | pagerank | top 15 chain results through g.grep()g.pagerank(candidates)result.top(15).

Unix has been a foundational technology in computing for over 50 years because of its enduring core design principles: a uniform namespace, small composable tools, and portability. vfs builds on these principles to design the platform for building agent context and performing agentic actions.

  • Agent-First Design: vfs is built around having the main user be a large language model running in a loop over a long time horizon. Building for LLMs means that operations within the file system are versioned and reversible, tools are discoverable files loaded into context when needed instead of by default, and every operation can be expressed through a composable CLI — the interface LLMs are increasingly trained to use.
  • Everything is a File: Everything within vfs is addressable by path and conforms to standard data types. This single abstraction enables composable operations and predictable data within vfs.
  • Small, Composable, and On-Demand Tools: Building a new tool for every use case should be the exception, not the norm. All the capabilities of vfs can be accessed and expressed through a CLI which frees up context to build more performant and predictable agents. Specialized tools and MCPs can be assigned their own file paths in vfs for ultimate flexibility without the cost of filling up context.
  • BYOI (Bring Your Own Infrastructure): vfs has a database-first design and can run in-process with your application or as an MCP server. No new design patterns or infrastructure required — vfs runs where you need it and works with your existing AI applications.

vfs is in alpha, so we are actively building towards this vision. Please test it out and provide your feedback!

The VirtualFileSystem

The main class of this library is VirtualFileSystem. It handles mounting and routing across storage backends and defines the public API surface for vfs. The API combines familiar file system operations with search, graph traversal, and ranking. All public methods return the same composable result type, so one method's output can be used as input to the next.

Category Methods
CRUD read, write, edit, delete, move, copy, mkdir, mkconn
Navigation ls, tree, stat
Pattern Search glob, grep
Retrieval semantic_search, lexical_search, vector_search
Graph Traversal predecessors, successors, ancestors, descendants, neighborhood, meeting_subgraph, min_meeting_subgraph
Graph Ranking pagerank, betweenness_centrality, closeness_centrality, degree_centrality, in_degree_centrality, out_degree_centrality, hits
Query Engine run_query, cli
Lifecycle add_mount, remove_mount

Core Components

  1. File System. A versioned, chunkable, permission-aware, database-backed file system for text and documents. All operations are reversible and protected against data loss.
  2. Retrieval. Pluggable vector search and BM25 lexical search enable semantic and keyword retrieval across the file system. Embedding and indexing happen automatically on write.
  3. Graph. Connections between files are first-class objects. Graph algorithms like PageRank, centrality, and subgraph extraction operate on the same paths as every other operation.

How It Works

Everything in vfs is addressable by path. Files, chunks, versions, and connections all live in a single namespace:

/workspace/
├── auth.py                                           File
│   ├── .chunks/
│   │   ├── login                                     Chunk (function)
│   │   └── AuthService                               Chunk (class)
│   ├── .versions/
│   │   ├── 1                                         Version (snapshot)
│   │   └── 2                                         Version (diff)
│   └── .connections/
│       └── imports/
│           └── workspace/utils.py                    Connection (dependency)
├── utils.py                                          File
└── main.py                                           File
/enterprise/
├── onboarding.md                                     File
└── security-policy.md                                File

Metadata directories (.chunks/, .versions/, .connections/) follow the Unix dotfile convention — hidden by default, always accessible by explicit path. ls shows files. ls -a reveals metadata. Search returns files by default. Metadata is opt-in.

Composable Results

Every operation returns a VFSResult with typed Candidate objects. Results support set algebra, so different retrieval strategies can be combined without LLM re-interpretation:

# Intersection — Python files that match a semantic query
semantic = g.semantic_search("authentication")
python_files = g.glob("/workspace/**/*.py")
candidates = semantic & python_files

# Union — expand to graph neighbors
expanded = candidates | g.neighborhood(candidates)

# Re-rank by centrality
ranked = g.pagerank(candidates=expanded)

Or the same thing through the CLI:

print(g.cli('search "authentication" | glob "/workspace/**/*.py" | nbr | pagerank'))

vfs also provides VFSClientAsync as the async facade, which is the preferred path for application servers and long-running agents. The sync VFSClient wrapper shown in these examples is a convenience layer for scripts, notebooks, and data pipelines.

Installation

Requires Python 3.12+.

pip install vfs-py                # core (SQLite, rustworkx, BM25)
pip install vfs-py[openai]        # OpenAI embeddings
pip install vfs-py[langchain]     # LangChain embedding provider
pip install vfs-py[postgres]      # PostgreSQL backend
pip install vfs-py[mssql]         # MSSQL backend
pip install vfs-py[pinecone]      # Pinecone vector store
pip install vfs-py[databricks]    # Databricks Vector Search
pip install vfs-py[search]        # usearch (local vector search)
pip install vfs-py[treesitter]    # JS/TS/Go code analyzers
pip install vfs-py[deepagents]    # deepagents integration
pip install vfs-py[langgraph]     # LangGraph persistent store
pip install vfs-py[all]           # everything

Status and Roadmap

vfs is in alpha. The core file system, CLI query engine, graph algorithms, and BM25 lexical search are implemented and tested (2,157 tests, 99% coverage).

What's coming next:

  • MCP single-tool interface — expose vfs as one MCP tool with progressive discovery via --help
  • Shell entrypoint — run vfs 'grep "auth" | pagerank | top 15' directly from the terminal
  • .api/ control plane — live API pass-through for external services (Jira, Slack, GitHub) alongside synced data in the same namespace
  • LocalFileSystem — mount local directories with files on disk and metadata in SQLite
  • More analyzers — Markdown, PDF, email, Slack, Jira, CSV/JSON (code analyzers for Python, JS/TS, Go exist in v1)
  • Automatic embedding on write — background indexing for semantic search without manual setup

Contributing

Contributions are welcome. See CONTRIBUTING.md.

License

Apache 2.0. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vfs_py-0.0.21.tar.gz (984.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vfs_py-0.0.21-py3-none-any.whl (116.4 kB view details)

Uploaded Python 3

File details

Details for the file vfs_py-0.0.21.tar.gz.

File metadata

  • Download URL: vfs_py-0.0.21.tar.gz
  • Upload date:
  • Size: 984.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for vfs_py-0.0.21.tar.gz
Algorithm Hash digest
SHA256 e7593d2430bcf6b68b6a0b3fd1dd3d59564b2fd35d9afe038966fc7c33130788
MD5 e7626d2e9541ced4958c69325eeb8024
BLAKE2b-256 4d5e3d943a17be99852b70776084005a58d4130eae0e60b74cbd2eec2b505d5e

See more details on using hashes here.

File details

Details for the file vfs_py-0.0.21-py3-none-any.whl.

File metadata

  • Download URL: vfs_py-0.0.21-py3-none-any.whl
  • Upload date:
  • Size: 116.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for vfs_py-0.0.21-py3-none-any.whl
Algorithm Hash digest
SHA256 7b22bbc17bb1dd5a2a553b30f6d6a3096b495a268c7737bbe6a7a75ee8c17dfb
MD5 60e026c1c6f868d669805f7a54a388ff
BLAKE2b-256 4b0adcc0c671daee590b7cff05ebf351b9d01c23302087490d13510f9ec824a6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page