Long-term memory lets your agent store and recall information across different conversations and sessions. Unlike short-term memory, which is scoped to a single thread, long-term memory persists across threads and can be recalled at any time. Long-term memory is built on LangGraph stores, which save data as JSON documents organized by namespace and key.Documentation Index
Fetch the complete documentation index at: https://docs.langchain.com/llms.txt
Use this file to discover all available pages before exploring further.
Usage
To add long-term memory to an agent, create a store and pass it tocreate_agent:
- InMemoryStore
- PostgreSQL
runtime.store parameter. See Read long-term memory in tools and Write long-term memory from tools for examples.
Memory storage
LangGraph stores long-term memories as JSON documents in a store. Each memory is organized under a customnamespace (similar to a folder) and a distinct key (like a file name). Namespaces often include user or org IDs or other labels that makes it easier to organize information.
This structure enables hierarchical organization of memories. Cross-namespace searching is then supported through content filters.
- InMemoryStore
- PostgreSQL
Read long-term memory in tools
- InMemoryStore
- PostgreSQL
Write long-term memory from tools
- InMemoryStore
- PostgreSQL
Connect these docs to Claude, VSCode, and more via MCP for real-time answers.

