Skip to content

[Bug]: v0.3 gRPC client ignores ClientCallContext.timeout, so calls never time out #1496

Description

@saquibjawedbit

What happened?

ClientCallContext.timeout sets a per-call deadline, and the v1.0 GrpcTransport and the HTTP transports honor it (#776). CompatGrpcTransport, the client used for agents that advertise a v0.3 gRPC interface, does not. Every stub call passes only metadata= and never timeout=:

https://github.com/a2aproject/a2a-python/blob/e7114a3ed59d5ccaed3c10fc6a1c11f21fb57a60/src/a2a/compat/v0_3/grpc_transport.py#L233-L236

The v1.0 transport, for comparison:

https://github.com/a2aproject/a2a-python/blob/e7114a3ed59d5ccaed3c10fc6a1c11f21fb57a60/src/a2a/client/transports/grpc.py#L322-L327

So a call to a slow or hung v0.3 gRPC server waits until the server answers, however long that takes, even when the caller asked for a timeout. This affects all ten RPCs, streaming included. It also means the DEADLINE_EXCEEDED -> A2AClientTimeoutError mapping in this transport never fires for a deadline set by the caller:

https://github.com/a2aproject/a2a-python/blob/e7114a3ed59d5ccaed3c10fc6a1c11f21fb57a60/src/a2a/compat/v0_3/grpc_transport.py#L51-L53

CompatGrpcTransport was merged (#779) three days after #776 added the timeout and did not pick it up.

Repro (a v0.3 gRPC server whose GetTask takes 2 s, with a client timeout of 0.2 s):

import asyncio, time
import grpc
from a2a.client.client import ClientCallContext
from a2a.compat.v0_3 import a2a_v0_3_pb2, a2a_v0_3_pb2_grpc
from a2a.compat.v0_3.grpc_transport import CompatGrpcTransport
from a2a.types.a2a_pb2 import GetTaskRequest


class SlowServicer(a2a_v0_3_pb2_grpc.A2AServiceServicer):
    async def GetTask(self, request, context):
        await asyncio.sleep(2)
        return a2a_v0_3_pb2.Task(id='t1', context_id='c1')


async def main():
    server = grpc.aio.server()
    a2a_v0_3_pb2_grpc.add_A2AServiceServicer_to_server(SlowServicer(), server)
    port = server.add_insecure_port('127.0.0.1:0')
    await server.start()
    transport = CompatGrpcTransport(grpc.aio.insecure_channel(f'127.0.0.1:{port}'), None)
    start = time.monotonic()
    try:
        task = await transport.get_task(GetTaskRequest(id='t1'), context=ClientCallContext(timeout=0.2))
        print(f'returned task {task.id!r} after {time.monotonic() - start:.2f}s')
    except Exception as e:
        print(f'raised {type(e).__name__} after {time.monotonic() - start:.2f}s')
    await transport.close()
    await server.stop(None)


asyncio.run(main())

Output on main (e7114a3):

returned task 't1' after 2.01s

Expected: raised A2AClientTimeoutError after 0.20s, the same as GrpcTransport against a v1.0 server.

Actual: the timeout is dropped and the call blocks until the server responds.

The fix is to pass timeout= on each stub call, the same way GrpcTransport does.

I have a fix with a test and can open a PR.

Code of Conduct

  • I agree to follow this project's Code of Conduct

Activity

  1. added
    component: clientIssues related to transport logic and configuration for external apps connecting to A2A agents.
    on Nov 19, 2026
  2. added theissue type on Nov 19, 2026
  3. rohityan commented on Nov 19, 2026

    @rohityan

    Hi @saquibjawedbit, Thank you for reporting this and providing a clear reproduction. I was able to reproduce the issue.

    CompatGrpcTransport invokes self.stub.* methods (such as CompatGrpcTransport.get_task) with metadata=self._get_grpc_metadata(context) but omits timeout=. Unlike GrpcTransport._get_grpc_timeout() , no gRPC deadline is set from ClientCallContext.timeout, so DEADLINE_EXCEEDED never fires and _map_grpc_error() never raises A2AClientTimeoutError.

    Thanks for opening PR #1497 , the fix appear to be right approach. Assigning this issue to you until the PR is reviewed. Till then as a workaround callers can wrap CompatGrpcTransport calls in asyncio.wait_for(..., timeout=...) on the caller side to enforce a client-side timeout.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

component: clientIssues related to transport logic and configuration for external apps connecting to A2A agents.status:awaiting response

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions