Interface IConversationStore

Assembly: redb.Route.Llm.dll

Persists conversation transcripts so that an agent run can be resumed,
branched, or replayed offline. The contract is intentionally tree-shaped:
every message has an optional parent identifier, which lets callers branch
from any node — required to model regenerate / parallel tool-calls / what-if
flows. The flat "append-only history" pattern falls out naturally when the
caller always passes the previously-appended message id as parentId.

The optional exchange parameter on every method carries the current
route exchange when the call originates from inside a route pipeline.
REDB-backed implementations resolve a per-exchange IRedbService
(and its named siblings via ) through
IRouteContext.GetRedbService(name, exchange), which already manages
per-exchange scopes and disposal. In-memory implementations ignore it.
Without an exchange a redb-backed implementation opens a redb scope of its own for the call. That scope joins an
ambient (a , a
route's .Transacted()) as every redb connection does, but not a transaction begun on the context's shared
IRedbService (ExecuteAtomicAsync, BeginTransaction), which it does not see: pass the exchange,
or use a TransactionScope, when the call must commit or roll back with that work. In-memory implementations
take part in no transaction.

public interface IConversationStore

Methods

AppendAsync(string, string?, LlmMessage, ConversationMessageMeta, IExchange?, CancellationToken)

Appends message as a child of parentId

Task<string> AppendAsync(string conversationId, string? parentId, LlmMessage message, ConversationMessageMeta meta, IExchange? exchange = null, CancellationToken ct = default)

LoadPathAsync(string, string?, IExchange?, CancellationToken)

Loads the linear path from the conversation root to leafId.

Task<IReadOnlyList<ConversationMessage>> LoadPathAsync(string conversationId, string? leafId = null, IExchange? exchange = null, CancellationToken ct = default)

LoadTreeAsync(string, IExchange?, CancellationToken)

Loads the full tree for the conversation (every branch). Used for

Task<IReadOnlyList<ConversationMessage>> LoadTreeAsync(string conversationId, IExchange? exchange = null, CancellationToken ct = default)