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
JavaScriptdeepagentsindexcreateAgentMemoryMiddleware
Function●Since v1.4Deprecated

createAgentMemoryMiddleware

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 once at the start of the conversation and stored in state.

Copy
createAgentMemoryMiddleware(
  options: AgentMemoryMiddlewareOptions
): AgentMiddleware<any, undefined, unknown, readonly ClientTool | ServerTool[]>

Parameters

NameTypeDescription
options*AgentMemoryMiddlewareOptions

Configuration options

View source on GitHub