Short-term memory with MongoDBSaver, long-term memory with MongoDBStore and Atlas Vector Search, in one small Python script.
Most agent demos have the memory of a goldfish. Restart the process and the conversation is gone. Open a new chat and the agent has no idea you told it your preferences yesterday.
In LangGraph this is not a model problem, it is a storage problem. The framework already has two clean slots for memory: a checkpointer and a store. You just have to plug something durable into them. In this post I wire both to MongoDB Atlas, so one database holds the conversation state and the facts the agent learns about each user.
Two kinds of memory, one database
LangGraph splits memory into two jobs:
Short-term memory lives inside a thread (one conversation). The checkpointer saves the full graph state after every step, so a thread can resume after a crash or a redeploy. MongoDBSaver from langgraph-checkpoint-mongodb does this.
Long-term memory lives across threads.…