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
Messages
The messages, oldest first.
public ImmutableList<Message> Messages { get; }
Property Value
Methods
Append(Message)
Returns a new conversation with message appended.
public Conversation Append(Message message)
Parameters
messageMessageThe message to append.
Returns
FromJson(string)
Deserializes a conversation previously produced by ToJson().
public static Conversation FromJson(string json)
Parameters
jsonstringThe conversation JSON.
Returns
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
idConversationIdThe original conversation id.
messagesIEnumerable<Message>The messages, oldest first.
Returns
Start()
Starts a new, empty conversation with a fresh id.
public static Conversation Start()
Returns
ToJson()
Serializes the conversation (id and messages) as JSON.
public string ToJson()