Table of Contents

Interface IAgentStateStore

Namespace
Emissary
Assembly
Emissary.dll

Persists suspended runs between the suspension and the (possibly much later) approval. Implementations decide durability: in-memory, database, blob storage.

public interface IAgentStateStore

Methods

DeleteAsync(Guid, CancellationToken)

Removes a suspended run, returning true if this call is the one that removed it and false if it was already gone.

Task<bool> DeleteAsync(Guid conversationId, CancellationToken cancellationToken = default)

Parameters

conversationId Guid
cancellationToken CancellationToken

Returns

Task<bool>

Remarks

The return value is how a caller claims a run: resuming executes the privileged tool call a human just approved, so two concurrent approvals of the same run must not both proceed. Implementations must make the check-and-remove atomic — one winner, whatever the concurrency.

LoadAsync(Guid, CancellationToken)

Loads a suspended run, or null if none exists for the id.

Task<SuspendedRun?> LoadAsync(Guid conversationId, CancellationToken cancellationToken = default)

Parameters

conversationId Guid
cancellationToken CancellationToken

Returns

Task<SuspendedRun>

SaveAsync(SuspendedRun, CancellationToken)

Saves a suspended run, keyed by its conversation id.

Task SaveAsync(SuspendedRun run, CancellationToken cancellationToken = default)

Parameters

run SuspendedRun
cancellationToken CancellationToken

Returns

Task