diff --git a/src/a2a/compat/v0_3/rest_adapter.py b/src/a2a/compat/v0_3/rest_adapter.py index 38687054f..9c3e0f215 100644 --- a/src/a2a/compat/v0_3/rest_adapter.py +++ b/src/a2a/compat/v0_3/rest_adapter.py @@ -142,9 +142,10 @@ def routes(self) -> dict[tuple[str, str], Callable[[Request], Any]]: ): functools.partial( self._handle_request, self.handler.list_push_notifications ), - ('/v1/tasks', 'GET'): functools.partial( - self._handle_request, self.handler.list_tasks - ), + # ListTasks is intentionally absent: not in the A2A v0.3 spec (see + # issue #1043). Sibling v0.3 transports (jsonrpc_transport, + # grpc_transport, rest_transport) also reject list_tasks with + # NotImplementedError — do not add a route here. ('/v1/card', 'GET'): functools.partial( self._handle_request, self.handler.on_get_extended_agent_card ), diff --git a/src/a2a/compat/v0_3/rest_handler.py b/src/a2a/compat/v0_3/rest_handler.py index bd5fcd2e6..107e065b7 100644 --- a/src/a2a/compat/v0_3/rest_handler.py +++ b/src/a2a/compat/v0_3/rest_handler.py @@ -290,15 +290,6 @@ async def list_push_notifications( return MessageToDict(pb2_v03_resp) - @validate_version(constants.PROTOCOL_VERSION_0_3) - async def list_tasks( - self, - request: Request, - context: ServerCallContext, - ) -> dict[str, Any]: - """Handles the 'tasks/list' REST method.""" - raise NotImplementedError('list tasks not implemented') - @validate_version(constants.PROTOCOL_VERSION_0_3) async def on_get_extended_agent_card( self, diff --git a/tests/compat/v0_3/test_rest_handler.py b/tests/compat/v0_3/test_rest_handler.py index 6ff44abb1..323390fed 100644 --- a/tests/compat/v0_3/test_rest_handler.py +++ b/tests/compat/v0_3/test_rest_handler.py @@ -357,12 +357,6 @@ async def test_list_push_notifications( assert called_req.params.id == 'task-1' -@pytest.mark.anyio -async def test_list_tasks(rest_handler, mock_request, mock_context): - with pytest.raises(NotImplementedError): - await rest_handler.list_tasks(mock_request, mock_context) - - # Add our new translation method test @pytest.mark.anyio async def test_on_get_extended_agent_card_success( diff --git a/tests/compat/v0_3/test_rest_routes_compat.py b/tests/compat/v0_3/test_rest_routes_compat.py index 2b6409432..df200a27e 100644 --- a/tests/compat/v0_3/test_rest_routes_compat.py +++ b/tests/compat/v0_3/test_rest_routes_compat.py @@ -5,6 +5,7 @@ import pytest from a2a.compat.v0_3 import a2a_v0_3_pb2 +from a2a.compat.v0_3.rest_adapter import REST03Adapter from a2a.server.request_handlers.request_handler import RequestHandler from a2a.server.routes import create_agent_card_routes from a2a.server.routes.rest_routes import create_rest_routes @@ -166,6 +167,14 @@ async def test_get_task_v03( assert expected_response == actual_response +@pytest.mark.anyio +async def test_list_tasks_not_in_v03_adapter_routes( + request_handler: RequestHandler, +) -> None: + adapter = REST03Adapter(http_handler=request_handler) + assert ('/v1/tasks', 'GET') not in adapter.routes() + + @pytest.mark.anyio async def test_cancel_task_v03( client: AsyncClient, request_handler: MagicMock