LangGraph · Lesson 116 of 120
Cheat Sheet: Agents and Memory
Tools, checkpoints.
Reminder page two. Agents and memory. The ReAct loop, checkpointers, threads, and the store.

- Reminder page two
- Agents and memory
- Pause and keep it
Agents and memory cheat sheet
Messages state holds the conversation. The agent node calls a model with bound tools. Tool node runs the calls, and tools condition routes. Compile with a checkpointer and a store. Then invoke with a thread ID, and a context.
cheatsheet_agents.pypython
from langgraph.graph import MessagesState, StateGraph, START
from langgraph.prebuilt import ToolNode, tools_condition
from langgraph.checkpoint.memory import InMemorySaver
from langgraph.store.memory import InMemoryStore
model = model.bind_tools(tools)
def agent(s: MessagesState): return {"messages": [model.invoke(s["messages"])]}
b = StateGraph(MessagesState)
b.add_node(agent); b.add_node("tools", ToolNode(tools))
b.add_edge(START, "agent")
b.add_conditional_edges("agent", tools_condition); b.add_edge("tools", "agent")
graph = b.compile(checkpointer=InMemorySaver(), store=InMemoryStore())
graph.invoke({"messages": [...]}, {"configurable": {"thread_id": "t1"}}, context=Ctx("sam"))
graph.get_state(config); graph.get_state_history(config)Remember
Checkpointers remember one thread. The store remembers across threads, under namespaces. Get state and history let you inspect, replay, and fork. And stream modes, values, updates, messages, and custom, show progress.
| key | value |
|---|---|
| Checkpointer | one thread |
| Store | across threads |
| History | replay, fork |
| Streams | values, updates, messages |
Summary
The ReAct loop, checkpointers with threads, and the store for long term memory. Next, the cheat sheet for control.
Key takeaways- ToolNode + tools_condition
- thread_id
- Store namespaces
Next up: Cheat Sheet: Control — interrupt, Send, Command