InMemoryWorkflowCheckpointStore
AgentPrism.Core.dllStores workflow checkpoints in process memory.
public sealed class InMemoryWorkflowCheckpointStore : IWorkflowCheckpointStoreInheritance
Section titled “Inheritance”object ← InMemoryWorkflowCheckpointStore
Implements
Section titled “Implements”Inherited Members
Section titled “Inherited Members”object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Remarks
Section titled “Remarks”In-memory checkpoints are limited to the process lifetime. This is a
deliberate constraint: durable resumption requires UsePostgreSql,
and hiding that would cause a “checkpoint disappeared” surprise after an
application restart.
To prevent unbounded growth, InMemoryWorkflowCheckpointStore.MaxCheckpointsPerSession limits checkpoints held per session and discards the oldest one.
Constructors
Section titled “Constructors”InMemoryWorkflowCheckpointStore()
Section titled “ InMemoryWorkflowCheckpointStore()”public InMemoryWorkflowCheckpointStore()Fields
Section titled “Fields”MaxCheckpointsPerSession
Section titled “ MaxCheckpointsPerSession”Gets the maximum checkpoints held in memory for a session.
public const int MaxCheckpointsPerSession = 50Field Value
Section titled “Field Value”Methods
Section titled “Methods”CreateAsync(WorkflowCheckpointRecord, CancellationToken)
Section titled “ CreateAsync(WorkflowCheckpointRecord, CancellationToken)”Writes a new checkpoint.
public ValueTask<WorkflowCheckpointRecord> CreateAsync(WorkflowCheckpointRecord record, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”record WorkflowCheckpointRecord
The record to write.
cancellationToken CancellationToken
The cancellation token.
Returns
Section titled “Returns”ValueTask<WorkflowCheckpointRecord>
The written record.
DeleteAsync(string, string, CancellationToken)
Section titled “ DeleteAsync(string, string, CancellationToken)”Deletes all of a session’s checkpoints.
public ValueTask<int> DeleteAsync(string tenantId, string sessionId, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”tenantId string
The tenant identifier.
sessionId string
The execution session identifier.
cancellationToken CancellationToken
The cancellation token.
Returns
Section titled “Returns”The number of records deleted.
ListAsync(string, string, CancellationToken)
Section titled “ ListAsync(string, string, CancellationToken)”Lists a session’s checkpoints, oldest to newest. The state payload is not read; only metadata is returned.
public ValueTask<IReadOnlyList<WorkflowCheckpointRecord>> ListAsync(string tenantId, string sessionId, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”tenantId string
The tenant identifier.
sessionId string
The execution session identifier.
cancellationToken CancellationToken
The cancellation token.
Returns
Section titled “Returns”ValueTask<IReadOnlyList<WorkflowCheckpointRecord>>
The records.
ListByRunAsync(string, Guid, CancellationToken)
Section titled “ ListByRunAsync(string, Guid, CancellationToken)”Lists the checkpoints a single run produced, oldest to newest. The state payload is not read.
public ValueTask<IReadOnlyList<WorkflowCheckpointRecord>> ListByRunAsync(string tenantId, Guid runId, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”tenantId string
The tenant identifier.
runId Guid
The run identifier.
cancellationToken CancellationToken
The cancellation token.
Returns
Section titled “Returns”ValueTask<IReadOnlyList<WorkflowCheckpointRecord>>
The records.
Remarks
Section titled “Remarks”Separate from the session-based list: a session can carry multiple runs (resuming opens a new run each time), and the UI asks “where can this run be resumed from.”
ReadAsync(string, string, string, CancellationToken)
Section titled “ ReadAsync(string, string, string, CancellationToken)”Reads a single checkpoint’s state.
public ValueTask<JsonElement?> ReadAsync(string tenantId, string sessionId, string checkpointId, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”tenantId string
The tenant identifier.
sessionId string
The execution session identifier.
checkpointId string
The checkpoint identifier.
cancellationToken CancellationToken
The cancellation token.
Returns
Section titled “Returns”The opaque state; null if the record does not exist or belongs to another tenant.