LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • Agent
  • Middleware
  • Backends
  • Sandboxes
  • Skills
  • Subagents
  • 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

OverviewAgentMiddlewareBackendsSandboxesSkillsSubagentsTypes
Modal
Daytona
Deno
Node VFS
Sandbox Standard Tests
Vitest
Language
Theme
JavaScriptdeepagentsindexBackendProtocolV2
Interface●Since v1.9

BackendProtocolV2

Updated protocol for pluggable memory backends.

Key differences from BackendProtocol:

  • read() returns ReadResult instead of a plain string
  • readRaw() returns ReadRawResult instead of FileData
  • grep() returns GrepResult instead of GrepMatch[] | string
  • ls() returns LsResult instead of FileInfo[]
  • glob() returns GlobResult instead of FileInfo[]

Existing v1 backends can be adapted to this interface using adaptBackendProtocol from utils.

Copy
interface BackendProtocolV2

Bases

Omit<BackendProtocolV1, "read" | "readRaw" | "grepRaw" | "lsInfo" | "globInfo">

Properties

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

Methods

method
delete→ MaybePromise<DeleteResult>

Delete a single file. Optional - backends that don't support file deletion can omit this.

method
edit→ MaybePromise<EditResult>

Edit a file by replacing string occurrences.

method
glob→ MaybePromise<GlobResult>

Structured glob matching returning FileInfo objects.

method
grep→ MaybePromise<GrepResult>

Search file contents for a literal text pattern.

Binary files (determined by MIME type) are skipped.

method
ls→ MaybePromise<LsResult>

Structured listing with file metadata.

Lists files and directories in the specified directory (non-recursive). Directories have a trailing / in their path and is_dir=true.

method
read→ MaybePromise<ReadResult>

Read file content.

For text files, content is paginated by line offset/limit. For binary files, the full raw Uint8Array content is returned.

method
readRaw→ MaybePromise<ReadRawResult>

Read file content as raw FileData.

method
write→ MaybePromise<WriteResult>

Write content to a file, creating it or overwriting it if it already exists.

View source on GitHub