LangChain + MemorySync
Official LangChain integration: persistent chat message history, agent memory tools, and prompt-ready recall context in Python and JavaScript.
Overview
Install langchain-memorysync (Python) or memorysync-langchain (JavaScript) to give any LangChain chain or agent durable memory. The chat history class plugs into RunnableWithMessageHistory, five structured tools let agents store and search memories safely, and both packages run on langchain-core 0.3.x and 1.x.
Setup status and requirements
- Supported version
- langchain-memorysync 1.0.1 (PyPI) / memorysync-langchain 1.0.0 (npm)
- Last setup review
- 2026-08-22
- Permissions
- A MemorySync API key with read and write scopes.
- Limits
- Requires langchain-core 0.3 or newer (Python 3.10+, Node 18+). The delete tool and history clear() need a key with delete permission; anonymous evaluation keys can write and read history but cannot clear it.
Capabilities
- BaseChatMessageHistory implementation for RunnableWithMessageHistory
- Five structured agent tools: add, search, list, update, delete
- Prompt-ready recall context blocks
- Idempotent writes that survive retries
- Per-end-user scoping and read-only mode
- langchain-core 0.3.x and 1.x support in both languages
Quick Start
from langchain_core.runnables.history import RunnableWithMessageHistoryfrom langchain_memorysync import MemorySyncChatMessageHistorychain_with_history = RunnableWithMessageHistory(chain,lambda session_id: MemorySyncChatMessageHistory(session_id=session_id),input_messages_key="input",history_messages_key="history",)
Use Cases
LangChain chatbots with persistent memory
Agents that remember users across sessions
LangGraph workflows with long-term recall
Explore More
Built for production AI systems
Build AI systems that remember
MemorySync provides the infrastructure layer for persistent memory, adaptive retrieval, and enterprise AI intelligence.
Start free. No credit card required.