Skip to content

InMemoryRunInputStore

Namespace AgentPrism · Assembly AgentPrism.Core.dll

The default store that keeps run inputs in memory.

public sealed class InMemoryRunInputStore : IRunInputStore

objectInMemoryRunInputStore

IRunInputStore

object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

The in-memory implementation is first class. Replay works in a deployment without a SQL provider. Records live for the process lifetime, and the oldest record is removed when InMemoryRunInputStore.MaxRuns is exceeded.

Messages are stored as objects here. Serialization occurs only in the SQL implementation, so polymorphic content is never lost on the in-memory path.

public InMemoryRunInputStore()

The maximum number of inputs to keep in memory. The oldest input is removed when this limit is exceeded.

public int MaxRuns { get; init; }

int

GetAsync(string, Guid, CancellationToken)

Section titled “ GetAsync(string, Guid, CancellationToken)”

Reads the stored input.

public ValueTask<RunInputRecord?> GetAsync(string tenantId, Guid runId, CancellationToken cancellationToken = default)

tenantId string

The tenant identifier.

runId Guid

The run identifier.

cancellationToken CancellationToken

The cancellation token.

ValueTask<RunInputRecord?>

The record; null if it does not exist or belongs to another tenant.

SaveAsync(RunInputRecord, CancellationToken)

Section titled “ SaveAsync(RunInputRecord, CancellationToken)”

Saves the input messages.

public ValueTask SaveAsync(RunInputRecord record, CancellationToken cancellationToken = default)

record RunInputRecord

The input to save.

cancellationToken CancellationToken

The cancellation token.

ValueTask

The completion task.

A second write for the same run is ignored: a queued run can start twice with the same identifier, and the input must not change.