Skip to content

AgentGroupChatMemberAttribute

NexusLabs.Needlr.AgentFramework

NexusLabs.Needlr.AgentFramework

AgentGroupChatMemberAttribute Class

Declares that a NeedlrAiAgentAttribute-annotated agent participates in a named group chat workflow. Apply this attribute to include the agent in a round-robin group chat created via CreateGroupChatWorkflow(string, int).

public sealed class AgentGroupChatMemberAttribute : System.Attribute

Inheritance System.Object 🡒 System.Attribute 🡒 AgentGroupChatMemberAttribute

Remarks

When the NexusLabs.Needlr.AgentFramework.Generators package is referenced, the source generator emits a strongly-typed extension method (e.g. CreateCodeReviewGroupChatWorkflow) on IWorkflowFactory for each unique group name declared across all agent types. The generated method encapsulates the group name string so the composition root never references it directly.

Constructors

AgentGroupChatMemberAttribute(string) Constructor

Initializes a new instance of AgentGroupChatMemberAttribute.

public AgentGroupChatMemberAttribute(string groupName);

Parameters

groupName System.String

The name of the group chat this agent participates in. Must match exactly (case-sensitive) when calling CreateGroupChatWorkflow(string, int). Use the generated extension method to avoid referencing the string directly.

Properties

AgentGroupChatMemberAttribute.GroupName Property

Gets the name of the group chat this agent participates in.

public string GroupName { get; }

Property Value

System.String

AgentGroupChatMemberAttribute.Order Property

Gets or sets the position of this agent in the round-robin turn order. Lower values run first. Agents with the same order are sorted alphabetically by type name for deterministic ordering.

public int Order { get; set; }

Property Value

System.Int32

Remarks

In a writer/reviewer group chat, the writer should have a lower order than the reviewer so it produces content before the reviewer evaluates it:

[AgentGroupChatMember("article-writing", Order = 1)]
public sealed class ArticleWriterAgent;

[AgentGroupChatMember("article-writing", Order = 2)]
public sealed class ArticleReviewerAgent;

Defaults to 0. When all agents have the default order, the round-robin position is determined alphabetically by type name.