diff --git a/dotnet/src/Microsoft.AutoGen/Contracts/PythonEquiv/AgentId.cs b/dotnet/src/Microsoft.AutoGen/Contracts/PythonEquiv/AgentId.cs
index 23d56eee9..440436c1e 100644
--- a/dotnet/src/Microsoft.AutoGen/Contracts/PythonEquiv/AgentId.cs
+++ b/dotnet/src/Microsoft.AutoGen/Contracts/PythonEquiv/AgentId.cs
@@ -6,30 +6,74 @@ using System.Diagnostics.CodeAnalysis;
namespace Microsoft.AutoGen.Contracts.Python;
+///
+/// Agent ID uniquely identifies an agent instance within an agent runtime, including a distributed runtime.
+/// It serves as the "address" of the agent instance for receiving messages.
+///
+/// See the Python equivalent:
+/// AgentId in AutoGen (Python).
+///
[DebuggerDisplay($"AgentId(type=\"{nameof(Type)}\", key=\"{nameof(Key)}\")")]
public struct AgentId
{
+ ///
+ /// An identifier that associates an agent with a specific factory function.
+ /// Strings may only be composed of alphanumeric letters (a-z) and (0-9), or underscores (_).
+ ///
public string Type;
+
+ ///
+ /// Agent instance identifier.
+ /// Strings may only be composed of alphanumeric letters (a-z) and (0-9), or underscores (_).
+ ///
public string Key;
+ ///
+ /// Initializes a new instance of the struct.
+ ///
+ /// The agent type.
+ /// Agent instance identifier.
public AgentId(string type, string key)
{
Type = type;
Key = key;
}
+ ///
+ /// Initializes a new instance of the struct from a tuple.
+ ///
+ /// A tuple containing the agent type and key.
public AgentId((string Type, string Key) kvPair) : this(kvPair.Type, kvPair.Key)
{
}
+ ///
+ /// Initializes a new instance of the struct from an .
+ ///
+ /// The agent type.
+ /// Agent instance identifier.
public AgentId(AgentType type, string key) : this(type.Name, key)
{
}
+ ///
+ /// Convert a string of the format "type/key" into an .
+ ///
+ /// The agent ID string.
+ /// An instance of .
public static AgentId FromStr(string maybeAgentId) => new AgentId(maybeAgentId.ToKVPair(nameof(Type), nameof(Key)));
+ ///
+ /// Returns the string representation of the .
+ ///
+ /// A string in the format "type/key".
public override string ToString() => $"{Type}/{Key}";
+ ///
+ /// Determines whether the specified object is equal to the current .
+ ///
+ /// The object to compare with the current instance.
+ /// true if the specified object is equal to the current ; otherwise, false.
public override bool Equals([NotNullWhen(true)] object? obj)
{
if (obj is AgentId other)
@@ -40,11 +84,20 @@ public struct AgentId
return false;
}
+ ///
+ /// Returns a hash code for this .
+ ///
+ /// A hash code for the current instance.
public override int GetHashCode()
{
return HashCode.Combine(Type, Key);
}
+ ///
+ /// Explicitly converts a string to an .
+ ///
+ /// The string representation of an agent ID.
+ /// An instance of .
public static explicit operator AgentId(string id) => FromStr(id);
}