LangMem
FreeHelp agents learn and adapt from interactions over time.
About LangMem
LangMem is an open-source Python library by LangChain AI that enables agents to learn and adapt from their interactions over time. It provides tooling to extract important information from conversations, optimize agent behavior through prompt refinement, and maintain long-term memory. The library offers functional primitives that work with any storage system and native integration with LangGraph's Long-term Memory Store. Key capabilities include a core memory API, memory management tools for active conversations (hot path), and a background memory manager that automatically extracts, consolidates, and updates agent knowledge. LangMem allows developers to build agents that continuously improve, personalize responses, and maintain consistent behavior across sessions. Installation is via pip, and it supports any LLM provider via an API key. The library is designed to be used with LangGraph but also provides standalone primitives for custom memory systems.
Key Features
Pros & Cons
- Simple API for adding memory to any LangGraph agent
- Works with any storage system via functional primitives
- Background memory management automates knowledge extraction
- Open source and free to use
- Hot path tools allow agents to actively manage memory during conversations
- Designed for production with database-backed stores (e.g., AsyncPostgresStore)
- Primarily designed for the LangGraph ecosystem; may require additional setup for other frameworks
- Default InMemoryStore loses data on server restart; requires production store for persistence
- Requires an LLM provider API key, adding external dependency
- Background memory manager may introduce complexity for simple use cases