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
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.

Functions

Function

createFilesystemMiddleware

Create middleware that provides built-in filesystem tools and optional custom prompt guidance.

By default, the middleware registers every built-in filesystem tool listed in FILESYSTEM_TOOL_NAMES. Use

Function

createSubAgentMiddleware

Create subagent middleware with task tool

Function

createMemoryMiddleware

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

Loads memory content from configured sources and injects into the system prompt. Supports multiple sources that are combined together.

Function

createSummarizationMiddleware

Create summarization middleware with backend support for conversation history offloading.

This middleware:

  1. Monitors conversation length against configured thresholds
  2. When triggered, offloads ol
Function

createSkillsMiddleware

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

This middleware loads skills from configurable backend sources and injects skill metadata into the system prompt. It implemen

Function

createAgentMemoryMiddleware

deprecated

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

This middleware loads the agent's long-term memory from a file (agent.md) and injects it into the system prompt. The memory is loaded on

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.