@@ -59,7 +59,7 @@ async def main() -> None:
5959 logger .error (f"Critical error fetching public agent card: { e } " , exc_info = True )
6060 raise RuntimeError ("Failed to fetch the public agent card. Cannot continue." ) from e
6161
62-
62+
6363 client = A2AClient (
6464 httpx_client = httpx_client , agent_card = final_agent_card_to_use
6565 )
@@ -80,14 +80,19 @@ async def main() -> None:
8080
8181 response = await client .send_message (request )
8282 print (response .model_dump (mode = 'json' , exclude_none = True ))
83-
84- streaming_request = SendStreamingMessageRequest (
85- params = MessageSendParams (** send_message_payload )
86- )
87-
88- stream_response = client .send_message_streaming (streaming_request )
89- async for chunk in stream_response :
90- print (chunk .model_dump (mode = 'json' , exclude_none = True ))
83+ # The HelloWorld agent doesn't support streaming requests. Validate
84+ # this throws an error.
85+ try :
86+ streaming_request = SendStreamingMessageRequest (
87+ params = MessageSendParams (** send_message_payload )
88+ )
89+
90+ stream_response = client .send_message_streaming (streaming_request )
91+ print ("Got an unexpected response:" )
92+ async for chunk in stream_response :
93+ print (chunk .model_dump (mode = 'json' , exclude_none = True ))
94+ except Exception :
95+ pass
9196
9297
9398if __name__ == '__main__' :
0 commit comments