Table of Contents

Class Conversation

Namespace
Emissary
Assembly
Emissary.dll

An immutable conversation: appending returns a new instance, so any point in an agent run can be kept, compared, or replayed without defensive copies.

public sealed class Conversation
Inheritance
Conversation
Inherited Members

Properties

Id

The stable identity of this conversation across appends.

public ConversationId Id { get; }

Property Value

ConversationId

Messages

The messages, oldest first.

public ImmutableList<Message> Messages { get; }

Property Value

ImmutableList<Message>

Methods

Append(Message)

Returns a new conversation with message appended.

public Conversation Append(Message message)

Parameters

message Message

The message to append.

Returns

Conversation

FromJson(string)

Deserializes a conversation previously produced by ToJson().

public static Conversation FromJson(string json)

Parameters

json string

The conversation JSON.

Returns

Conversation

Exceptions

InvalidOperationException

The JSON is the null literal.

Restore(ConversationId, IEnumerable<Message>)

Rebuilds a conversation from persisted state (e.g. a SuspendedRun).

public static Conversation Restore(ConversationId id, IEnumerable<Message> messages)

Parameters

id ConversationId

The original conversation id.

messages IEnumerable<Message>

The messages, oldest first.

Returns

Conversation

Start()

Starts a new, empty conversation with a fresh id.

public static Conversation Start()

Returns

Conversation

ToJson()

Serializes the conversation (id and messages) as JSON.

public string ToJson()

Returns

string