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
JavaScriptdeepagentsMiddleware

Middleware

Deep agents use a modular middleware architecture where each core capability is implemented as composable middleware. This design allows you to customize agent behavior by adding, removing, or modifying middleware.

Learn more: For architecture details and customization patterns, see the Middleware documentation.

Built-in Middleware

Filesystem Middleware

Provides tools for context management through file operations. This is one of the main challenges in building effective agents—the filesystem middleware helps agents work with large amounts of context without overflowing the context window.

Tool Description
ls List files in a directory
read_file Read file contents
write_file Write content to a file
edit_file Edit an existing file
glob Find files matching a pattern
grep Search for text within files
execute Run shell commands (sandbox backends only)

SubAgent Middleware

Provides the task tool for spawning specialized subagents. Subagents are useful for:

  • Context isolation: Keep the main agent's context clean
  • Specialization: Give subagents specific tools and prompts for focused tasks
  • Parallel work: Delegate independent subtasks

Learn more: See Subagents for usage patterns.

Memory Middleware

Enables long-term memory capabilities using LangGraph Store.

Learn more: See Long-term Memory for usage patterns.

Agent Memory Middleware

Provides agent-scoped memory that persists across conversations.

Summarization Middleware

Automatically summarizes long conversations to prevent context overflow.

Skills Middleware

Loads reusable skill modules to extend agent capabilities.

Learn more: See Skills for creating and loading skills.

API Reference

Functions

Function

createFilesystemMiddleware

Create filesystem middleware with all tools and features.

Function

createSubAgentMiddleware

Create subagent middleware with task tool

Function

createMemoryMiddleware

Create middleware for loading agent memory from AGENTS.md files.

Function

createSummarizationMiddleware

Create summarization middleware with backend support for conversation history offloading.

Function

createSkillsMiddleware

Create backend-agnostic middleware for loading and exposing agent skills.

Function

createAgentMemoryMiddleware

deprecated

Create middleware for loading agent-specific long-term memory.

Interfaces

Interface

FilesystemMiddlewareOptions

Options for creating filesystem middleware.

Interface

SubAgentMiddlewareOptions

Options for creating subagent middleware

Interface

MemoryMiddlewareOptions

Options for the memory middleware.

Interface

AgentMemoryMiddlewareOptions

Options for the agent memory middleware.

Interface

SummarizationMiddlewareOptions

Options for the summarization middleware.

Interface

SkillsMiddlewareOptions

Options for the skills middleware.