checkpoints.tools
Agent tools for conversation checkpointing.
Provides tool factory functions that return PydanticAI-compatible tool definitions so the agent can save, list, and rewind checkpoints.
save_checkpoint_tool_fn
def save_checkpoint_tool_fn(middleware: Any) -> dict[str, Any]
Create a save_checkpoint tool bound to the middleware.
Returns a dict describing the tool for PydanticAI registration.
list_checkpoints_tool_fn
def list_checkpoints_tool_fn(middleware: Any) -> dict[str, Any]
Create a list_checkpoints tool bound to the middleware.
rewind_to_tool_fn
def rewind_to_tool_fn(middleware: Any) -> dict[str, Any]
Create a rewind_to tool bound to the middleware.
When the agent calls this tool, a RewindRequested exception
propagates out of the agent run loop. The controlling application
code catches this, restores the message history from the checkpoint,
and restarts the agent.