Setup
Installation
Credentials
Set your Atlas connection string:Usage
Create aMongoDBSaver with from_conn_string and pass it to create_agent. The context manager creates the required collections and indexes when it opens. You do not call a separate setup() method (unlike the Postgres checkpointer).
MongoDBSaver also exposes async methods such as aget and aput for use in async graphs. There is no separate AsyncMongoDBSaver class.
Next steps
- Customize agent state, trim or summarize history, and access memory from tools in the short-term memory guide. Pass the same
MongoDBSaverascheckpointer. - See the checkpointer integrations list for other backends.
- For cross-thread persistence, see long-term memory with MongoDB Atlas.
Connect these docs to Claude, VSCode, and more via MCP for real-time answers.

