a2aproject / a2aproject/a2a-samples

stream bug

Open
#406 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
1.8k
Forks
751
PR merge metrics
No merged PRs in 30d

Description

### 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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.