Skip to main content
Version: 2.1.x

Local file and in-memory checkpoints

Use FileSystemSaver when a single-host application must resume after restarting. For local development or single-process tests, use MemorySaver and reuse the same saver instance for recovery. In-memory checkpoints disappear when the process exits.

Configure a saver​

New directories and new in-memory savers use the new checkpoint format by default. The local file system must support file locks, atomic replacement, and directory sync. Local processes must share the same real directory. Back up the entire directory. For multi-host deployments, use a database saver.

var saver = FileSystemSaver.builder()
.targetFolder(Path.of("/var/lib/my-app/graph"))
.build();
var blobs = saver.checkpointBlobStore("my-graph");

Register saver with the graph. For an in-memory test, use MemorySaver.builder().build(). To offload large keys, attach blobs as shown in the large state guide.

Upgrade existing files​

  1. Back up the entire directory and reserve space for a copy of the old history. Upgrade the application using the rolling upgrade guide.
  2. Stop all runs and archive jobs writing to the directory. Call activateManagedCheckpointWrites(), then restart the application or rebuild the saver and recompile the graph.
  3. Verify recovery using the original threadId. Existing active records are directly recoverable. To recover a specific old -vN.saver archive, identify its thread, copy that file into an isolated directory as thread-<id>.saver, and recover from that directory.

Blob garbage collection defaults to observation only. Prune new archives according to your retention policy with pruneArchivedThreads(retention, batchSize). See retention, collection, and monitoring.

Spring AI Alibaba 开源项目基于 Spring AI 构建,是阿里云通义系列模型及服务在 Java AI 应用开发领域的最佳实践,提供高层次的 AI API 抽象与云原生基础设施集成方案,帮助开发者快速构建 AI 应用。

浙ICP备2021005855号-33