a2aproject / a2aproject/a2a-dotnet

Consider adding support to streaming to OnMessageReceived in TaskManager

未关闭
#159 4 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
C#
星标
262
派生
64
平均合并
5 天 2 小时
30 天内合并 PR
31

描述

The issue comes from the fact that the SendMessageStreamingAsync method in TaskManager checks for OnMessageReceived, and if it is found, there is no way to support streaming.

https://github.com/a2aproject/a2a-dotnet/blob/5bee984151b32a9e714781301bedeaaa517a18ba/src/A2A/Server/TaskManager.cs#L244

Since receiving messages is one of the most common actions to override, this prevents people from either streaming or being able to receive messages, just so streaming can work.

Suggestions:

1.- Make the streaming be bases on the UpdateStatusAsync method. streaming should subscribe to events from the UpdateStatusAsync
2.- Add an OnMessageReceivedStreaming method that returns an IAsyncEnumerable.
3.- Add the TaskUpdateEventEnumerator object to the signature of OnMessageReceived, so that events can be pumped out as they are processed.

Pros & Cons

For #1
Pro: No major signature changes, just after creating the AgentTask imedeatly subscribe to it and pass along the enumerator.

For #2
pro: The implementation is semantically good
Con: The implementore will have to implement two methods to receive messages

For #3
Pro: The implementation is straight forward. Semantically it might be ok, not sure. i think i should as the non-streaminmg processing should be able to push notifications.

#1 Is the one i would prefer as it would allow me to use the UpdateStatusAsync naturally.

贡献指南

打开贡献指南

调研方向

Examine the TaskManager.cs file, specifically the SendMessageStreamingAsync method around line 244 and the OnMessageReceived delegate. Understand the existing UpdateStatusAsync method and the A2AEvent type. The goal is to design a change that allows streaming without breaking existing overrides. Start by reviewing the three proposed solutions and their implications on the codebase.

由索引模型根据 Issue 内容生成。

评估

技术栈
csharp
领域
api, backend
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

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