magic-context
Self-managing, unbounded context and long-term memory for coding agents: one session, for life.
LangMem: long-term memory primitives for LangGraph agents that learn and adapt from conversations.
langmem is an open-source ai agents project by langchain-ai (langchain-ai/langmem on GitHub). It has 1,698 GitHub stars and 194 forks, is released under the MIT license, and was last updated on GitHub on 2 October 2026.
Decide your memory strategy: agents managing memory in the hot path during conversation, a background manager that consolidates knowledge, or both.
Install LangMem from PyPI and configure an API key for your LLM provider.
Create a store (in-memory for development, database-backed for production) and give your agent the memory management and search tools with a namespace.
Chat with the agent normally; it records and retrieves memories itself, and you can verify recall by asking about earlier preferences.
Storage-agnostic primitives for extracting, consolidating, and updating knowledge from conversations, usable with any storage system.
Ready-made manage and search memory tools let an agent record and look up information during active conversations, under your control of what gets stored.
Automatically extracts, consolidates, and updates agent knowledge outside the conversation flow.
Works directly with LangGraph's Long-term Memory Store, which is available by default in LangGraph Platform deployments.
Beyond facts, LangMem can optimise agent behaviour through prompt updates informed by past interactions.
Swap the development in-memory store for a persistent Postgres-backed store so memories survive restarts.
Most developers simply pip install the library.
git clone https://github.com/langchain-ai/langmem.git
cd langmemInstall LangMem and export the key for the LLM provider your agent will use.
pip install -U langmem
export ANTHROPIC_API_KEY=<your key>Wire the manage and search memory tools into a LangGraph agent with a store, following the README example. # see README for the full code snippet
python -c "from langmem import create_manage_memory_tool, create_search_memory_tool; print('tools ready')"It is maintained by LangChain (langchain-ai), the team behind LangGraph.
Yes, LangMem is MIT-licensed and free. You pay your LLM provider for the model calls the agent and memory manager make.
Yes, you configure an API key for your chosen LLM provider (the README example uses Anthropic), and embeddings for the store use a configured embedding model.
Vector databases store and retrieve text; LangMem adds the agent-facing layer: tools for in-conversation memory management, background consolidation, and prompt optimisation, integrated with LangGraph.
Run pip install -U langmem, set your provider key, and follow the README's short example to build an agent with the two memory tools.
Self-managing, unbounded context and long-term memory for coding agents: one session, for life.
Long-term memory runtime for AI agents — plain Markdown as truth, local ranked retrieval, no API key
Open-source AI memory that gives agents persistent long-term recall.
A memory operating system for long-term, personalized AI agents.
User-profile-based long-term memory for AI chatbot applications
Honcho — Plastic Labs' memory library for stateful agents that learn about their users over time.
The most-starred other AI Agents projects in the LibreAI catalogue — the realistic shortlist if langmem is not the right fit.
A personal AI that really does things — on any OS, with your data staying yours.
An agentic skills framework & software development methodology that works.
Agent harness optimization system with skills, memory and security for Claude Code, Codex and more
The agent that grows with you — a Python framework for adaptive AI agents.
DeepSeek's plugin-based agent harness where everything is a plugin.
Free and open — grab the source, star the repo, and start creating.