rollbackToCheckpoint

suspend fun rollbackToCheckpoint(checkpointId: String, agentContext: AIAgentContext): AgentCheckpointData?(source)

Rolls back an agent's state to a specific checkpoint.

This method retrieves the checkpoint with the specified ID and, if found, sets the agent's context to the state captured in that checkpoint.

Note: If some of your tools had side-effects and you need to roll back to some older state, please consider providing RollbackToolRegistry. This would only work if you are always trying to rollback BACKWARDS in time!

Return

The checkpoint data that was restored or null if the checkpoint was not found

Parameters

checkpointId

The ID of the checkpoint to roll back to

agentContext

The context of the agent to roll back