LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • Agent
  • Middleware
  • Backends
  • Sandboxes
  • Skills
  • Subagents
  • Configuration
  • Types
Modal
Daytona
Deno
Node VFS
Sandbox Standard Tests
  • Vitest
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

OverviewAgentMiddlewareBackendsSandboxesSkillsSubagentsConfigurationTypes
Modal
Daytona
Deno
Node VFS
Sandbox Standard Tests
Vitest
Language
Theme
JavaScriptdeepagentsindexSandboxBackendProtocolV2
Interface●Since v1.8

SandboxBackendProtocolV2

Protocol for sandboxed backends with isolated runtime.

Key differences from SandboxBackendProtocol:

  • Extends BackendProtocolV2 instead of BackendProtocol
  • All methods return structured Result types for consistent error handling
Copy
interface SandboxBackendProtocolV2

Bases

BackendProtocolV2

Properties

property
downloadFiles: (paths: string[]) => MaybePromise<FileDownloadResponse[]>
property
id: string

Unique identifier for the sandbox backend

property
uploadFiles: (files: [string, Uint8Array<ArrayBufferLike>][]) => MaybePromise<FileUploadResponse[]>

Methods

method
edit→ Promise<EditResult>

Edit a file by replacing string occurrences.

Uses downloadFiles() to read, performs string replacement in TypeScript, then uploadFiles() to write back. No runtime needed on the sandbox host.

Memory-conscious: releases intermediate references early so the GC can reclaim buffers before the next large allocation is made.

method
execute→ MaybePromise<ExecuteResponse>

Execute a command in the sandbox. This is the only method concrete implementations must provide.

method
glob→ Promise<GlobResult>

Structured glob matching returning FileInfo objects.

Uses pure POSIX shell (find + stat) via execute() to list all files, then applies glob-to-regex matching in TypeScript. No Python or Node.js needed on the sandbox host.

Glob patterns are matched against paths relative to the search base:

  • * matches any characters except /
  • ** matches any characters including / (recursive)
  • ? matches a single character except /
  • [...] character classes
method
grep→ Promise<GrepResult>

Search for a literal text pattern in files using grep.

method
ls→ Promise<LsResult>

List files and directories in the specified directory (non-recursive).

Uses pure POSIX shell (find + stat) via execute() — works on any Linux including Alpine. No Python or Node.js needed.

method
read→ Promise<ReadResult>

Read file content with line numbers.

Uses pure POSIX shell (awk) via execute() — only the requested slice is returned over the wire, making this efficient for large files. Works on any Linux including Alpine (no Python or Node.js needed).

method
readRaw→ Promise<ReadRawResult>

Read file content as raw FileData.

Uses downloadFiles() directly — no runtime needed on the sandbox host.

method
write→ Promise<WriteResult>

Create a new file with content.

Uses downloadFiles() to check existence and uploadFiles() to write. No runtime needed on the sandbox host.

Inherited fromBackendProtocolV2

Properties

PdownloadFiles: (paths: string[])PuploadFiles: (files: [string, Uint8Array<ArrayBufferLike>][])

Methods

Medit→ Promise<EditResult>
—

Edit a file by replacing string occurrences.

Mglob→ Promise<GlobResult>
—

Structured glob matching returning FileInfo objects.

Mgrep→ Promise<GrepResult>
—

Search for a literal text pattern in files using grep.

Mls→ Promise<LsResult>
—

List files and directories in the specified directory (non-recursive).

Mread→ Promise<ReadResult>
—

Read file content with line numbers.

MreadRaw→ Promise<ReadRawResult>
—

Read file content as raw FileData.

Mwrite→ Promise<WriteResult>
—

Create a new file with content.

View source on GitHub