Files
deepagentsjs/libs/providers/node-vfs
github-actions[bot] f127e3d442 chore: version packages (#676)
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## deepagents@1.11.0

### Minor Changes

- [#671](https://github.com/langchain-ai/deepagentsjs/pull/671)
[`6ae9d1e`](https://github.com/langchain-ai/deepagentsjs/commit/6ae9d1eab92131ea9cfd7bef024cf1ab343641ea)
Thanks [@hntrl](https://github.com/hntrl)! - feat(filesystem): add
allowlist for filesystem middleware tools

- [#669](https://github.com/langchain-ai/deepagentsjs/pull/669)
[`4643148`](https://github.com/langchain-ai/deepagentsjs/commit/4643148e8b64c796d3144210bac3ad1c6f5b2091)
Thanks [@hntrl](https://github.com/hntrl)! - feat(deepagents): add
structured system prompt configuration

- [#673](https://github.com/langchain-ai/deepagentsjs/pull/673)
[`eb18c70`](https://github.com/langchain-ai/deepagentsjs/commit/eb18c70d8d0871bc72aeb8be6581a98506829c6f)
Thanks [@hntrl](https://github.com/hntrl)! - feat(backends): add delete
protocol support

Adds a `DeleteResult` type and optional backend `delete` method,
preserves delete through backend protocol adaptation, and implements
file deletion across the built-in state, store, filesystem, composite,
context hub, sandbox, and node-vfs backends.

### Patch Changes

- [#691](https://github.com/langchain-ai/deepagentsjs/pull/691)
[`39a7049`](https://github.com/langchain-ai/deepagentsjs/commit/39a7049e4dbf99a31223c4e31cf79a2ed5115634)
Thanks [@colifran](https://github.com/colifran)! - fix(deepagents):
backend adapter drops route prefixes

- [#672](https://github.com/langchain-ai/deepagentsjs/pull/672)
[`cc26c41`](https://github.com/langchain-ai/deepagentsjs/commit/cc26c41df2851acacc86a743878b5c847a8f5d59)
Thanks [@hntrl](https://github.com/hntrl)! - fix(deepagents): allow
custom middleware to replace defaults by name
## deepagents-acp@0.1.19

### Patch Changes

- Updated dependencies
[[`39a7049`](https://github.com/langchain-ai/deepagentsjs/commit/39a7049e4dbf99a31223c4e31cf79a2ed5115634),
[`6ae9d1e`](https://github.com/langchain-ai/deepagentsjs/commit/6ae9d1eab92131ea9cfd7bef024cf1ab343641ea),
[`cc26c41`](https://github.com/langchain-ai/deepagentsjs/commit/cc26c41df2851acacc86a743878b5c847a8f5d59),
[`4643148`](https://github.com/langchain-ai/deepagentsjs/commit/4643148e8b64c796d3144210bac3ad1c6f5b2091),
[`eb18c70`](https://github.com/langchain-ai/deepagentsjs/commit/eb18c70d8d0871bc72aeb8be6581a98506829c6f)]:
  - deepagents@1.11.0
## @langchain/node-vfs@0.2.1

### Patch Changes

- [#673](https://github.com/langchain-ai/deepagentsjs/pull/673)
[`eb18c70`](https://github.com/langchain-ai/deepagentsjs/commit/eb18c70d8d0871bc72aeb8be6581a98506829c6f)
Thanks [@hntrl](https://github.com/hntrl)! - feat(backends): add delete
protocol support

Adds a `DeleteResult` type and optional backend `delete` method,
preserves delete through backend protocol adaptation, and implements
file deletion across the built-in state, store, filesystem, composite,
context hub, sandbox, and node-vfs backends.
## @deepagents/evals@0.0.18

### Patch Changes

- Updated dependencies
[[`39a7049`](https://github.com/langchain-ai/deepagentsjs/commit/39a7049e4dbf99a31223c4e31cf79a2ed5115634),
[`6ae9d1e`](https://github.com/langchain-ai/deepagentsjs/commit/6ae9d1eab92131ea9cfd7bef024cf1ab343641ea),
[`cc26c41`](https://github.com/langchain-ai/deepagentsjs/commit/cc26c41df2851acacc86a743878b5c847a8f5d59),
[`4643148`](https://github.com/langchain-ai/deepagentsjs/commit/4643148e8b64c796d3144210bac3ad1c6f5b2091),
[`eb18c70`](https://github.com/langchain-ai/deepagentsjs/commit/eb18c70d8d0871bc72aeb8be6581a98506829c6f)]:
  - deepagents@1.11.0

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-07-15 21:08:41 -07:00
..
2026-02-04 21:35:46 -08:00
2026-07-15 21:08:41 -07:00
2026-07-15 21:08:41 -07:00
2026-02-04 21:35:46 -08:00
2026-02-04 21:35:46 -08:00
2026-02-04 21:35:46 -08:00

@langchain/node-vfs

Node.js Virtual File System backend for DeepAgents.

This package provides an in-memory VFS implementation that enables agents to work with files in an isolated environment without touching the real filesystem. It uses node-vfs-polyfill which implements the upcoming Node.js VFS feature (nodejs/node#61478).

Installation

npm install @langchain/node-vfs deepagents
# or
pnpm add @langchain/node-vfs deepagents

Quick Start

import { VfsBackend } from "@langchain/node-vfs";
import { createDeepAgent } from "deepagents";
import { ChatAnthropic } from "@langchain/anthropic";

// Create and initialize a VFS backend
const backend = await VfsBackend.create({
  initialFiles: {
    "/src/index.js": "console.log('Hello from VFS!')",
  },
});

try {
  const agent = createDeepAgent({
    model: new ChatAnthropic({ model: "claude-sonnet-4-20250514" }),
    systemPrompt: "You are a coding assistant with VFS access.",
    backend,
  });

  const result = await agent.invoke({
    messages: [{ role: "user", content: "Run the index.js file" }],
  });
} finally {
  await backend.stop();
}

Features

  • In-Memory File Storage - Files are stored in a virtual file system using node-vfs-polyfill
  • Zero Setup - No Docker, cloud services, or external dependencies required
  • Native File Tools - read, ls, grep, and glob run directly against VFS data
  • Automatic Cleanup - All resources are cleaned up when the backend stops
  • Initial Files - Pre-populate the backend with files at creation time
  • Path Confinement - File operations are constrained to the virtual workspace root

API Reference

VfsBackend (BackendProtocolV2)

The main class for creating and managing the in-memory VFS backend.

Static Methods

VfsBackend.create(options?)

Create and initialize a new VFS backend in one step.

const backend = await VfsBackend.create({
  mountPath: "/vfs", // Mount path for the VFS (default: "/vfs")
  initialFiles: {
    // Initial files to populate
    "/README.md": "# Hello",
    "/src/index.js": "console.log('Hello')",
  },
});

Instance Methods

backend.uploadFiles(files)

Upload files to the backend.

const encoder = new TextEncoder();
await backend.uploadFiles([
  ["src/app.js", encoder.encode("console.log('Hi')")],
  ["package.json", encoder.encode('{"name": "test"}')],
]);
backend.downloadFiles(paths)

Download files from the backend.

const results = await backend.downloadFiles(["src/app.js"]);
for (const result of results) {
  if (result.content) {
    console.log(new TextDecoder().decode(result.content));
  }
}
backend.stop()

Stop the backend and clean up resources.

await backend.stop();

Factory Functions

createVfsBackendFactory(options?)

Create an async factory that creates new backend instances per invocation.

const factory = createVfsBackendFactory({
  initialFiles: { "/README.md": "# Hello" },
});

const backend = await factory();

createVfsBackendFactoryFromBackend(backend)

Create a factory that reuses an existing backend.

const backend = await VfsBackend.create();
const factory = createVfsBackendFactoryFromBackend(backend);

Configuration Options

Option Type Default Description
mountPath string "/vfs" Mount path for the virtual file system
initialFiles Record<string, string | Uint8Array> undefined Initial files to populate the VFS

Error Handling

The package exports a VfsSandboxError class for typed error handling:

import { VfsSandboxError } from "@langchain/node-vfs";

try {
  const result = await backend.read("/src/index.js");
  if (result.error) {
    throw new Error(result.error);
  }
} catch (error) {
  if (error instanceof VfsSandboxError) {
    switch (error.code) {
      case "NOT_INITIALIZED":
        // Handle uninitialized backend
        break;
      case "FILE_OPERATION_FAILED":
        // Handle file operation failures
        break;
    }
  }
}

Error Codes

  • NOT_INITIALIZED - Backend not initialized
  • ALREADY_INITIALIZED - Backend already initialized
  • INITIALIZATION_FAILED - Failed to initialize VFS
  • FILE_OPERATION_FAILED - File operation failed
  • NOT_SUPPORTED - VFS not supported in environment

How It Works

The VFS backend is fully in-memory:

  1. File Storage - Files are stored in-memory using the VirtualFileSystem from node-vfs-polyfill
  2. File Operations - read, ls, grep, and glob operate directly on VFS paths
  3. Isolation - Paths are confined under the virtual workspace root

This approach keeps filesystem operations isolated and avoids host shell execution from this provider.

Future: Native Node.js VFS

This package uses node-vfs-polyfill which implements the upcoming Node.js VFS feature being developed in nodejs/node#61478.

When the official node:vfs module lands in Node.js, this package will be updated to use the native implementation for better performance and compatibility.

License

MIT