2020)
2121from a2a .server .request_handlers .request_handler import RequestHandler
2222from a2a .server .tasks import (
23- ResultAggregator ,
2423 PushNotificationConfigStore ,
2524 PushNotificationSender ,
25+ ResultAggregator ,
2626 TaskManager ,
2727 TaskStore ,
2828)
2929from a2a .types import (
30+ GetTaskPushNotificationConfigParams ,
3031 InternalError ,
3132 Message ,
3233 MessageSendConfiguration ,
3839 TaskPushNotificationConfig ,
3940 TaskQueryParams ,
4041 UnsupportedOperationError ,
41- GetTaskPushNotificationConfigParams ,
4242)
4343from a2a .utils .errors import ServerError
4444from a2a .utils .telemetry import SpanKind , trace_class
@@ -58,7 +58,7 @@ class DefaultRequestHandler(RequestHandler):
5858
5959 _running_agents : dict [str , asyncio .Task ]
6060
61- def __init__ (
61+ def __init__ ( # noqa: PLR0913
6262 self ,
6363 agent_executor : AgentExecutor ,
6464 task_store : TaskStore ,
@@ -202,7 +202,7 @@ async def on_message_send(
202202 context = context ,
203203 )
204204
205- task_id = cast (str , request_context .task_id )
205+ task_id = cast (' str' , request_context .task_id )
206206 # Always assign a task ID. We may not actually upgrade to a task, but
207207 # dictating the task ID at this layer is useful for tracking running
208208 # agents.
@@ -240,7 +240,7 @@ async def on_message_send(
240240 finally :
241241 if interrupted :
242242 # TODO: Track this disconnected cleanup task.
243- asyncio .create_task (
243+ asyncio .create_task ( # noqa: RUF006
244244 self ._cleanup_producer (producer_task , task_id )
245245 )
246246 else :
@@ -292,7 +292,7 @@ async def on_message_send_stream(
292292 context = context ,
293293 )
294294
295- task_id = cast (str , request_context .task_id )
295+ task_id = cast (' str' , request_context .task_id )
296296 queue = await self ._queue_manager .create_or_tap (task_id )
297297 producer_task = asyncio .create_task (
298298 self ._run_event_stream (
@@ -383,7 +383,7 @@ async def on_get_task_push_notification_config(
383383 ) -> TaskPushNotificationConfig :
384384 """Default handler for 'tasks/pushNotificationConfig/get'.
385385
386- Requires a `PushNotifier ` to be configured.
386+ Requires a `PushConfigStore ` to be configured.
387387 """
388388 if not self ._push_config_store :
389389 raise ServerError (error = UnsupportedOperationError ())
@@ -432,6 +432,7 @@ async def on_resubscribe_to_task(
432432 yield event
433433
434434 def should_add_push_info (self , params : MessageSendParams ) -> bool :
435+ """Determines if push notification info should be set for a task."""
435436 return bool (
436437 self ._push_config_store
437438 and params .configuration
0 commit comments