Skip to content

Commit 6900e34

Browse files
committed
move key differences to top
1 parent aef5bc0 commit 6900e34

1 file changed

Lines changed: 14 additions & 16 deletions

File tree

docs/migrations/v1_0/README.md

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ This affects every enum in the SDK: `TaskState`, `Role`.
6262
6363
### Message and Part construction
6464

65+
Key differences:
66+
- `Part(TextPart(text=...))``Part(text=...)` (flat union field)
67+
- `Role.user``Role.ROLE_USER`, `Role.agent``Role.ROLE_AGENT`
68+
- `TextPart` is no longer needed; use `Part(text=...)` directly
69+
6570
**Before (v0.3):**
6671
```python
6772
from a2a.types import Message, Part, Role, TextPart
@@ -95,11 +100,6 @@ message = Message(
95100
)
96101
```
97102

98-
Key differences:
99-
- `Part(TextPart(text=...))``Part(text=...)` (flat union field)
100-
- `Role.user``Role.ROLE_USER`, `Role.agent``Role.ROLE_AGENT`
101-
- `TextPart` is no longer needed; use `Part(text=...)` directly
102-
103103
> **Example**: [`helloworld/test_client.py` in PR #474](https://github.com/a2aproject/a2a-samples/pull/474/files#diff-f62c07d3b00364a3100b7effb3e2a1cca0624277d3e40da1bdb07bb46b6a8cef)
104104
105105
### AgentCard Structure
@@ -279,9 +279,13 @@ async with client:
279279

280280
## 6. Client: Sending Messages & Handling Responses
281281

282-
### `SendStreamingMessageRequest` removed
283-
284-
There is now a single `send_message()` method on the client that returns a stream of `StreamResponse` proto messages regardless of transport.
282+
Key differences:
283+
- `send_message_streaming()``send_message()` (unified method)
284+
- `SendStreamingMessageRequest``SendMessageRequest`
285+
- `MessageSendParams` wrapper is gone; `message` is a field directly on `SendMessageRequest`
286+
- `send_message()` returns `AsyncIterator[StreamResponse]`; iterate with `async for`
287+
- Each `StreamResponse` has a `payload` which is one of: `'task'`, `'message'`, `'status_update'`, `'artifact_update'`. Use `HasField()` to check which field is set.
288+
- Agent outputs should now be published as **Artifacts**, not status message text
285289

286290
**Before (v0.3):**
287291
```python
@@ -307,6 +311,7 @@ response = client.send_message_streaming(request)
307311

308312
**After (v1.0):**
309313
```python
314+
from a2a.helpers import get_artifact_text
310315
from a2a.types import (
311316
Message, Part, Role, SendMessageRequest,
312317
)
@@ -317,6 +322,7 @@ message = Message(
317322
role=Role.ROLE_USER,
318323
parts=parts,
319324
message_id=uuid4().hex,
325+
task_id=uuid4().hex,
320326
)
321327
request = SendMessageRequest(message=message)
322328

@@ -327,14 +333,6 @@ async for chunk in client.send_message(request):
327333
print(chunk.status_update.status.state)
328334
```
329335

330-
Key differences:
331-
- `send_message_streaming()``send_message()` (unified method)
332-
- `SendStreamingMessageRequest``SendMessageRequest`
333-
- `MessageSendParams` wrapper is gone; `message` is a field directly on `SendMessageRequest`
334-
- `send_message()` returns `AsyncIterator[StreamResponse]`; iterate with `async for`
335-
- Each `StreamResponse` has a `payload` which is one of: `'task'`, `'message'`, `'status_update'`, `'artifact_update'`. Use `HasField()` to check which field is set.
336-
- Agent outputs should now be published as **Artifacts**, not status message text
337-
338336
> **Example**: [`helloworld/test_client.py` in PR #474](https://github.com/a2aproject/a2a-samples/pull/474/files#diff-f62c07d3b00364a3100b7effb3e2a1cca0624277d3e40da1bdb07bb46b6a8cef)
339337
340338
---

0 commit comments

Comments
 (0)