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

Installation and setup

Installation and setup is the one-time step that installs LangMem 0.0.30 with LangChain's Groq and Google integrations and gives it two free API keys: one for the chat model and one for embeddings.

Last updated: 30 Sep, 2026 · LangMem 0.0.30

LangMem does not call a model provider itself. It hands the work to a LangChain chat model, and the store it writes to can embed text with a LangChain embedding model. So the install is LangMem plus one integration package per provider.

Installing LangMem and the integrations

langmem brings LangGraph and LangChain with it. langchain-groq is the chat model, langchain-google-genai the embeddings, and numpy speeds up the store's vector search (without it the store prints a warning and falls back to plain Python).

pip install "langmem==0.0.30" "langchain-groq==1.1.3" "langchain-google-genai==4.4.0" numpy
Example
from importlib.metadata import version

for package in ["langmem", "langgraph", "langchain", "langchain-groq", "langchain-google-genai"]:
    print(f"{package:24} {version(package)}")

The version is pinned because LangMem 0.0.x may change its API between releases; LangGraph and LangChain came in as its dependencies, at the versions shown.

Getting the two free keys

ProviderUsed forWhere to get the keyEnvironment variable
GroqThe chat model, openai/gpt-oss-120bconsole.groq.com/keysGROQ_API_KEY
Google AI StudioEmbeddings, gemini-embedding-2, from the semantic search lesson onaistudio.google.com/apikeyGOOGLE_API_KEY

Both are free plans with daily limits. Set the keys in the shell you run Python from, or in Colab's Secrets panel:

export GROQ_API_KEY="gsk_..."
export GOOGLE_API_KEY="AIza..."

Checking the chat model

init_chat_model turns a "provider:model" string into a chat model object. Every lesson starts with this line; temperature=0 makes the model pick its most likely answer, which keeps runs closer to each other.

python
from langchain.chat_models import init_chat_model

model = init_chat_model("groq:openai/gpt-oss-120b", temperature=0)
ExampleAPI key
from langchain.chat_models import init_chat_model

model = init_chat_model("groq:openai/gpt-oss-120b", temperature=0)
reply = model.invoke("Reply with one word: ready")
print(reply.text)

Checking the embedding model

init_embeddings does the same for embedding models. gemini-embedding-2 turns any text into a list of 3072 numbers; the store uses those to search by meaning.

ExampleAPI key
from langchain.embeddings import init_embeddings

embeddings = init_embeddings("google_genai:gemini-embedding-2")
vector = embeddings.embed_query("Order A-1001 arrived broken")
print(len(vector))

gpt-oss-120b vs gpt-oss-20b

openai/gpt-oss-120bopenai/gpt-oss-20b
Used in this courseEvery runOnly if you hit the 120b daily limit
Daily token budget on a free keyIts ownIts own, separate from 120b
Size120 billion parameters20 billion parameters

When you come back to this setup

  • Every lesson's code starts with the same imports and the model = ... line; they only work once the keys are set in that shell or notebook.
  • When Groq answers 429 with tokens per day in the message, change the model string to groq:openai/gpt-oss-20b for the rest of the day.
  • A new Colab session forgets environment variables; run the Secrets cell again.
Watch out. Keys go in the environment, never in the code you share or commit. A key pasted into a notebook ends up in its saved file.
Try it yourself
  • Run pip show langmem and read which packages it requires.
  • Change the model string to groq:openai/gpt-oss-20b and run the chat check again.
  • Unset GROQ_API_KEY and run the chat check to see the error you get without a key.

Little by little, you're building something great.