langmem
Prebuilt utilities for memory management and retrieval.
What it is and what it does
LangMem is a memory management library for LangGraph agents that helps them learn and adapt from conversations over time. It provides both a functional core API (usable with any storage system) and native integration with LangGraph's storage layer, allowing agents to extract important information, optimize behavior through prompt refinement, and maintain knowledge across sessions.
The package offers memory tools that agents can invoke during conversations to record and search information, plus a background memory manager that automatically consolidates and updates agent knowledge. It works with LangGraph's InMemoryStore for development or production-grade stores for persistence. Agents can decide what to remember without special commands—they simply use the provided tools during normal interaction.
Use it for:
- Build chatbots that remember user preferences and adapt responses across multiple conversations without explicit commands.
- Create agents that extract and consolidate key facts from long conversations to maintain consistent context.
- Implement background memory consolidation to automatically refine agent knowledge and improve future interactions.
- Develop multi-turn agents that search past interactions to answer questions about previous user statements or preferences.
- Persist agent memories across server restarts using LangGraph's storage backends for production deployments.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
LangMem provides memory management tools for LangGraph agents, enabling them to store, search, and recall information from conversations to maintain context and adapt behavior across sessions.
Yes, if you are building LangGraph agents and need persistent memory across conversations. The low install friction and permissive MIT license make adoption straightforward. However, the aging maintenance status (291 days since last release) warrants checking that its dependencies remain compatible with your langchain and langgraph versions before committing to production use.
Install
langmem on PyPI
pip
pip install langmemuv
uv add langmempoetry
poetry add langmemInstalling langmem
Before you install
Low install friction with a pure-Python wheel. Maintenance status is aging—last release was 291 days ago—but the package carries eight runtime dependencies, so updates to upstream libraries could affect stability.
License in practice
MIT License permits unrestricted use, modification, and distribution with minimal restrictions, making it suitable for both open-source and commercial projects.
Quickstart
pip install -U langmem
from langmem import create_manage_memory_tool, create_search_memory_tool
from langgraph.prebuilt import create_react_agent
from langgraph.store.memory import InMemoryStore
store = InMemoryStore(index={"dims": 1536, "embed": "openai:text-embedding-3-small"})
agent = create_react_agent(
"anthropic:claude-3-5-sonnet-latest",
tools=[create_manage_memory_tool(namespace=("memories",)), create_search_memory_tool(namespace=("memories",))],
store=store,
)
agent.invoke({"messages": [{"role": "user", "content": "Remember that I prefer dark mode."}]})
Requires Python >=3.10 and an API key for an LLM provider (e.g., ANTHROPIC_API_KEY environment variable).
Verify before relying
- Whether the package is actively maintained or in long-term support mode despite the aging status
- Performance characteristics when managing large conversation histories or high-frequency memory operations
- Compatibility guarantees with specific versions of langchain, langgraph, and langsmith
Package facts
| License | MIT License Copyright (c) 2025 LangChain Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in… (full text in the JSON record) (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 8 — langchain-anthropic, langchain-core, langchain-openai, langchain, langgraph-checkpoint, langgraph, langsmith, trustcall |
| Maintenance | aging — 291 days since the last release |
| First released | |
| Downloads | 725,853/month — #5,219 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: langmem-0.0.30-py3-none-any.whl
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
genagentGenAgent provides utilities for building…
unclear · top 15,000 on PyPI
mem0aiMem0 adds a persistent, searchable memory layer…
permissive · top 5,000 on PyPI
memoriMemori is a Python SDK that automatically…
permissive · top 15,000 on PyPI
langgraph-supervisorBuilds hierarchical multi-agent systems where a…
permissive · top 15,000 on PyPI
agent-framework-mem0Integrates Mem0 persistent memory into…
permissive · top 15,000 on PyPI
langgraph-swarmBuilds multi-agent swarm systems where…
permissive · top 15,000 on PyPI
agent-framework-azure-aiIntegrates Azure AI Foundry memory capabilities…
permissive · top 15,000 on PyPI
langgraph-apiRuns a local development server for LangGraph…
unclear · top 5,000 on PyPI
reme-aiReMe is a local-first knowledge base that…
permissive · top 15,000 on PyPI
langgraph-prebuiltProvides high-level APIs for building and…
permissive · top 1,000 on PyPI