Skip to content

.NET: Update GroupChat workflow builder to support name and description#4334

Open
peibekwe wants to merge 3 commits intomainfrom
peibekwe/fix-groupchat-with-name
Open

.NET: Update GroupChat workflow builder to support name and description#4334
peibekwe wants to merge 3 commits intomainfrom
peibekwe/fix-groupchat-with-name

Conversation

@peibekwe
Copy link
Contributor

Description

This PR updates the GroupChatWorkflowBuilder to support name and description on the workflow for better user experience using DevUI.

Fixes #1885

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

@markwallace-microsoft markwallace-microsoft added .NET workflows Related to Workflows in agent-framework labels Feb 26, 2026
@github-actions github-actions bot changed the title Update GroupChat workflow builder to support name and description .NET: Update GroupChat workflow builder to support name and description Feb 26, 2026
@peibekwe peibekwe marked this pull request as ready for review February 26, 2026 23:11
Copilot AI review requested due to automatic review settings February 26, 2026 23:11
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances the GroupChatWorkflowBuilder by adding support for setting a name and description on workflows, improving the developer experience when using DevUI.

Changes:

  • Added WithName() and WithDescription() methods to GroupChatWorkflowBuilder
  • Updated the Build() method to apply name and description to the workflow when provided
  • Added comprehensive unit tests covering various scenarios for name and description settings

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
GroupChatWorkflowBuilder.cs Added private fields for name/description and new builder methods to set them; updated Build() to conditionally apply these values
AgentWorkflowBuilderTests.cs Added three new unit tests to verify name/description behavior in different scenarios
Program.cs Demonstrated usage by adding name and description to the round-robin translation workflow example

Comment on lines +19 to +20
private string _name = string.Empty;
private string _description = string.Empty;
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initializing _name and _description to string.Empty will prevent them from being null when not set, but the tests expect null values. Consider initializing these fields to null (private string? _name; private string? _description;) to match the expected behavior shown in the test BuildGroupChat_WithoutNameOrDescription_DefaultsToNull.

Suggested change
private string _name = string.Empty;
private string _description = string.Empty;
private string? _name;
private string? _description;

Copilot uses AI. Check for mistakes.
/// </summary>
/// <param name="name">The name of the workflow.</param>
/// <returns>This instance of the <see cref="GroupChatWorkflowBuilder"/>.</returns>
public GroupChatWorkflowBuilder WithName(string name)
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The WithName method does not validate if the name parameter is null. Consider adding null validation or documenting the expected behavior when null is passed, especially since the field is initialized to string.Empty.

Copilot uses AI. Check for mistakes.
/// <param name="description">The description of what the workflow does.</param>
/// <returns>This instance of the <see cref="GroupChatWorkflowBuilder"/>.</returns>
public GroupChatWorkflowBuilder WithDescription(string description)
{
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The WithDescription method does not validate if the description parameter is null. Consider adding null validation or documenting the expected behavior when null is passed, especially since the field is initialized to string.Empty.

Suggested change
{
{
Throw.IfNull(description);

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

.NET workflows Related to Workflows in agent-framework

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.NET: Cannot add group chat as workflow

4 participants