---
title: "Manage checkpoints"
description: "Learn how to manage checkpoints in the AI agent."
canonical_url: "https://tiptap.dev/docs/content-ai/capabilities/agent/features/checkpoints"
---

# Manage checkpoints

Learn how to manage checkpoints in the AI agent.

Checkpoints are snapshots of the editor's content and conversation state at a specific point in time. They allow you to save the current state of the document and conversation, and restore it later if needed.

## Setting a checkpoint

To create a checkpoint, use the `setCheckpoint` method:

```tsx
const checkpointMessage = provider.setCheckpoint()
```

This method returns a checkpoint message that includes the current chat messages and editor content.

## Restoring a checkpoint

To restore a previously saved checkpoint, use the `restoreCheckpoint` method:

```tsx
provider.restoreCheckpoint(checkpointMessage.checkpoint)
```

This will revert the editor content and conversation messages to the point when the checkpoint was created.

## Automatic checkpoints

You can configure the provider to automatically save checkpoints when the user sends a message:

```tsx
const provider = new AiAgentProvider({
  // ...other options
  autoSaveCheckpoints: true,
})
```

When `autoSaveCheckpoints` is enabled, checkpoints are saved before a user message is sent and before a tool is called. To save a checkpoint at other times, you can call `setCheckpoint` manually.
