镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

.NET: DevUI - Agents created from workflows not available unless workflow is registered #1886

Closed

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

Labels

.NETUsage: [Issues, PRs], Target: .Net

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions