Skip to content

Commit 7a58bb8

Browse files
committed
Merge branch 'migration' of github.com:sokoliva/a2a-python into migration
2 parents cb83bdd + 705123a commit 7a58bb8

14 files changed

Lines changed: 27 additions & 2214 deletions

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ Install the core SDK and any desired extras using your preferred package manager
6868
| **gRPC Support** | `uv add "a2a-sdk[grpc]"` | `pip install "a2a-sdk[grpc]"` |
6969
| **OpenTelemetry Tracing**| `uv add "a2a-sdk[telemetry]"` | `pip install "a2a-sdk[telemetry]"` |
7070
| **Encryption** | `uv add "a2a-sdk[encryption]"` | `pip install "a2a-sdk[encryption]"` |
71-
| **Vertex AI Task Store** | `uv add "a2a-sdk[vertex]"` | `pip install "a2a-sdk[vertex]"` |
7271
| | | |
7372
| **Database Drivers** | | |
7473
| **PostgreSQL** | `uv add "a2a-sdk[postgresql]"` | `pip install "a2a-sdk[postgresql]"` |

docs/migrations/v1_0/README.md

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -287,20 +287,21 @@ create_rest_routes(request_handler, enable_v0_3_compat=True)
287287

288288
## 6. Client: Creating a Client
289289

290-
The `A2AClient` class has been removed. Use the new `create_client()` factory function.
290+
New `create_client()` `ClientFactory` function that creates a client for the agent.
291291

292-
### Simple usage: `create_client()`
292+
> **Note**: The legacy `A2AClient` class has been removed.
293293
294294
**Before (v0.3):**
295295
```python
296-
import httpx
297-
from a2a.client import A2AClient, A2ACardResolver
298-
299-
async with httpx.AsyncClient() as httpx_client:
300-
resolver = A2ACardResolver(httpx_client, base_url)
301-
agent_card = await resolver.get_agent_card()
302-
client = A2AClient(httpx_client, agent_card=agent_card)
303-
# use client...
296+
from a2a.client import ClientFactory
297+
298+
# From URL
299+
factory = ClientFactory()
300+
client = factory.create_client('http://localhost:9999/')
301+
302+
# From an already-resolved AgentCard
303+
factory = ClientFactory()
304+
client = factory.create_client(agent_card)
304305
```
305306

306307
**After (v1.0):**
@@ -309,13 +310,9 @@ from a2a.client import create_client
309310

310311
# From URL — resolves the agent card automatically
311312
client = await create_client('http://localhost:9999/')
312-
async with client:
313-
# use client...
314313

315314
# From an already-resolved AgentCard
316315
client = await create_client(agent_card)
317-
async with client:
318-
# use client...
319316
```
320317

321318

@@ -325,20 +322,24 @@ async with client:
325322

326323
## 7. Client: Send Message
327324

328-
The key change in `BaseClient` is the return type of `send_message()`: it **now returns `AsyncIterator[StreamResponse]`** (v0.3 returned `AsyncIterator[ClientEvent | Message]`).
325+
The `BaseClient.send_message()` return type is standardised from `AsyncIterator[ClientEvent | Message]` to `AsyncIterator[StreamResponse]`.
329326

330-
```python
331-
from a2a.types import Message, Part, Role, SendMessageRequest
332-
from uuid import uuid4
327+
Each `StreamResponse` yields exactly one of: `task`, `message`, `status_update`, or `artifact_update`. Use `HasField()` to check which field is set.
333328

334-
request = SendMessageRequest(
335-
message=Message(
336-
role=Role.ROLE_USER,
337-
parts=[Part(text=user_input)],
338-
message_id=uuid4().hex,
339-
)
340-
)
341329

330+
**Before (v0.3):**
331+
```python
332+
async for event, message in client.send_message(request):
333+
if isinstance(event, Task):
334+
...
335+
if isinstance(event, UpdateEvent):
336+
...
337+
if message:
338+
...
339+
```
340+
341+
**After (v1.0):**
342+
```python
342343
async for chunk in client.send_message(request):
343344
if chunk.HasField('artifact_update'):
344345
...
@@ -350,9 +351,6 @@ async for chunk in client.send_message(request):
350351
...
351352
```
352353

353-
Each `StreamResponse` yields exactly one of: `task`, `message`, `status_update`, or `artifact_update`. Use `HasField()` to check which field is set.
354-
355-
> **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)
356354

357355
---
358356

pyproject.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ mysql = ["sqlalchemy[asyncio,aiomysql]>=2.0.0"]
4343
signing = ["PyJWT>=2.0.0"]
4444
sqlite = ["sqlalchemy[asyncio,aiosqlite]>=2.0.0"]
4545
db-cli = ["alembic>=1.14.0"]
46-
vertex = ["google-cloud-aiplatform>=1.140.0"]
4746

4847
sql = ["a2a-sdk[postgresql,mysql,sqlite]"]
4948

@@ -55,7 +54,6 @@ all = [
5554
"a2a-sdk[telemetry]",
5655
"a2a-sdk[signing]",
5756
"a2a-sdk[db-cli]",
58-
"a2a-sdk[vertex]",
5957
]
6058

6159
[project.urls]

src/a2a/contrib/__init__.py

Whitespace-only changes.

src/a2a/contrib/tasks/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)