a2aproject / a2aproject/a2a-samples

stream bug

未關閉
#406 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Jupyter Notebook
星號
1.8k
分支
751
PR 合併指標
30 天內沒有已合併 PR

描述

### What happened?

The server-side has already finished streaming the output, but the client-side only starts streaming output afterwards, and it prints everything out very quickly.

server code:
async for event in self.agent.stream(query):
message = TaskArtifactUpdateEvent(
context_id=context.context_id, # type: ignore
task_id=context.task_id, # type: ignore
artifact=new_text_artifact(
name='current_result',
text=event['content'],
),
)
await event_queue.enqueue_event(message)
print(event['content'])
if event['done']:
break

client_code :
request = create_text_message_object(content=user_input)

# Send the request and get the streaming messages
async for response in client.send_message(request):
task, _ = response
print(get_message_text(task.artifacts[-1]))

### Relevant log output

```shell

```

### Code of Conduct

- [x] I agree to follow this project's Code of Conduct

貢獻指南

開啟貢獻指南

研究方向

Look at the server-side streaming loop in the agent.stream method and the client-side async for loop in client.send_message. The issue is about timing mismatch in streaming events. Start by examining the event queue implementation and the TaskArtifactUpdateEvent structure. Check if there's buffering or synchronization delay. Run the provided code snippets to reproduce the bug and see the print statements' order.

由索引模型根據 Issue 內容生成。

評估

技術堆疊
python
領域
api, backend
Issue 類型
缺陷
難度
3/5
預估耗時
1-2 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。