.NET: [Bug]: AddAGUIServer's JSON setup writes null optional fields (rejected by @ag-ui/client) and cannot serialize interrupts
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
Issue này chưa được đánh giá.
Mô tả
Description
MapAGUIServer writes a stream that the official AG-UI TypeScript client (@ag-ui/client 1.0.1, used by CopilotKit 1.76) rejects. Separately, any interrupt makes the run end in RUN_ERROR. Both defects come from ConfigureAGUIJsonOptions in Microsoft.Agents.AI.Hosting.AGUI.AspNetCore, which AddAGUIServer() registers:
// Microsoft.Agents.AI.Hosting.AGUI.AspNetCore.ConfigureAGUIJsonOptions (1.23.0-preview.260928.1, decompiled)
public void Configure(JsonOptions options)
{
var chain = options.SerializerOptions.TypeInfoResolverChain;
chain.Add(AgentAbstractionsJsonUtilities.DefaultOptions.TypeInfoResolver);
chain.Add(((JsonSerializerContext)AGUIJsonSerializerContext.Default).Options.TypeInfoResolver);
}
1. Optional event fields are written as null, and the official client rejects them.
- Cause: the method appends the raw
AGUIJsonSerializerContextresolver.AGUI.AbstractionsdocumentsAGUIJsonUtilities.DefaultTypeInfoResolver(that context plusOmitPropertiesWithoutAValue) as the resolver to use instead. - What happens:
RUN_STARTEDgoes out with"parentRunId": nulland"input": null, and interrupts carry"subagentRunId": null.@ag-ui/client's schema validation fails on the first event, so no run can be followed from a browser. - Expected: optional fields without a value are omitted, as
AGUIJsonUtilities.DefaultTypeInfoResolverdoes.
2. Interrupts cannot be serialized.
- Cause: the method never calls
AGUIJsonUtilities.RegisterInterruptContentTypes. - What happens: an agent that yields
InterruptRequestContentmakes the server fail the run. The same happens when the response update containing one is serialized, for example forrawEvent. The client receivesRUN_ERROR("An error occurred while streaming the agent response.") instead of aRUN_FINISHEDwhose outcome is an interrupt. - Expected:
AddAGUIServer()registers the interrupt content types, so the protocol's own interrupt/resume works out of the box.
Steps to reproduce
- Use
builder.Services.AddAGUIServer();andapp.MapAGUIServer("/agui", agent);with anyChatClientAgent. - POST a run and read the stream with
@ag-ui/client'sHttpAgent. You get a ZodError onRUN_STARTED(defect 1). - Have the agent's chat client yield
new ChatResponseUpdate(ChatRole.Assistant, [new InterruptRequestContent("ask-1") { Reason = "input_required", Message = "?" }]). The run ends inRUN_ERROR(defect 2).
Code Sample
```csharp
// Workaround we use today; with it, both cases work end to end with @ag-ui/client and CopilotKit.
builder.Services.AddAGUIServer();
builder.Services.Configure<Microsoft.AspNetCore.Http.Json.JsonOptions>(o =>
AGUIJsonUtilities.RegisterInterruptContentTypes(o.SerializerOptions));
builder.Services.PostConfigure<Microsoft.AspNetCore.Http.Json.JsonOptions>(o =>
o.SerializerOptions.TypeInfoResolverChain.Insert(0, AGUIJsonUtilities.DefaultTypeInfoResolver));
```
Error Messages / Stack Traces
```
// 1 — @ag-ui/client 1.0.1 on RUN_STARTED:
ZodError: parentRunId: expected string, received null; input: expected object, received null
// 2 — server, when an InterruptRequestContent is serialized:
System.NotSupportedException: Runtime type 'AGUI.Abstractions.InterruptRequestContent' is not supported by polymorphic type 'Microsoft.Extensions.AI.AIContent'.
```
Package Versions
Microsoft.Agents.AI.Hosting.AGUI.AspNetCore: 1.23.0-preview.260928.1, Microsoft.Agents.AI: 1.23.0, Microsoft.Agents.AI.Hosting: 1.23.0-preview.260928.1, AGUI.Abstractions: 1.0.0, AGUI.Server: 1.0.0, Microsoft.Extensions.AI.Abstractions: 10.10.1
.NET Version
.NET 10 (SDK 10.0.401)
Additional Context
- Version scope: 1.22.0-preview.260918.1 has the same
ConfigureAGUIJsonOptions, and it also targetsAGUI.*0.0.6. - Suggested fix: in
ConfigureAGUIJsonOptions.Configure, insertAGUIJsonUtilities.DefaultTypeInfoResolver(rather than adding the raw context) and callAGUIJsonUtilities.RegisterInterruptContentTypes(options.SerializerOptions).
- Ngôn ngữ chính
- Python
- Star
- 14.2k
- Fork
- 2.5k
- Merge trung bình
- 2 ngày 11 giờ
- Pull request đã merge (30 ngày)
- 407
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của microsoft/agent-framework
-
Python: [Bug]: A non-positive MCP request timeout silently disables the timeoutCó thể đã có người làm @jpalvarezl đã nhận 5 ngày trước. Đang mởpython
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
microsoft/agent-framework#9313 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
.NET: Proposal: add an llms.txtĐang mở.NET python triage
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
microsoft/agent-framework#9092 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Python: raw-data content mappings lose annotations and attachment metadataCó thể đã có người làm @moonbox3 đã nhận 18 ngày trước. Đang mởpython triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
microsoft/agent-framework#8632 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Python: Clarify when to use platformCó thể đã có người làm @eavanvalkenburg đã nhận 18 ngày trước. Đang mởpython triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
microsoft/agent-framework#8599 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
.NET compaction documentation
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
microsoft/agent-framework#4629 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của microsoft/agent-framework
Issue tương tự
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 68/100
FavioVazquez/showtime#101 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
rossant/awesome-math#199 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
nautechsystems/nautilus_trader#5365 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Examples say cnxĐang mởdocumentation embedded
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày