Skip to content

Commit 9b5e82c

Browse files
Update the examples for python < 3.13
1 parent 9f279dc commit 9b5e82c

File tree

4 files changed

+402
-189
lines changed

4 files changed

+402
-189
lines changed

examples/helloworld/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "helloworld"
33
version = "0.1.0"
44
description = "HelloWorld agent example that only returns Messages"
55
readme = "README.md"
6-
requires-python = ">=3.13"
6+
requires-python = ">=3.12"
77
dependencies = [
88
"a2a-sdk",
99
"click>=8.1.8",

examples/helloworld/test_client.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -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

9398
if __name__ == '__main__':

examples/langgraph/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "langgraph-example"
33
version = "0.1.0"
44
description = "Currency conversion agent example"
55
readme = "README.md"
6-
requires-python = ">=3.13"
6+
requires-python = ">=3.12"
77
dependencies = [
88
"a2a-sdk",
99
"click>=8.1.8",

0 commit comments

Comments
 (0)