Class ConversationSession
- Namespace
- Emissary
- Assembly
- Emissary.dll
A durable, resumable chat session: ties a ClaudeAgent to an IConversationStore by conversation id. Each turn loads the stored history, runs the agent, and persists the updated conversation — so a chatbot can resume by id across requests or restarts.
public sealed class ConversationSession
- Inheritance
-
ConversationSession
- Inherited Members
Constructors
ConversationSession(ClaudeAgent, IConversationStore, ConversationId)
Creates a session over an agent and store for a given conversation id.
public ConversationSession(ClaudeAgent agent, IConversationStore store, ConversationId id)
Parameters
agentClaudeAgentThe agent that runs each turn.
storeIConversationStoreWhere the conversation history is persisted.
idConversationIdThe conversation id; a fresh one starts a new chat.
Properties
Id
The conversation id this session reads and writes.
public ConversationId Id { get; }
Property Value
Methods
LoadOrStartAsync(CancellationToken)
Loads the stored conversation, or an empty one under this session's id.
public Task<Conversation> LoadOrStartAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenCancels the load.
Returns
SendAsync(string, CancellationToken)
Sends a user message, runs a turn on the stored history, persists it, and returns the outcome.
public Task<AgentResult> SendAsync(string userText, CancellationToken cancellationToken = default)
Parameters
userTextstringThe user's message.
cancellationTokenCancellationTokenCancels the turn.