Skip to content

Approach C: AGUI custom events from agent pipeline (rejected) #246

@willvelida

Description

@willvelida

Summary

Emit custom AG-UI events from the Chat.Api agent pipeline carrying structured progress data. The UI handles these custom events natively within the AGUI SSE stream for real-time progress without polling.

Rejected approach. High risk due to preview SDK dependencies and undocumented internal APIs.

Parent: #243

Approach

  1. Modify ChatAgentProvider.RunStreamingWithLatestAgentAsync() to intercept RequestReport tool results
  2. Inject custom AG-UI events into the streaming pipeline (e.g., ActivityDelta or Custom event types)
  3. Start a background polling loop in the agent pipeline that emits progress events
  4. Chat.razor handles custom events for progress display

Why This Was Rejected

  • Preview SDK risk: Microsoft.Agents.AI.Hosting.AGUI.AspNetCore v1.0.0-preview.260311.1 — internal APIs may change
  • MapAGUI event propagation unknown: Custom event types may not be serialized to SSE by MapAGUI
  • Deep SDK integration required: Injecting events at the IAsyncEnumerable<StreamingChatCompletionUpdate> level requires understanding undocumented internals
  • 15-25 hours estimated effort with high uncertainty — potential dead-end
  • Marginal UX gain over Approach A for dramatically more complexity

Files Changed (4-5 files)

File Change
ChatAgentProvider.cs (Chat.Api) Intercept tool results, emit custom events in streaming pipeline
AGUIEvent.cs (UI) Add Name, Value properties for Custom events
Chat.razor (UI) Handle Custom or ActivityDelta events
Chat.razor.css (UI) Progress styles

Estimated Effort

15-25 hours (high uncertainty, SDK investigation, potential dead-end)

When This Might Become Viable

  • Microsoft.Agents.AI SDK reaches GA with documented custom event APIs
  • AG-UI protocol formally specifies Custom event serialization requirements
  • The project needs server-push progress for multiple concurrent operations beyond reports

References

  • Research: .copilot-tracking/research/2026-04-06/report-generation-progress-indicator-research.md
  • AG-UI Protocol: https://docs.ag-ui.com/concepts/events (Custom, ActivitySnapshot, ActivityDelta events)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions