Hi everyone, I’m Hemant Kumar from India.
While building CuraDocs, an AI healthcare platform, I encountered a major limitation in LangChain’s memory system:
Problem
All existing LangChain memory backends—Redis, MongoDB, Postgres—store chat history in plaintext.
For teams handling medical data, financial conversations, enterprise workflows, or any form of PII, this makes the default memory adapters unsafe for production use.
Because of this, many teams cannot adopt LangChain memory directly.
Proposal
Introduce encrypted memory modules for LangChain, providing secure, drop-in alternatives to the existing backends.
These modules are already fully implemented, tested, documented, and available as open-source packages:
1. Encrypted Redis Memory (langchain-encrypted-redis-memory)
A secure replacement for RedisChatMessageHistory that encrypts every stored message using AES-128 (Fernet).
Same API — no integration changes
Transparent encryption/decryption
Ideal for short-term memory in RAG and agent pipelines
PyPI:
https://pypi.org/project/langchain-encrypted-redis-memory/
GitHub:
https://github.com/HATAKEkakshi/langchain-encrypted-redis-memory.git
2. Encrypted MongoDB Memory (langchain-encrypted-mongo-memory)
A persistent, encrypted alternative to MongoDBChatMessageHistory, suited for long-term chat storage.
AES-128 encrypted message storage
Protects message content + session identifiers
Designed for production copilots in healthcare, finance, and enterprise
PyPI:
https://pypi.org/project/langchain-encrypted-mongo-memory/
GitHub:
https://github.com/HATAKEkakshi/langchain-encrypted-mongo-memory.git
Integration Guide
A full Jupyter notebook demonstrating encrypted memory with LangChain:
The guide includes:
-
Using encrypted Redis & MongoDB memory
-
Retrieving decrypted messages
-
Best practices (hashed session IDs)
-
Comparison with plaintext memory
Category Requested
New Proposal → Memory → Security → Encrypted Chat Memory History
Happy to collaborate and refine structure, naming, or implementation details based on maintainer feedback.
Thanks for reviewing this proposal—looking forward to your thoughts!
— Hemant Kumar