AI / LangGraph LangChain Interview questions
How does checkpointing work in LangGraph?
LangGraph's checkpointing system saves the full graph state after every node execution to a persistent store. This enables resuming interrupted runs, time-travel debugging (replay from any past state), and human-in-the-loop workflows (pause, inspect, modify state, then continue).
To enable checkpointing, pass a checkpointer to graph.compile() and provide a thread_id in the config on each invocation. The thread_id is the key that groups checkpoints belonging to the same conversation or workflow run:
from langgraph.checkpoint.memory import MemorySaver memory = MemorySaver() # in-memory, for development graph = graph_builder.compile(checkpointer=memory) config = {"configurable": {"thread_id": "user-123-session-1"}} # First invocation graph.invoke({"messages": [HumanMessage("Hello")]}, config) # Second invocation â LangGraph automatically loads the previous state graph.invoke({"messages": [HumanMessage("What did I say?")]}, config)
Checkpointer options: MemorySaver (in-process, ephemeral), SqliteSaver (persistent SQLite file, single-process), AsyncSqliteSaver (async SQLite), PostgresSaver / AsyncPostgresSaver (production multi-process). All implement the BaseCheckpointSaver interface, so switching backends requires only changing the checkpointer passed to compile().
More Related questions...