Skip to content

Give a LangGraph Workflow Memory It Can Reopen

For: Python developers learning LangGraph memory. Notebook language: Korean; code identifiers remain English.

A conversation’s state and reusable knowledge are different. A checkpointer tracks a thread’s graph state; a Store lets your application explicitly select memory across threads. One does not replace the other.

These are synthetic learning examples. The default responses are deterministic templates, not simulated claims of live LLM behavior.

NotebookWhat you buildEvidence
05: Memory basicsStore a preference through compile(store=...)Same-user new thread reads it; another namespace does not; a new store object reopens the file
06: Retrieval memoryRetrieve → compose → approve → saveUnapproved draft creates no output memory; approved result has a Markdown source and can be searched after reopening

Download each raw file using “Save link as” if your browser displays JSON. Each notebook includes its own input, code, assertions, explanation, recovery steps, and exercise. No private repository or previous notebook run is required.

Use Python 3.12 or newer in an isolated environment:

Terminal window
uv venv .venv
uv pip install --python .venv/bin/python "memtomem[langgraph]==0.6.8" jupyterlab ipykernel
uv run --python .venv/bin/python --no-project jupyter lab

On Windows, replace .venv/bin/python with .venv/Scripts/python.exe. Select that environment’s Python kernel and run all cells. Initial package installation needs internet, but the required examples use no API key, embedding model download, or STM server.

Each notebook should print six PASS markers. Notebook 06 additionally prints SKIP LLM by default.

MemtomemBaseStore implements LangGraph’s standard Store interface and uses inspectable JSON files. Its no-embedding search uses lexical overlap, not Core’s BM25/RRF pipeline. It does not support TTL.

MemtomemStore exposes Core’s Markdown write/index/search operations and is used explicitly inside nodes, not passed as compile(store=...). Notebook 06 uses keyword-only search. The two examples do not automatically share a database with each other or with a coding client.

InMemorySaver is an in-process teaching checkpointer, not durable checkpoint recovery. Namespace selection is not an authentication or authorization system.

Optional: replace the draft node with an LLM

Section titled “Optional: replace the draft node with an LLM”

Notebook 06 contains an opt-in OpenAI Responses API cell. It requires RUN_LLM=True, OPENAI_API_KEY, and an explicit OPENAI_MODEL. It sends only synthetic retrieved text, may incur API charges, and leaves the response as an unsaved draft. Missing configuration is a skip; an attempted request failure is an error.

Model access, billing, remote tracing, production checkpoint recovery, and broad MCP-adapter compatibility are outside the default proof.

Next: Core memory concepts, search behavior, or the coding-agent case.

References: LangGraph memory · OpenAI API setup.