You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/migrations/v1_0/README.md
+27-29Lines changed: 27 additions & 29 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Migration Guide: v0.3 → v1.0
2
2
3
-
This guide covers the breaking changes introduced in `a2a-sdk` v1.0 and explains how to update your code. The changes reflect updates to the A2A protocol specification — see the [A2A protocol What's new in v1.0](https://a2a-protocol.org/latest/whats-new-v1/).
3
+
This guide covers the breaking changes introduced in `a2a-sdk` v1.0 and explains how to update your code. The changes reflect updates to the A2A protocol specification: [What's new in v1.0](https://a2a-protocol.org/latest/whats-new-v1/).
4
4
5
5
> **Related guides**: If you use the database persistence layer, also see the [Database Migration Guide](database/).
The key change in `BaseClient` is the return type of `send_message()`: it **now returns `AsyncIterator[StreamResponse]`** (v0.3 returned`AsyncIterator[ClientEvent | Message]`).
302
+
The `BaseClient.send_message()`return type is standardised from `AsyncIterator[ClientEvent | Message]` to `AsyncIterator[StreamResponse]`.
306
303
307
-
```python
308
-
from a2a.types import Message, Part, Role, SendMessageRequest
309
-
from uuid import uuid4
304
+
Each `StreamResponse` yields exactly one of: `task`, `message`, `status_update`, or `artifact_update`. Use `HasField()` to check which field is set.
310
305
311
-
request = SendMessageRequest(
312
-
message=Message(
313
-
role=Role.ROLE_USER,
314
-
parts=[Part(text=user_input)],
315
-
message_id=uuid4().hex,
316
-
)
317
-
)
318
306
307
+
**Before (v0.3):**
308
+
```python
309
+
asyncfor event, message in client.send_message(request):
310
+
ifisinstance(event, Task):
311
+
...
312
+
ifisinstance(event, UpdateEvent):
313
+
...
314
+
if message:
315
+
...
316
+
```
317
+
318
+
**After (v1.0):**
319
+
```python
319
320
asyncfor chunk in client.send_message(request):
320
321
if chunk.HasField('artifact_update'):
321
322
...
@@ -327,9 +328,6 @@ async for chunk in client.send_message(request):
327
328
...
328
329
```
329
330
330
-
Each `StreamResponse` yields exactly one of: `task`, `message`, `status_update`, or `artifact_update`. Use `HasField()` to check which field is set.
331
-
332
-
> **Note**: The legacy `A2AClient` class has been removed. Use `create_client()` as shown in [section 5](#5-client-creating-a-client). **Example**: [`helloworld/test_client.py` in PR #474](https://github.com/a2aproject/a2a-samples/pull/474/files#diff-f62c07d3b00364a3100b7effb3e2a1cca0624277d3e40da1bdb07bb46b6a8cef)
0 commit comments