File tree Expand file tree Collapse file tree 2 files changed +25
-2
lines changed
src/a2a/client/transports Expand file tree Collapse file tree 2 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -138,7 +138,10 @@ async def get_task(
138138 ) -> Task :
139139 """Retrieves the current state and history of a specific task."""
140140 task = await self .stub .GetTask (
141- a2a_pb2 .GetTaskRequest (name = f'tasks/{ request .id } ' )
141+ a2a_pb2 .GetTaskRequest (
142+ name = f'tasks/{ request .id } ' ,
143+ history_length = request .history_length ,
144+ )
142145 )
143146 return proto_utils .FromProto .task (task )
144147
Original file line number Diff line number Diff line change @@ -145,11 +145,31 @@ async def test_get_task(
145145 response = await grpc_transport .get_task (params )
146146
147147 mock_grpc_stub .GetTask .assert_awaited_once_with (
148- a2a_pb2 .GetTaskRequest (name = f'tasks/{ sample_task .id } ' )
148+ a2a_pb2 .GetTaskRequest (
149+ name = f'tasks/{ sample_task .id } ' , history_length = None
150+ )
149151 )
150152 assert response .id == sample_task .id
151153
152154
155+ @pytest .mark .asyncio
156+ async def test_get_task_with_history (
157+ grpc_transport : GrpcTransport , mock_grpc_stub : AsyncMock , sample_task : Task
158+ ):
159+ """Test retrieving a task with history."""
160+ mock_grpc_stub .GetTask .return_value = proto_utils .ToProto .task (sample_task )
161+ history_len = 10
162+ params = TaskQueryParams (id = sample_task .id , history_length = history_len )
163+
164+ await grpc_transport .get_task (params )
165+
166+ mock_grpc_stub .GetTask .assert_awaited_once_with (
167+ a2a_pb2 .GetTaskRequest (
168+ name = f'tasks/{ sample_task .id } ' , history_length = history_len
169+ )
170+ )
171+
172+
153173@pytest .mark .asyncio
154174async def test_cancel_task (
155175 grpc_transport : GrpcTransport , mock_grpc_stub : AsyncMock , sample_task : Task
You can’t perform that action at this time.
0 commit comments