ag-ui-protocol / ag-ui-protocol/ag-ui

Update AGUIDojoServer MAF sample to use the latest MAF release

未关闭
#2,237 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Python
星标
15.9k
派生
1.4k
平均合并
1 天 17 小时
30 天内合并 PR
163

描述

**Area:** .NET SDK — `integrations/microsoft-agent-framework/dotnet/examples/AGUIDojoServer`

## Summary

The `AGUIDojoServer` example targets an older preview and its pre-public-API contracts, so it does not
build or behave against the shipped .NET AG-UI + Microsoft Agent Framework packages.

1. **Old package pin.** `AGUIDojoServer.csproj` references
`Microsoft.Agents.AI.Hosting.AGUI.AspNetCore` **1.0.0-preview.251110.1** and
`Microsoft.Agents.AI.OpenAI` **1.0.0-preview.251110.1**. The current release train is **1.15.0**
(hosting: `1.15.0-preview.260722.1`).

2. **Removed hosting API.** `Program.cs` calls `builder.Services.AddAGUI()` and
`app.MapAGUI("/route", agent)` (lines 18, 28–41). In the shipped hosting package these were renamed
to **`AddAGUIServer()`** and **`MapAGUIServer("/route", agent)`**, so the example doesn't compile
against the current package.

3. **Removed state contract.** The state scenarios use the old pre-public-API state mechanism, which is
no longer supported (confirmed with the .NET AG-UI maintainers):
- **Output:** state is emitted as `new DataContent(bytes, "application/json")` /
`"application/json-patch+json"` (`SharedState/SharedStateAgent.cs:86`,
`PredictiveStateUpdates/PredictiveStateUpdatesAgent.cs:81`, `AgenticUI/AgenticUIAgent.cs:58,62`).
The shipped contract is to emit a chat update whose `RawRepresentation` is a `StateSnapshotEvent`
/ `StateDeltaEvent`; the `DataContent` form was a hack from before the public API existed and is
intentionally no longer converted.
- **Input:** state is read from `ChatOptions.AdditionalProperties["ag_ui_state"]`
(`SharedState/SharedStateAgent.cs`). The shipped contract reads run input via
`chatOptions.TryGetRunAgentInput(out var input)` → `input.State`; the `ag_ui_state` key no longer
exists.

## Expected

Update the example to the shipped packages and supported contracts:

- Bump the `Microsoft.Agents.AI.*` package references to the current release.
- `AddAGUI()` → `AddAGUIServer()`; `MapAGUI(...)` → `MapAGUIServer(...)`.
- Emit state via `ChatResponseUpdate.RawRepresentation = new StateSnapshotEvent { Snapshot = ... }` /
`new StateDeltaEvent { Delta = ... }` (instead of `DataContent`).
- Read input state via `chatOptions.TryGetRunAgentInput(out var input)` → `input.State` (instead of
`AdditionalProperties["ag_ui_state"]`).

## Notes

Happy to open a PR. A working, standalone reference that maps each dojo scenario to `AddAGUIServer` /
`MapAGUIServer` and emits state via `RawRepresentation = StateSnapshotEvent` lives in
[`danroth27/AgenticUI`](https://github.com/danroth27/AgenticUI) (`src/AgenticUI.AgentServer`).

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。