Stay free if you only need basic features. Upgrade if you need advanced features. Most solo builders can start free.
LangMem is a library of memory primitives for long-term, cross-session agent memory. LangChain's classic memory modules track state within a single conversation, while LangMem focuses on persistent semantic, episodic, and procedural memory that survives across sessions and lets agents learn from past interactions.
No. LangMem provides stateless functional primitives (memory managers, prompt optimizers) that can be used with any LangChain agent or even standalone. However, its stateful storage-backed API is built on LangGraph's BaseStore, so deeper integration is easiest inside a LangGraph application.
LangMem works with any backend that implements LangGraph's BaseStore interface. This includes the in-memory store for development and Postgres for production, with the option to plug in custom stores for other databases or vector stores.
The prompt optimizer is a procedural-memory primitive that takes an agent's existing system prompt plus signals from past runs (such as user feedback or evaluation traces) and rewrites the prompt to improve future performance. This lets agents adapt their behavior over time without retraining or fine-tuning the underlying model.
Yes. LangMem is open-source under the MIT license, so it can be used commercially at no cost. Operational costs come from the underlying LLM calls used to extract and manage memories and from whatever storage backend you choose to run.
Start with the free plan — upgrade when you need more.
Get Started Free →Still not sure? Read our full verdict →
Last verified March 2026