# Checkpoint DB

The Checkpoint DB is a persistent storage component in Canso's AI Agentic Systems that enables AI agents to save their progress, recover from failures, and maintain context across interactions. By persisting state and execution progress, it ensures reliability, scalability, and auditability for production-grade AI agents.

## Introduction

Checkpoint DB provides a reliable way to persist agent state and execution progress, enabling:

* Business Continuity: State persistence across agent restarts and failures ensures your operations continue smoothly even after system interruptions
* Conversation Intelligence: Context maintenance across multiple interactions enables more intelligent and personalized customer engagements
* Operational Visibility: Progress tracking for long-running agent tasks gives you real-time insights into your AI operations
* Compliance & Governance: Comprehensive audit trail of agent decisions and actions helps meet regulatory requirements and maintain accountability
* Risk Mitigation: Recovery mechanisms for interrupted workflows protect against data loss and ensure business operations can resume from where they left off

> **Note**: Currently, only Postgres is supported as a DB.

## Checkpoint DB Attributes

These attributes define how agent state and progress data is stored and accessed in the Checkpoint DB:

| Attribute | Description                            | Example                                           |
| --------- | -------------------------------------- | ------------------------------------------------- |
| `type`    | Type of database being used            | `postgres`                                        |
| `name`    | Unique name of the checkpoint database | `agent-checkpoints-db`                            |
| `size`    | Storage size allocation                | `8Gi`                                             |
| `details` | Connection and configuration details   | `{"service_url": "...", "admin_password": "..."}` |

## Use Cases

Checkpoint DB serves several critical functions in AI Agentic Systems:

### 1. State Persistence

* Saves agent state during execution
* Maintains conversation history and context
* Stores intermediate results and decisions

### 2. Recovery Management

* Enables agents to resume from last saved state
* Provides failure recovery mechanisms
* Maintains consistency during scaling events

### 3. Audit and Tracking

* Records agent actions and decisions
* Maintains execution history
* Enables debugging and performance analysis

## Working with Checkpoint DB

### Setup and Configuration

```yaml
checkpoint_db:
  type: postgres
  name: postgres
  size: 8Gi
```

Use the GRU cli to setup the checkpoint DB on your cluster based on the above configs.

```bash
gru component setup --cluster-name <cluster-name> --config-file config.yaml
```

### Integration with Agents

Agents can interact with the Checkpoint DB to:

* Save their current state (e.g., intermediate computation results or workflow checkpoints).
* Retrieve previous context for continuity in conversations or tasks.
* Record execution progress and decisions for audit trails.
* Store intermediate results during long-running operations.

## Deployment Considerations

When deploying Checkpoint DB:

1. **Resource Planning**
   * Allocate sufficient storage based on agent needs
   * Plan for backup storage

## Related Components

* **Task Server**: Interacts with Checkpoint DB to maintain task state
* **AI Agents**: Use Checkpoint DB to persist their state and progress

## Tool Tips

* Go to [Introduction](/ai-agents/intro.md) ⬅️
* See [Task Server](/ai-agents/concepts/task-server.md) ➡️
* Learn about [Broker](/ai-agents/concepts/broker.md) ➡️
* Explore [Memory](/ai-agents/concepts/conversations.md) ➡️


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.canso.ai/ai-agents/concepts/db.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
