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
JavaScriptdeepagentsindexBackendFactory
Type●Since v1.4

BackendFactory

Factory function type for creating backend instances.

Backends receive StateAndStore which contains the current state and optional store, extracted from the execution context.

Copy
BackendFactory: (stateAndStore: StateAndStore) => BackendProtocol

Example

Copy
// Using in middleware
const middleware = createFilesystemMiddleware({
  backend: (stateAndStore) => new StateBackend(stateAndStore)
});
View source on GitHub