Skip to content

.NET: Cannot add group chat as workflow #1885

@jeffhandley

Description

@jeffhandley

With the following code, an error is received:

System.InvalidOperationException: 'The workflow factory returned workflow with name '', but the expected name is 'story-creation-workflow'.'

builder.Services.AddChatClient(chatClient);

builder.AddAIAgent("writer", "You write short stories about the specific topic.");
builder.AddAIAgent("editor", "You edit short stories to improve grammar and style.");

builder.AddWorkflow("story-creation-workflow", (sp, name) =>
{
    var writer = sp.GetRequiredKeyedService<AIAgent>("writer");
    var editor = sp.GetRequiredKeyedService<AIAgent>("editor");

    var groupChatBuilder = AgentWorkflowBuilder.CreateGroupChatBuilderWith(
        agents => new RoundRobinGroupChatManager(
            agents,
            (manager, messages, cancellationToken) => ValueTask.FromResult(messages.LastOrDefault()?.AuthorName == editor.Name)
        )
        { MaximumIterationCount = 4 }
    );

    return groupChatBuilder.AddParticipants(writer, editor).Build();
});

I cannot find a way to use CreateGroupChatBuilderWith() or otherwise create a group chat workflow with a name for it to be added as a workflow.

Metadata

Metadata

Assignees

Labels

.NETagent orchestrationIssues related to agent orchestrationv1.0Features being tracked for the version 1.0 GAworkflowsRelated to Workflows in agent-framework

Type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions