Skip to content

Commit 1f5a681

Browse files
committed
Merge branch 'no-lifetime' of https://github.com/racinmat/a2a-python into no-lifetime
2 parents ede4bf4 + 6aac8f1 commit 1f5a681

File tree

8 files changed

+495
-387
lines changed

8 files changed

+495
-387
lines changed

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
# Changelog
22

3+
## [0.2.15](https://github.com/a2aproject/a2a-python/compare/v0.2.14...v0.2.15) (2025-07-21)
4+
5+
6+
### Bug Fixes
7+
8+
* Add Input Validation for Empty Message Content ([#327](https://github.com/a2aproject/a2a-python/issues/327)) ([5061834](https://github.com/a2aproject/a2a-python/commit/5061834e112a4eb523ac505f9176fc42d86d8178))
9+
* Prevent import grpc issues for Client after making dependencies optional ([#330](https://github.com/a2aproject/a2a-python/issues/330)) ([53ad485](https://github.com/a2aproject/a2a-python/commit/53ad48530b47ef1cbd3f40d0432f9170b663839d)), closes [#326](https://github.com/a2aproject/a2a-python/issues/326)
10+
11+
## [0.2.14](https://github.com/a2aproject/a2a-python/compare/v0.2.13...v0.2.14) (2025-07-18)
12+
13+
14+
### Features
15+
16+
* Set grpc dependencies as optional ([#322](https://github.com/a2aproject/a2a-python/issues/322)) ([365f158](https://github.com/a2aproject/a2a-python/commit/365f158f87166838b55bdadd48778cb313a453e1))
17+
* **spec:** Update A2A types from specification 🤖 ([#325](https://github.com/a2aproject/a2a-python/issues/325)) ([02e7a31](https://github.com/a2aproject/a2a-python/commit/02e7a3100e000e115b4aeec7147cf8fc1948c107))
18+
319
## [0.2.13](https://github.com/a2aproject/a2a-python/compare/v0.2.12...v0.2.13) (2025-07-17)
420

521

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<h2 align="center">
1212
<img src="https://raw.githubusercontent.com/a2aproject/A2A/refs/heads/main/docs/assets/a2a-logo-black.svg" width="256" alt="A2A Logo"/>
1313
</h2>
14-
<h3 align="center">A Python library that helps run agentic applications as A2AServers following the <a href="https://a2aproject.github.io/A2A">Agent2Agent (A2A) Protocol</a>.</h3>
14+
<h3 align="center">A Python library that helps run agentic applications as A2AServers following the <a href="https://a2a-protocol.org">Agent2Agent (A2A) Protocol</a>.</h3>
1515
</html>
1616

1717
<!-- markdownlint-enable no-inline-html -->
@@ -33,6 +33,12 @@ When you're working within a uv project or a virtual environment managed by uv,
3333
uv add a2a-sdk
3434
```
3535

36+
To install with gRPC support:
37+
38+
```bash
39+
uv add "a2a-sdk[grpc]"
40+
```
41+
3642
To install with database support:
3743

3844
```bash
@@ -57,6 +63,12 @@ If you prefer to use pip, the standard Python package installer, you can install
5763
pip install a2a-sdk
5864
```
5965

66+
To install with gRPC support:
67+
68+
```bash
69+
pip install "a2a-sdk[grpc]"
70+
```
71+
6072
To install with database support:
6173

6274
```bash

src/a2a/client/__init__.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
"""Client-side components for interacting with an A2A agent."""
22

3+
import logging
4+
35
from a2a.client.auth import (
46
AuthInterceptor,
57
CredentialService,
@@ -12,11 +14,31 @@
1214
A2AClientJSONError,
1315
A2AClientTimeoutError,
1416
)
15-
from a2a.client.grpc_client import A2AGrpcClient
1617
from a2a.client.helpers import create_text_message_object
1718
from a2a.client.middleware import ClientCallContext, ClientCallInterceptor
1819

1920

21+
logger = logging.getLogger(__name__)
22+
23+
try:
24+
from a2a.client.grpc_client import A2AGrpcClient # type: ignore
25+
except ImportError as e:
26+
_original_error = e
27+
logger.debug(
28+
'A2AGrpcClient not loaded. This is expected if gRPC dependencies are not installed. Error: %s',
29+
_original_error,
30+
)
31+
32+
class A2AGrpcClient: # type: ignore
33+
"""Placeholder for A2AGrpcClient when dependencies are not installed."""
34+
35+
def __init__(self, *args, **kwargs):
36+
raise ImportError(
37+
'To use A2AGrpcClient, its dependencies must be installed. '
38+
'You can install them with \'pip install "a2a-sdk[grpc]"\''
39+
) from _original_error
40+
41+
2042
__all__ = [
2143
'A2ACardResolver',
2244
'A2AClient',

src/a2a/client/grpc_client.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,16 @@
22

33
from collections.abc import AsyncGenerator
44

5-
import grpc
5+
6+
try:
7+
import grpc
8+
except ImportError as e:
9+
raise ImportError(
10+
'A2AGrpcClient requires grpcio and grpcio-tools to be installed. '
11+
'Install with: '
12+
"'pip install a2a-sdk[grpc]'"
13+
) from e
14+
615

716
from a2a.grpc import a2a_pb2, a2a_pb2_grpc
817
from a2a.types import (

src/a2a/server/request_handlers/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
_original_error = e
2424
logger.debug(
2525
'GrpcHandler not loaded. This is expected if gRPC dependencies are not installed. Error: %s',
26+
_original_error,
2627
)
2728

2829
class GrpcHandler: # type: ignore

0 commit comments

Comments
 (0)