langmem  by langchain-ai

Agentic framework for memory management

created 6 months ago
915 stars

Top 40.6% on sourcepulse

GitHubView on GitHub
Project Summary

LangMem provides tooling for AI agents to learn and adapt from interactions over time, enabling personalized responses and consistent behavior. It targets developers building stateful AI agents, offering primitives for memory extraction, prompt optimization, and long-term knowledge persistence.

How It Works

LangMem offers a core memory API compatible with any storage system and integrates natively with LangGraph's storage layer. It features "hot path" memory management tools that agents can invoke during active conversations for recording and searching information. A "background" manager can also automatically extract and consolidate knowledge. This approach allows agents to dynamically manage their memory, deciding what to store and when to retrieve it via search tools.

Quick Start & Requirements

  • Install: pip install -U langmem
  • Environment: Set LLM provider API key (e.g., export ANTHROPIC_API_KEY="sk-...").
  • Prerequisites: Python, an LLM provider.
  • Example: See the provided Python code snippet for creating an agent with memory tools and InMemoryStore.
  • Documentation: Hot Path Quickstart, Background Quickstart, Core Concepts, API Reference.

Highlighted Details

  • Core memory API works with any storage system.
  • Memory management tools for "hot path" recording and searching.
  • Background manager for automatic knowledge extraction and consolidation.
  • Native integration with LangGraph's Long-term Memory Store.

Maintenance & Community

  • Project is part of the langchain-ai organization.
  • Links to further documentation are provided in the README.

Licensing & Compatibility

  • License: Not explicitly stated in the README.
  • Compatibility: Designed for use with LangGraph and various LLM providers.

Limitations & Caveats

The InMemoryStore is suitable for testing but loses data on restart; production use requires a persistent, database-backed store. The README does not specify the project's license.

Health Check
Last commit

5 days ago

Responsiveness

1 day

Pull Requests (30d)
5
Issues (30d)
5
Star History
467 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.