Skip to content

.NET: [Bug]: DurableAIAgentProxy is not compatible with MapAGUI #6061

@kpobb1989

Description

@kpobb1989

Description

I'm trying to build a ASP.NET Core front door with Durable Task Scheduler behind it for long-running operations and AG-UI.

But according to the source code, the DurableAIAgentProxy does not support streaming; however, MapAGUI uses SSE and requires streaming.

I also opened the dicussion : #5900

Code Sample

// Program.cs
using Microsoft.Agents.AI;
using Microsoft.Agents.AI.DurableTask;
using Microsoft.Agents.AI.Hosting.AGUI.AspNetCore;
using Microsoft.Extensions.AI;
using OpenAI;
using System.ClientModel;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddAGUI();

string dtsConnection = builder.Configuration["DurableTask:ConnectionString"]
    ?? "Endpoint=http://dts-emulator:8080;TaskHub=default;Authentication=None";

var openAIClient = new OpenAIClient(
    new ApiKeyCredential("ollama"),
    new OpenAIClientOptions { Endpoint = new Uri("http://localhost:11434/v1") });

IChatClient chatClient = openAIClient
    .GetChatClient("gemma4:26b-nvfp4")
    .AsIChatClient();

builder.Services.AddSingleton(chatClient);

AIAgent agent = chatClient.AsAIAgent(
    name: "OllamaAgent",
    instructions: "You are a helpful assistant.");

builder.Services.ConfigureDurableAgents(
    options =>
    {
        options.DefaultTimeToLive = TimeSpan.FromDays(7);
        options.AddAIAgent(agent);
    },
    workerBuilder: b => b.UseDurableTaskScheduler(dtsConnection),
    clientBuilder: b => b.UseDurableTaskScheduler(dtsConnection));

var app = builder.Build();

AIAgent durableAgent = agent.AsDurableAgentProxy(app.Services);

// DurableAgent throws NotSupportedException("Streaming is not supported for durable agents.") at the runtime
app.MapAGUI("/chat", durableAgent);

await app.RunAsync();

Error Messages / Stack Traces

Package Versions

Microsoft.Agents.AI: 1.6.2, Microsoft.Agents.AI.Hosting.AGUI.AspNetCore: 1.6.2-preview.260521.1, Microsoft.Agents.AI.DurableTask: 1.6.2-preview.260521.1

.NET Version

.NET 10

Additional Context

No response

Metadata

Metadata

Assignees

Labels

Type

No fields configured for Bug.

Projects

Status
No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions