MongoDB replica set checkpoints
If your application already uses a MongoDB replica set, you can save conversation and workflow progress in the same database. Managed checkpoints have been validated on a MongoDB 7.0 replica set.
New deployments
Connect using a replica set name and multiple member addresses. Use the same MongoClient instance and database for the saver, the blob store, and parent and child graphs you need to fork together. Across application instances, keep the serializer and blob namespace consistent. A new database uses the new checkpoint format by default.
import com.alibaba.cloud.ai.graph.checkpoint.savers.mongo.MongoCheckpointBlobStore;
import com.alibaba.cloud.ai.graph.checkpoint.savers.mongo.MongoSaver;
var saver = MongoSaver.builder()
.client(mongoClient)
.databaseName("check_point_db")
.build();
var blobs = new MongoCheckpointBlobStore(mongoClient, "check_point_db", "support-workflow");
Register saver with the graph. For extracted text or other values that could exceed MongoDB's document size limit, follow the large state guide to attach blobs and offload that key.
Upgrade existing checkpoints
- Back up the checkpoint database and reserve space for a copy of old history. Keep the original database and serializer, and make sure the migration account can create collections and indexes.
- Follow the rolling upgrade guide to upgrade all instances. Drain old runs, writes, and archive jobs, then call
activateManagedCheckpointWrites(). Restart the application or rebuild the saver and recompile the graph. - Verify recovery and history with the original
threadId. The upgraded saver picks up identifiable old records, preserving IDs and order. Old archives whose thread mappings are missing and any custom blob storage need separate migration.
Blob garbage collection defaults to observation only. See retention, collection, and monitoring.