# Checkpoints

## Get Checkpoint Tuple

**post** `/checkpoints/get-tuple`

Get Checkpoint Tuple

### Body Parameters

- `thread_id: string`

- `checkpoint_id: optional string`

- `checkpoint_ns: optional string`

### Returns

- `checkpoint: map[unknown]`

- `checkpoint_id: string`

- `checkpoint_ns: string`

- `metadata: map[unknown]`

- `thread_id: string`

- `blobs: optional array of object { channel, type, version, blob }`

  - `channel: string`

  - `type: string`

  - `version: string`

  - `blob: optional string`

- `parent_checkpoint_id: optional string`

- `pending_writes: optional array of object { channel, idx, task_id, 2 more }`

  - `channel: string`

  - `idx: number`

  - `task_id: string`

  - `blob: optional string`

  - `type: optional string`

### Example

```http
curl http://localhost:5003/checkpoints/get-tuple \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $AGENTEX_SDK_API_KEY" \
    -d '{
          "thread_id": "thread_id"
        }'
```

#### Response

```json
{
  "checkpoint": {
    "foo": "bar"
  },
  "checkpoint_id": "checkpoint_id",
  "checkpoint_ns": "checkpoint_ns",
  "metadata": {
    "foo": "bar"
  },
  "thread_id": "thread_id",
  "blobs": [
    {
      "channel": "channel",
      "type": "type",
      "version": "version",
      "blob": "blob"
    }
  ],
  "parent_checkpoint_id": "parent_checkpoint_id",
  "pending_writes": [
    {
      "channel": "channel",
      "idx": 0,
      "task_id": "task_id",
      "blob": "blob",
      "type": "type"
    }
  ]
}
```

## Put Checkpoint

**post** `/checkpoints/put`

Put Checkpoint

### Body Parameters

- `checkpoint: map[unknown]`

- `checkpoint_id: string`

- `thread_id: string`

- `blobs: optional array of object { channel, type, version, blob }`

  - `channel: string`

  - `type: string`

  - `version: string`

  - `blob: optional string`

- `checkpoint_ns: optional string`

- `metadata: optional map[unknown]`

- `parent_checkpoint_id: optional string`

### Returns

- `checkpoint_id: string`

- `checkpoint_ns: string`

- `thread_id: string`

### Example

```http
curl http://localhost:5003/checkpoints/put \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $AGENTEX_SDK_API_KEY" \
    -d '{
          "checkpoint": {
            "foo": "bar"
          },
          "checkpoint_id": "checkpoint_id",
          "thread_id": "thread_id"
        }'
```

#### Response

```json
{
  "checkpoint_id": "checkpoint_id",
  "checkpoint_ns": "checkpoint_ns",
  "thread_id": "thread_id"
}
```

## Put Writes

**post** `/checkpoints/put-writes`

Put Writes

### Body Parameters

- `checkpoint_id: string`

- `thread_id: string`

- `writes: array of object { blob, channel, idx, 3 more }`

  - `blob: string`

  - `channel: string`

  - `idx: number`

  - `task_id: string`

  - `task_path: optional string`

  - `type: optional string`

- `checkpoint_ns: optional string`

- `upsert: optional boolean`

### Example

```http
curl http://localhost:5003/checkpoints/put-writes \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $AGENTEX_SDK_API_KEY" \
    -d '{
          "checkpoint_id": "checkpoint_id",
          "thread_id": "thread_id",
          "writes": [
            {
              "blob": "blob",
              "channel": "channel",
              "idx": 0,
              "task_id": "task_id"
            }
          ]
        }'
```

## List Checkpoints

**post** `/checkpoints/list`

List Checkpoints

### Body Parameters

- `thread_id: string`

- `before_checkpoint_id: optional string`

- `checkpoint_ns: optional string`

- `filter_metadata: optional map[unknown]`

- `limit: optional number`

### Returns

- `checkpoint: map[unknown]`

- `checkpoint_id: string`

- `checkpoint_ns: string`

- `metadata: map[unknown]`

- `thread_id: string`

- `parent_checkpoint_id: optional string`

### Example

```http
curl http://localhost:5003/checkpoints/list \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $AGENTEX_SDK_API_KEY" \
    -d '{
          "thread_id": "thread_id"
        }'
```

#### Response

```json
[
  {
    "checkpoint": {
      "foo": "bar"
    },
    "checkpoint_id": "checkpoint_id",
    "checkpoint_ns": "checkpoint_ns",
    "metadata": {
      "foo": "bar"
    },
    "thread_id": "thread_id",
    "parent_checkpoint_id": "parent_checkpoint_id"
  }
]
```

## Delete Thread

**post** `/checkpoints/delete-thread`

Delete Thread

### Body Parameters

- `thread_id: string`

### Example

```http
curl http://localhost:5003/checkpoints/delete-thread \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $AGENTEX_SDK_API_KEY" \
    -d '{
          "thread_id": "thread_id"
        }'
```

## Domain Types

### Checkpoint Get Tuple Response

- `CheckpointGetTupleResponse object { checkpoint, checkpoint_id, checkpoint_ns, 5 more }`

  - `checkpoint: map[unknown]`

  - `checkpoint_id: string`

  - `checkpoint_ns: string`

  - `metadata: map[unknown]`

  - `thread_id: string`

  - `blobs: optional array of object { channel, type, version, blob }`

    - `channel: string`

    - `type: string`

    - `version: string`

    - `blob: optional string`

  - `parent_checkpoint_id: optional string`

  - `pending_writes: optional array of object { channel, idx, task_id, 2 more }`

    - `channel: string`

    - `idx: number`

    - `task_id: string`

    - `blob: optional string`

    - `type: optional string`

### Checkpoint Put Response

- `CheckpointPutResponse object { checkpoint_id, checkpoint_ns, thread_id }`

  - `checkpoint_id: string`

  - `checkpoint_ns: string`

  - `thread_id: string`

### Checkpoint List Response

- `CheckpointListResponse = array of object { checkpoint, checkpoint_id, checkpoint_ns, 3 more }`

  - `checkpoint: map[unknown]`

  - `checkpoint_id: string`

  - `checkpoint_ns: string`

  - `metadata: map[unknown]`

  - `thread_id: string`

  - `parent_checkpoint_id: optional string`
