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
JavaScriptdeepagentsbrowserContextHubBackend
Class●Since v1.10

ContextHubBackend

Backend that stores files in a LangSmith Hub agent repository.

Mutation model

Mutations are accepted in call order, coalesced for a short window, and pushed by one worker. Only one batch is in flight at a time; mutations that arrive during a push form the next batch. This serializes one backend instance's writes while still reducing the number of Hub commits.

Reads use an optimistic view: the last durable cache overlaid with the in-flight batch and then the pending batch. A read can therefore observe an accepted mutation before it is durable; a failed push invalidates that view and the next operation reloads from Hub.

A 409 parent conflict triggers an authoritative pull and rematerializes the in-flight batch over the fetched tree before retrying. Edits replay their original replacement intent; absolute writes, deletes, and uploads replay as absolute changes. Retries are bounded by MAX_CONFLICT_RETRIES.

Copy
class ContextHubBackend

Constructors

constructor
constructor→ ContextHubBackend

Methods

method
delete→ Promise<DeleteResult>

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

method
downloadFiles→ Promise<FileDownloadResponse[]>

Download multiple files. Optional - backends that don't support file download can omit this.

method
edit→ Promise<EditResult>

Edit a file by replacing string occurrences.

method
getLinkedEntries→ Promise<Record<string, string>>

Return linked-entry paths mapped to their repo handles.

method
glob→ Promise<GlobResult>

Structured glob matching returning FileInfo objects.

method
grep→ Promise<GrepResult>

Search file contents for a literal text pattern.

Binary files (determined by MIME type) are skipped.

method
hasPriorCommits→ Promise<boolean>

Return true if the hub repo already exists with at least one commit.

method
ls→ Promise<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→ Promise<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→ Promise<ReadRawResult>

Read file content as raw FileData.

method
uploadFiles→ Promise<FileUploadResponse[]>

Upload multiple files. Optional - backends that don't support file upload can omit this.

method
write→ Promise<WriteResult>

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

View source on GitHub