Package org.bsc.langgraph4j.checkpoint
Class FileSystemSaver
java.lang.Object
org.bsc.langgraph4j.checkpoint.MemorySaver
org.bsc.langgraph4j.checkpoint.FileSystemSaver
- All Implemented Interfaces:
BaseCheckpointSaver
A CheckpointSaver that stores Checkpoints in the filesystem.
Each RunnableConfig is associated with a file in the provided targetFolder. The file is named "thread-threadId.saver" if the RunnableConfig has a threadId, or "thread-$default.saver" if it doesn't.
-
Constructor Summary
ConstructorDescriptionFileSystemSaver
(@NonNull Path targetFolder, @NonNull StateSerializer<? extends AgentState> stateSerializer) -
Method Summary
Modifier and TypeMethodDescriptionboolean
clear
(RunnableConfig config) Clears the checkpoint file associated with the given RunnableConfig.get
(RunnableConfig config) protected LinkedList<Checkpoint>
getCheckpoints
(RunnableConfig config) list
(RunnableConfig config) put
(RunnableConfig config, Checkpoint checkpoint) Methods inherited from class org.bsc.langgraph4j.checkpoint.MemorySaver
getLast
-
Constructor Details
-
FileSystemSaver
public FileSystemSaver(@NonNull @NonNull Path targetFolder, @NonNull @NonNull StateSerializer<? extends AgentState> stateSerializer)
-
-
Method Details
-
getCheckpoints
- Overrides:
getCheckpoints
in classMemorySaver
-
clear
Clears the checkpoint file associated with the given RunnableConfig.- Parameters:
config
- the RunnableConfig for which the checkpoint file should be cleared- Returns:
- true if the file existed and was successfully deleted, false otherwise
-
list
- Specified by:
list
in interfaceBaseCheckpointSaver
- Overrides:
list
in classMemorySaver
-
get
- Specified by:
get
in interfaceBaseCheckpointSaver
- Overrides:
get
in classMemorySaver
-
put
- Specified by:
put
in interfaceBaseCheckpointSaver
- Overrides:
put
in classMemorySaver
- Throws:
Exception
-