Skip to content

fix: disable stream for helloworld example, since it do not support#53

Merged
holtskinner merged 2 commits into
a2aproject:mainfrom
vincent-pli:disable-stream-helloworld
May 20, 2025
Merged

fix: disable stream for helloworld example, since it do not support#53
holtskinner merged 2 commits into
a2aproject:mainfrom
vincent-pli:disable-stream-helloworld

Conversation

@vincent-pli

Copy link
Copy Markdown
Contributor

Description

Thank you for opening a Pull Request!
Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

Fixes #<issue_number_goes_here> 🦕
The helloworld example do not act as stream enable, so I get exception

object async_generator can't be used in 'await' expression

when I try to invoke client.send_message_streaming

@vincent-pli vincent-pli requested a review from a team as a code owner May 20, 2025 02:37
@holtskinner holtskinner merged commit 436c931 into a2aproject:main May 20, 2025
5 checks passed
@kthota-g

Copy link
Copy Markdown
Contributor

@vincent-pli I have to revert this PR. Can you please let me know where you are seeing this error?

Invoking message/stream request should the string hello world over SSE.

@vincent-pli

Copy link
Copy Markdown
Contributor Author

@kthota-g
I have not dig too much into the root cause, but when the streaming is enabled in the card in hello world example, I get the error when I try to await client.send_message_streaming(request), see the draft code below (not finished yet)
https://github.com/vincent-pli/a2a-agent-mcpserver-generator/blob/a526e7a60d9fb62a2e93810486a9080979c5a932/src/a2a_agent_mcpserver_generator/server_generator.py#L132

@kthota-g

Copy link
Copy Markdown
Contributor

@vincent-pli send_message_streaming returns an AsyncGenerator, which is not awaitable.

Here is an example for how you can process the response - https://github.com/google/a2a-python/blob/53a58611b32bc3ae01adba432463d1d5cab95f09/examples/helloworld/test_client.py#L33

@vincent-pli

Copy link
Copy Markdown
Contributor Author

You are right, my mistake, thanks a lot

@Linux2010

Copy link
Copy Markdown
Contributor

However, in the invoke method of the HelloWorldAgent, the characteristics of streaming cannot be well demonstrated. Because in this example, both SendStreamingMessageRequest and send_message use the invoke method, lacking distinctiveness.

https://github.com/google/a2a-python/blob/53a58611b32bc3ae01adba432463d1d5cab95f09/examples/helloworld/agent_executor.py#11

@vincent-pli send_message_streaming returns an AsyncGenerator, which is not awaitable.

Here is an example for how you can process the response -

https://github.com/google/a2a-python/blob/53a58611b32bc3ae01adba432463d1d5cab95f09/examples/helloworld/test_client.py#L33

martimfasantos pushed a commit to martimfasantos/a2a-python that referenced this pull request May 23, 2025
martimfasantos pushed a commit to martimfasantos/a2a-python that referenced this pull request May 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants