LangMemLangMem 0.0.30 · LangGraph 1.2 · Python 3.10+
0%
1
Curious builder0 XP earned · 300 to level 2
0 daysFinish a lesson to begin
Badge collection0 of 6 unlocked
18 small wins to finish your pathNext lesson

Installation and setup

LangMem installs with pip and works with any LangChain chat model. The course uses a rule-based model, and a free Groq or Gemini key covers a real one.

pip install langmem 0.0.30

LangMem brings LangGraph and LangChain's core with it. The version is pinned because LangMem is an early release whose API may still change.

pip install "langmem==0.0.30"
Example
from importlib.metadata import version

print(version("langmem"))

A LangChain chat modelOptional

The course uses MemoryModel, a rule-based chat model you read in lesson 4, so no key is needed. Lesson 5 shows the change to a hosted model loaded with init_chat_model, which needs the provider's LangChain package and key.

python
from langchain.chat_models import init_chat_model

model = init_chat_model("google_genai:gemini-2.5-flash")
ProviderKeyVariablePackage and model string
GroqFree, console.groq.com/keysGROQ_API_KEYlangchain-groq, "groq:openai/gpt-oss-120b"
GeminiFree, aistudio.google.com/apikeyGOOGLE_API_KEYlangchain-google-genai, "google_genai:gemini-2.5-flash"
OpenRouterFree models end in :free, openrouter.ai/keysOPENROUTER_API_KEYlangchain-openrouter, "openrouter:google/gemma-4-31b-it:free"
OpenAIPaid, platform.openai.com/api-keysOPENAI_API_KEYlangchain-openai, "openai:gpt-4o-mini"
pip install langchain-google-genai
export GOOGLE_API_KEY=AIza...
Try it yourself
  • Run pip show langmem and read which LangGraph version it requires.

Little by little, you're building something great.