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

Update AGUIDojoServer MAF sample to use the latest MAF release

Đang mở
#2,237 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
15.9k
Fork
1.4k
Merge trung bình
1 ngày 17 giờ
Pull request đã merge (30 ngày)
163

Mô tả

**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`).

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.