41 lines
1.4 KiB
C#
Raw Normal View History

2025-01-27 10:25:00 -05:00
// Copyright (c) Microsoft Corporation. All rights reserved.
2025-01-27 12:12:13 -05:00
// MessageContext.cs
2025-01-27 10:25:00 -05:00
namespace Microsoft.AutoGen.Contracts.Python;
2025-01-27 15:12:20 -05:00
/// <summary>
/// Represents the context of a message being sent within the agent runtime.
/// This includes metadata such as the sender, topic, RPC status, and cancellation handling.
/// </summary>
2025-01-27 10:25:00 -05:00
public class MessageContext(string messageId, CancellationToken cancellationToken)
{
2025-01-27 15:12:20 -05:00
/// <summary>
/// Gets or sets the unique identifier for this message.
/// </summary>
2025-01-27 10:25:00 -05:00
public string MessageId { get; set; } = messageId;
2025-01-27 15:12:20 -05:00
/// <summary>
/// Gets or sets the cancellation token associated with this message.
/// This can be used to cancel the operation if necessary.
/// </summary>
2025-01-27 10:25:00 -05:00
public CancellationToken CancellationToken { get; set; } = cancellationToken;
2025-01-27 15:12:20 -05:00
/// <summary>
/// Gets or sets the sender of the message.
/// If <c>null</c>, the sender is unspecified.
/// </summary>
2025-01-27 10:25:00 -05:00
public AgentId? Sender { get; set; }
2025-01-27 15:12:20 -05:00
/// <summary>
/// Gets or sets the topic associated with the message.
/// If <c>null</c>, the message is not tied to a specific topic.
/// </summary>
2025-01-27 10:25:00 -05:00
public TopicId? Topic { get; set; }
2025-01-27 15:12:20 -05:00
/// <summary>
/// Gets or sets a value indicating whether this message is part of an RPC (Remote Procedure Call).
/// </summary>
2025-01-27 10:25:00 -05:00
public bool IsRpc { get; set; }
}