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().
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
