-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Closed
Copy link
Labels
Description
To work around .NET: Cannot add group chat as workflow (#1885), I tried skipping the step of adding the workflow and just directly creating an agent from the workflow with the code below.
When using the DevUI from .NET: Add DevUI package for .NET (#1603), the agent created from the workflow is filtered out of the list of agents though, and since the workflow is not registered, I cannot access this workflow agent.
See this comment thread for more context:
https://github.com/microsoft/agent-framework/pull/1603/files#r2453734961
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.AddAIAgent("publisher", (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 }
);
var groupChatWorkflow = groupChatBuilder
.AddParticipants(writer, editor)
.Build();
return groupChatWorkflow.AsAgent(name: name);
});Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done