Agent Architecture/Agent Memory
Advanced9 min

LangMem SDK & Store API

The LangMem SDK for automatic memory extraction and the LangGraph Store API for persistent cross-thread storage.

Quick Reference

  • LangMem provides create_memory_manager() that automatically extracts and updates user memories from conversations
  • Store API: store.put(namespace, key, value) and store.search(namespace, query) for semantic retrieval
  • Namespaces follow the pattern ('memories', user_id, memory_type) for organized multi-tenant storage
  • Memory managers can run as background tasks on conversation end or as inline nodes in the graph
  • Use store.search() with embedding-based similarity to retrieve relevant memories without exact key matches

LangMem Overview

What LangMem does

LangMem automates memory extraction: it reads conversation history, identifies important facts about the user, and stores them as structured memories. You configure the extraction policy; LangMem handles the rest.

Automatic memory extraction with LangMem