.NET: [Bug]: AddAGUIServer's JSON setup writes null optional fields (rejected by @ag-ui/client) and cannot serialize interrupts
メンテナーはふだん 1 日以内に返信
@javiercn がすでに取り組んでいます。
2026年10月2日 から。
評価
この issue はまだ評価されていません。
説明
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).
- 主要言語
- Python
- スター
- 13.9k
- フォーク
- 2.4k
- 平均マージ
- 1日 16時間
- マージ済み PR(30日)
- 432
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/agent-framework のほかの issue
-
.NET python triage
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
microsoft/agent-framework#9092 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Python: raw-data content mappings lose annotations and attachment metadata対応中かも @moonbox3 が 6 日前に担当しました。 オープンpython triage
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
microsoft/agent-framework#8632 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
Python: Clarify when to use platform対応中かも @eavanvalkenburg が 6 日前に担当しました。 オープンpython triage
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
microsoft/agent-framework#8599 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
.NET Compaction - Update docs to refer to `AIContextProvider` deep dive対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン.NET compaction documentation
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
microsoft/agent-framework#4629 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Python: [Bug]: Public stream close does not release delegated provider responses対応中かも @eavanvalkenburg が今日担当しました。 オープンag-ui python reproduced
microsoft/agent-framework#9099 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
microsoft/agent-framework の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
Juniper/ansible-junos-stdlib#904 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
pollen-robotics/reachy_mini#1457 ·
メンテナーはふだん 1 日以内に返信
-
area:runtime good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
WATonomous/wato_f1tenth#39 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
FireDynamics/fdsreader#123 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 85/100