Skip to main content

Class: InMemoryCheckpointStore

Defined in: packages/agentos/src/orchestration/checkpoint/InMemoryCheckpointStore.ts:50

In-memory ICheckpointStore implementation.

All checkpoints are stored in a Map keyed by checkpoint id. Scans are O(n) over the number of stored checkpoints — acceptable for test workloads; a production store should use indexed secondary keys (runId, graphId).

Example

const store = new InMemoryCheckpointStore();
await store.save(checkpoint);
const restored = await store.latest(runId);

Implements

Constructors

Constructor

new InMemoryCheckpointStore(): InMemoryCheckpointStore

Returns

InMemoryCheckpointStore

Methods

delete()

delete(checkpointId): Promise<void>

Defined in: packages/agentos/src/orchestration/checkpoint/InMemoryCheckpointStore.ts:102

Permanently remove a checkpoint from the store.

Silently succeeds when checkpointId does not exist.

Parameters

checkpointId

string

The checkpoint to remove.

Returns

Promise<void>

Implementation of

ICheckpointStore.delete


fork()

fork(checkpointId, patchState?): Promise<string>

Defined in: packages/agentos/src/orchestration/checkpoint/InMemoryCheckpointStore.ts:107

Create a new run branching from an existing checkpoint.

The operation deep-clones the source checkpoint, assigns a fresh runId and checkpoint id, applies any patchState overrides, persists the new checkpoint, and returns the new runId.

Parameters

checkpointId

string

The checkpoint to fork from.

patchState?

Partial<GraphState<unknown, unknown, unknown>>

Optional partial GraphState overrides applied after cloning.

Returns

Promise<string>

The new runId for the forked run.

Implementation of

ICheckpointStore.fork


get()

get(checkpointId): Promise<Checkpoint | null>

Defined in: packages/agentos/src/orchestration/checkpoint/InMemoryCheckpointStore.ts:60

Load a checkpoint by its unique checkpoint identifier.

Parameters

checkpointId

string

The exact checkpoint id assigned at save-time.

Returns

Promise<Checkpoint | null>

The matching checkpoint, or null when none exists.

Implementation of

ICheckpointStore.get


latest()

latest(runId): Promise<Checkpoint | null>

Defined in: packages/agentos/src/orchestration/checkpoint/InMemoryCheckpointStore.ts:78

Return the most recently persisted checkpoint for a run, or null when the run has no checkpoints.

Parameters

runId

string

The graph run identifier.

Returns

Promise<Checkpoint | null>

Implementation of

ICheckpointStore.latest


list()

list(graphId, options?): Promise<CheckpointMetadata[]>

Defined in: packages/agentos/src/orchestration/checkpoint/InMemoryCheckpointStore.ts:83

List lightweight metadata descriptors for all checkpoints belonging to a graph.

Parameters

graphId

string

The compiled graph identifier.

options?
limit?

number

runId?

string

Returns

Promise<CheckpointMetadata[]>

Array of CheckpointMetadata, sorted by timestamp descending.

Implementation of

ICheckpointStore.list


load()

load(runId, nodeId?): Promise<Checkpoint | null>

Defined in: packages/agentos/src/orchestration/checkpoint/InMemoryCheckpointStore.ts:65

Load a checkpoint for the given runId.

When nodeId is supplied, returns the most recent checkpoint for that specific node within the run. When nodeId is omitted, returns the most recent checkpoint for the run regardless of node (equivalent to latest(runId)).

Parameters

runId

string

The graph run identifier.

nodeId?

string

Optional node filter.

Returns

Promise<Checkpoint | null>

The matching checkpoint, or null when none exists.

Implementation of

ICheckpointStore.load


save()

save(checkpoint): Promise<void>

Defined in: packages/agentos/src/orchestration/checkpoint/InMemoryCheckpointStore.ts:55

Persist a checkpoint snapshot.

If a checkpoint with the same id already exists it is overwritten.

Parameters

checkpoint

Checkpoint

The snapshot to persist.

Returns

Promise<void>

Implementation of

ICheckpointStore.save