Skip to content

Commit 9e8302d

Browse files
fixed streaming messages types in tutorials
1 parent 04cd93d commit 9e8302d

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

docs/tutorials/python/4-agent-executor.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Let's look at `examples/helloworld/agent_executor.py`. It defines `HelloWorldAge
1919
This is a simple helper class that encapsulates the actual "business logic".
2020

2121
```python { .no-copy }
22-
# examples/helloworld/agent_executor.py
22+
# examples/helloworld/agent.py
2323
class HelloWorldAgent:
2424
async def invoke(self):
2525
return 'Hello World'
@@ -77,8 +77,8 @@ Let's look at `examples/helloworld/agent_executor.py`. It defines `HelloWorldAge
7777
```python { .no-copy }
7878
# examples/helloworld/agent_executor.py
7979
async def on_message_stream( # type: ignore
80-
self, request: SendMessageStreamingRequest, task: Task | None
81-
) -> AsyncGenerator[SendMessageStreamingResponse, None]:
80+
self, request: SendStreamingMessageRequest, task: Task | None
81+
) -> AsyncGenerator[SendStreamingMessageResponse, None]:
8282
async for chunk in self.agent.stream(): # Iterates over agent's stream
8383
message: Message = Message(
8484
role=Role.agent,
@@ -87,8 +87,8 @@ Let's look at `examples/helloworld/agent_executor.py`. It defines `HelloWorldAge
8787
final=chunk['done'], # Indicates if this is the last chunk
8888
)
8989
# Yields each chunk as a streaming success response
90-
yield SendMessageStreamingResponse(
91-
root=SendMessageStreamingSuccessResponse(
90+
yield SendStreamingMessageResponse(
91+
root=SendStreamingMessageSuccessResponse(
9292
id=request.id, result=message
9393
)
9494
)
@@ -98,7 +98,7 @@ Let's look at `examples/helloworld/agent_executor.py`. It defines `HelloWorldAge
9898

9999
1. It iterates through the chunks produced by `self.agent.stream()`.
100100
2. For each chunk, it creates an A2A `Message`. The `final` attribute of the message is important for streaming; it tells the client if more chunks are coming.
101-
3. Each message is `yield`ed, wrapped in a `SendMessageStreamingSuccessResponse`. This is how SSE (Server-Sent Events) are generated by the SDK.
101+
3. Each message is `yield`ed, wrapped in a `SendStreamingMessageSuccessResponse`. This is how SSE (Server-Sent Events) are generated by the SDK.
102102

103103
- `on_cancel` and `on_resubscribe`:
104104
The Helloworld example marks these as `UnsupportedOperationError` because it doesn't implement task cancellation or resubscription.

docs/tutorials/python/6-interact-with-server.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ Let's look at key parts of `examples/helloworld/test_client.py`:
104104
```
105105

106106
- This method calls the agent's `message/sendStream` endpoint.
107-
- It returns an `AsyncGenerator`. As the server streams SSE events, the client receives them as `SendMessageStreamingResponse` objects.
107+
- It returns an `AsyncGenerator`. As the server streams SSE events, the client receives them as `SendStreamingMessageResponse` objects.
108108
- The Helloworld agent will stream "Hello " and then "World".
109109

110110
## Expected Output

0 commit comments

Comments
 (0)