JVMFilePersistenceStorageProvider

class JVMFilePersistenceStorageProvider @JvmOverloads constructor(root: Path, json: Json = PersistenceUtils.defaultCheckpointJson) : FilePersistenceStorageProvider<Path> (source)

A JVM-specific implementation of FilePersistenceStorageProvider for managing agent checkpoints in a file system.

This class utilizes JVM's Path for file system operations and JVMFileSystemProvider.ReadWrite for file system access. It organizes checkpoints by agent ID in a structured directory format under the specified root directory.

Use this class to persistently store and retrieve agent checkpoints to and from a file-based system in JVM environments.

Parameters

root

The root directory where all agent checkpoints will be stored.

Constructors

Link copied to clipboard
constructor(root: Path, json: Json = PersistenceUtils.defaultCheckpointJson)

Initializes the JVMFilePersistenceStorageProvider with a specified root directory root.

Functions

Link copied to clipboard
open suspend fun getCheckpoints(sessionId: String): List<AgentCheckpointData>

Retrieves the list of checkpoints of the AI agent with the given sessionId

open suspend override fun getCheckpoints(sessionId: String, filter: AgentCheckpointPredicateFilter?): List<AgentCheckpointData>

Retrieves the list of checkpoints of the AI agent with the given sessionId that match the provided filter

Link copied to clipboard
open suspend fun getLatestCheckpoint(sessionId: String): AgentCheckpointData?

Retrieves the latest checkpoint of the AI agent with sessionId

open suspend override fun getLatestCheckpoint(sessionId: String, filter: AgentCheckpointPredicateFilter?): AgentCheckpointData?

Retrieves the latest checkpoint of the AI agent with sessionId matching the provided filter

Link copied to clipboard
open suspend override fun saveCheckpoint(sessionId: String, agentCheckpointData: AgentCheckpointData)

Saves provided checkpoint (agentCheckpointData) of the agent with sessionId to the storage (ex: database, S3, file)