3131 Task ,
3232 TaskPushNotificationConfig ,
3333)
34- from a2a .utils import proto_utils
34+ from a2a .utils import constants , proto_utils
3535from a2a .utils .errors import (
3636 JSON_RPC_ERROR_CODE_MAP ,
3737 A2AError ,
4949 UnsupportedOperationError ,
5050 VersionNotSupportedError ,
5151)
52- from a2a .utils .helpers import maybe_await , validate , validate_async_generator
52+ from a2a .utils .helpers import (
53+ maybe_await ,
54+ validate ,
55+ validate_async_generator ,
56+ validate_version ,
57+ )
5358from a2a .utils .telemetry import SpanKind , trace_class
5459
5560
@@ -143,6 +148,7 @@ def _get_request_id(
143148 return None
144149 return context .state .get ('request_id' )
145150
151+ @validate_version (constants .PROTOCOL_VERSION_1_0 )
146152 async def on_message_send (
147153 self ,
148154 request : SendMessageRequest ,
@@ -172,6 +178,7 @@ async def on_message_send(
172178 except A2AError as e :
173179 return _build_error_response (request_id , e )
174180
181+ @validate_version (constants .PROTOCOL_VERSION_1_0 )
175182 @validate_async_generator (
176183 lambda self : self .agent_card .capabilities .streaming ,
177184 'Streaming is not supported by the agent' ,
@@ -210,6 +217,7 @@ async def on_message_send_stream(
210217 e ,
211218 )
212219
220+ @validate_version (constants .PROTOCOL_VERSION_1_0 )
213221 async def on_cancel_task (
214222 self ,
215223 request : CancelTaskRequest ,
@@ -236,6 +244,7 @@ async def on_cancel_task(
236244
237245 return _build_error_response (request_id , TaskNotFoundError ())
238246
247+ @validate_version (constants .PROTOCOL_VERSION_1_0 )
239248 @validate_async_generator (
240249 lambda self : self .agent_card .capabilities .streaming ,
241250 'Streaming is not supported by the agent' ,
@@ -274,6 +283,7 @@ async def on_subscribe_to_task(
274283 e ,
275284 )
276285
286+ @validate_version (constants .PROTOCOL_VERSION_1_0 )
277287 async def get_push_notification_config (
278288 self ,
279289 request : GetTaskPushNotificationConfigRequest ,
@@ -300,6 +310,7 @@ async def get_push_notification_config(
300310 except A2AError as e :
301311 return _build_error_response (request_id , e )
302312
313+ @validate_version (constants .PROTOCOL_VERSION_1_0 )
303314 @validate (
304315 lambda self : self .agent_card .capabilities .push_notifications ,
305316 'Push notifications are not supported by the agent' ,
@@ -337,6 +348,7 @@ async def set_push_notification_config(
337348 except A2AError as e :
338349 return _build_error_response (request_id , e )
339350
351+ @validate_version (constants .PROTOCOL_VERSION_1_0 )
340352 async def on_get_task (
341353 self ,
342354 request : GetTaskRequest ,
@@ -363,6 +375,7 @@ async def on_get_task(
363375
364376 return _build_error_response (request_id , TaskNotFoundError ())
365377
378+ @validate_version (constants .PROTOCOL_VERSION_1_0 )
366379 async def list_tasks (
367380 self ,
368381 request : ListTasksRequest ,
@@ -391,6 +404,7 @@ async def list_tasks(
391404 except A2AError as e :
392405 return _build_error_response (request_id , e )
393406
407+ @validate_version (constants .PROTOCOL_VERSION_1_0 )
394408 async def list_push_notification_configs (
395409 self ,
396410 request : ListTaskPushNotificationConfigsRequest ,
@@ -416,6 +430,7 @@ async def list_push_notification_configs(
416430 except A2AError as e :
417431 return _build_error_response (request_id , e )
418432
433+ @validate_version (constants .PROTOCOL_VERSION_1_0 )
419434 async def delete_push_notification_config (
420435 self ,
421436 request : DeleteTaskPushNotificationConfigRequest ,
0 commit comments