Package-level declarations

Types

Link copied to clipboard
data class AgentCheckpointData(val checkpointId: String, val createdAt: Instant, val nodeId: String, val lastInput: JsonElement, val messageHistory: List<Message>, val version: Long, val properties: Map<String, JsonElement>? = null)

Represents the checkpoint data for an agent's state during a session.

Link copied to clipboard
class Persistence(persistenceStorageProvider: PersistenceStorageProvider<*>, clock: Clock = Clock.System)

A feature that provides checkpoint functionality for AI agents.

Link copied to clipboard

Configuration class for the Snapshot feature.

Link copied to clipboard
Link copied to clipboard

A registry for managing and retrieving rollback tools associated with specific tools. This class allows for the association of tools that have rollback counterparts and provides mechanisms for retrieval and addition of such tools.

Functions

Link copied to clipboard
fun RollbackToolRegistry.add(toolFunction: KFunction<*>, rollbackToolFunction: KFunction<*>)

Adds a tool and its corresponding rollback tool to the registry. This convenience method converts both toolFunction and rollbackToolFunction into Tool objects before adding them.

Link copied to clipboard

Checks whether the AgentCheckpointData instance is marked as a tombstone.

Link copied to clipboard

Extension function to access the checkpoint feature from an agent.

Extension function to access the checkpoint feature from an agent context.

Link copied to clipboard
fun RollbackToolRegistry.Builder.registerRollback(toolFunction: KFunction<*>, rollbackToolFunction: KFunction<*>)

Registers a relationship between a tool and its corresponding rollback tool using the specified functions.

Link copied to clipboard
inline fun <T> serializeInput(input: T?): String?
Link copied to clipboard
fun AgentCheckpointData.toAgentContextData(rollbackStrategy: RollbackStrategy, additionalRollbackAction: suspend (AIAgentContext) -> Unit = {}): AgentContextData

Converts an instance of AgentCheckpointData to AgentContextData.

Link copied to clipboard
fun tombstoneCheckpoint(time: Instant, version: Long): AgentCheckpointData

Creates a tombstone checkpoint for an agent's session. A tombstone checkpoint represents a placeholder state with no real interactions or messages, intended to mark a terminated or invalid session.

Link copied to clipboard
suspend fun <T> StatefulSingleUseAIAgent<*, *, *>.withPersistence(action: suspend Persistence.(AIAgentContext) -> T): T

Executes the provided action within the context of the agent's persistence layer if the agent is in a running state.

suspend fun <T> AIAgentContext.withPersistence(action: suspend Persistence.(AIAgentContext) -> T): T

Executes the provided action within the context of the AI agent's persistence layer.