LangChain + MemorySync
Persistent chat history and prompt-ready recall context for LangChain chains and agents, in Python and Node.js.
Overview
Install langchain-memorysync (Python) or memorysync-langchain (Node.js) to give any LangChain chain or agent durable memory. The chat history class plugs into RunnableWithMessageHistory and keeps each session’s transcript in MemorySync conversation history, apart from the user’s memories; the durable facts in user messages are extracted into memories, and clear() deletes the transcript while those facts stay. A context provider returns prompt-ready recall blocks, and both packages run on langchain-core 0.3.x and 1.x.
Setup status and requirements
- Supported version
- langchain-memorysync 1.2.0 (PyPI) / memorysync-langchain 1.2.0 (npm)
- Last setup review
- 2026-10-01
- Permissions
- A MemorySync API key with read and write scopes.
- Limits
- Requires langchain-core 0.3 or newer (Python 3.10+, Node 18+). History clear() needs a key with delete permission; anonymous evaluation keys can write and read history but cannot clear it.
Capabilities
- BaseChatMessageHistory implementation for RunnableWithMessageHistory
- Prompt-ready recall context blocks
- Transcript kept as written in conversation history — short answers survive, never listed as memories
- User messages sent to fact extraction, so durable facts become memories
- 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
Assistants that remember users across sessions
Personalised prompts from 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.