> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agentium.in/llms.txt
> Use this file to discover all available pages before exploring further.

# Checkpoints

> Public checkpoints signatures and configuration in @agentium/core 4.0.0.

Import these **2 exports** from `@agentium/core`. Read the [checkpoints guide](/features/checkpointing) for setup and behavior, or return to the [package reference](/api-reference/core).

A `?` marks an optional field. These are declarations for lookup; run the examples in the linked guide. Follow related-type links for Agentium types and source links for imported dependency types.

## Checkpoint

[Source](https://github.com/agentiumOS/agentium/blob/v4.0.0/packages/core/src/checkpoint/checkpoint-manager.ts)

```typescript theme={null}
export interface Checkpoint {
    id: string;
    runId: string;
    roundtrip: number;
    messages: ChatMessage[];
    tokenUsage: TokenUsage;
    sessionState: Record<string, unknown>;
    timestamp: Date;
}
```

Related: [`ChatMessage`](/api-reference/core/models#chatmessage), [`TokenUsage`](/api-reference/core/models#tokenusage).

## CheckpointManager

[Source](https://github.com/agentiumOS/agentium/blob/v4.0.0/packages/core/src/checkpoint/checkpoint-manager.ts)

```typescript theme={null}
export declare class CheckpointManager {
    constructor(storage?: StorageDriver);
    save(checkpoint: Omit<Checkpoint, "id" | "timestamp">): Promise<string>;
    load(checkpointId: string): Promise<Checkpoint | null>;
    list(runId: string): Promise<Checkpoint[]>;
    rollback(checkpointId: string): Promise<Checkpoint | null>;
    prune(maxAgeMs: number): Promise<number>;
    /**
     * Create an onRoundtripComplete hook for auto-checkpointing.
     */
    toOnRoundtripCompleteHook(runId: string, getMessages: () => ChatMessage[], getSessionState: () => Record<string, unknown>): (roundtrip: number, tokensSoFar: TokenUsage) => Promise<{
        stop?: boolean;
    } | void>;
}
```

Related: [`ChatMessage`](/api-reference/core/models#chatmessage), [`Checkpoint`](/api-reference/core/checkpoint#checkpoint), [`StorageDriver`](/api-reference/core/storage#storagedriver), [`TokenUsage`](/api-reference/core/models#tokenusage).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.