Table of Contents

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

agent ClaudeAgent

The agent that runs each turn.

store IConversationStore

Where the conversation history is persisted.

id ConversationId

The 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

ConversationId

Methods

LoadOrStartAsync(CancellationToken)

Loads the stored conversation, or an empty one under this session's id.

public Task<Conversation> LoadOrStartAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Cancels the load.

Returns

Task<Conversation>

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

userText string

The user's message.

cancellationToken CancellationToken

Cancels the turn.

Returns

Task<AgentResult>