[Feat]: Add RetryTransport for automatic retry with exponential backoff
Maintainers usually reply within 2 days
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
Research direction
Look at the existing transport classes (JsonRpcTransport, RestTransport, GrpcTransport) and the TenantTransportDecorator pattern. The new RetryTransport must wrap any ClientTransport. Start by examining the SDK's exception hierarchy (A2AClientError, A2AClientTimeoutError) and how they chain httpx and grpc errors. Write tests for the retry predicate and the on_retry hook. Ensure the implementation works for all three transports and does not retry domain errors.
Written by the indexing model from the issue text.
Description
Is your feature request related to a problem? Please describe.
The SDK's transports (JsonRpcTransport, RestTransport, GrpcTransport) raise immediately on transient failures (network errors, timeouts, rate limits, 5xx responses, gRPC UNAVAILABLE/RESOURCE_EXHAUSTED) with no built-in retry mechanism. Every caller has to reimplement the same retry/backoff loop, and to do it correctly they have to inspect __cause__ chains because A2AClientError doesn't expose HTTP status codes or gRPC codes directly.
Describe the solution you'd like
A RetryTransport decorator wrapping any ClientTransport, mirroring the existing TenantTransportDecorator pattern:
inner = JsonRpcTransport(httpx_client=client, agent_card=card)
transport = RetryTransport(base=inner, max_retries=3)
The default predicate retries on:
A2AClientTimeoutError(always).A2AClientErrorchained fromhttpx.RequestErrororhttpx.HTTPStatusError(408/429/502/503/504).A2AClientErrorchained fromgrpc.aio.AioRpcError(UNAVAILABLE/RESOURCE_EXHAUSTED).- Domain errors (
TaskNotFoundError, etc.) are never retried.
retry_predicate is configurable for custom logic, and on_retry is exposed as a hook for logging/metrics. Streaming methods (send_message_streaming, subscribe) only retry before the first event is yielded.
Describe alternatives you've considered
- Retry via
ClientCallInterceptor— not feasible;after()only fires on successful results, so interceptors never see exceptions. - Transport-specific retry (httpx custom transport, gRPC
retryPolicy/UnaryUnaryClientInterceptor) — operates below the SDK's exception layer, requires two separate configurations, and doesn't cover all three transports uniformly. - Retry inside each transport implementation — triples the logic across
JsonRpcTransport,RestTransport,GrpcTransportand forces every future transport to reimplement it.
Additional context
Purely additive: new RetryTransport class, tests, and one export change. No new dependencies — the grpc import is conditional, matching the SDK's existing pattern. ClientFactory integration is left as a follow-up.
Code of Conduct
- I agree to follow this project's Code of Conduct
- Dominant language
- Python
- Stars
- 2.2k
- Forks
- 540
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 57
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from a2aproject/a2a-python
-
[Bug]: REST task/request id sanitizationMay be free again A pull request for this issue was closed without being merged. Openmaintainers-only
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
a2aproject/a2a-python#805 · 1 comment ·
Maintainers usually reply within 2 days
-
[Bug]: v0.3 JSON-RPC `tasks/pushNotificationConfig/delete` succeeds with no `result` memberPossibly taken @rohityan claimed this today. Open
a2aproject/a2a-python#1480 · 2 assignees ·
Maintainers usually reply within 2 days
-
[Bug]: A2ACardResolver.get_agent_card raises UnicodeDecodeError and RecursionError instead of AgentCardResolutionErrorPossibly taken @rohityan claimed this 1 day ago. Open
a2aproject/a2a-python#1478 · 2 assignees ·
Maintainers usually reply within 2 days
-
[Bug]: JSON-RPC client ignores the JSON-RPC error body when the HTTP status is not 2xxPossibly taken @rohityan claimed this 1 day ago. Open
a2aproject/a2a-python#1475 · 1 assignee ·
Maintainers usually reply within 2 days
-
[Feat]: validate_input_modes: match media ranges such as image/* declared in the agent cardPossibly taken @rohityan claimed this 3 days ago. Opencomponent: core status:awaiting response
a2aproject/a2a-python#1468 · 1 comment · 1 assignee ·
Maintainers usually reply within 2 days
All issues in a2aproject/a2a-python
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
canonical/paas-charm#407 · 1 comment ·
Maintainers usually reply within 5 days
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 90/100
FAIRmat-NFDI/pynxtools-spm#136 ·
Maintainers usually reply within 1 day
-
enhancement tooling
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
`read_nexus` entry point points to a function that no longer existsPossibly taken @RubelMozumder claimed this today. Openannotator bug
Difficulty 1/5 Under an hour Newbie friendliness 88/100
FAIRmat-NFDI/pynxtools#876 · 1 comment ·
Maintainers usually reply within 1 day
-
[Bug]: HTTP 499 (Client Closed Request) is classified as a non-retryable format_error, so a mid-flight abort fails the turn over instead of retryingPossibly taken @yipinghuang1991 claimed this today. Opencomp/agent P2 type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
NousResearch/hermes-agent#156837 ·
Maintainers usually reply within 1 day