Memory and checkpointing in LangGraph

Text-to-Query Agents with MongoDB and LangGraph

Apoorva Joshi

Senior AI/ML Developer Advocate, MongoDB

Never forget memory!

agent_thinking.jpg

Text-to-Query Agents with MongoDB and LangGraph

scratchpad.png

Short-term memory
  • Holds context during the conversation
  • Usually doesn't persist beyond the session

books.png

Long-term memory
  • Stored knowledge
  • Can be recalled
Text-to-Query Agents with MongoDB and LangGraph

Memory in LangChain

 

thread_checkpoint.png

  • Checkpoints: captures agent state at a given time
    • Typically in-memory
  • Thread: the agent's conversation/workflow messages
Text-to-Query Agents with MongoDB and LangGraph

Remembering memory

mongosaver.png

 

  • MongoDBSaver → store checkpoints across runs
  • Can resume from checkpoints
  • NOT long-term memory!
Text-to-Query Agents with MongoDB and LangGraph

Remembering memory

mongosaver.png

 

  • MongoDBSaver → store checkpoints across runs
  • Can resume from checkpoints
  • NOT long-term memory!
  • MongoDBStore → long-term memory
1 https://www.mongodb.com/company/blog/product-release-announcements/powering-long-term-memory-for-agents-langgraph
Text-to-Query Agents with MongoDB and LangGraph

Summary

 

thread_checkpoint.png

  • Short-term memory: doesn't usually persist
  • LangChain approach → checkpoints and threads
  • MongoDBSaver persists checkpoints
Text-to-Query Agents with MongoDB and LangGraph

Let's practice!

Text-to-Query Agents with MongoDB and LangGraph

Preparing Video For Download...