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
@@ -142,6 +147,7 @@ def _get_request_id(
142147 return None
143148 return context .state .get ('request_id' )
144149
150+ @validate_version (constants .PROTOCOL_VERSION_1_0 )
145151 async def on_message_send (
146152 self ,
147153 request : SendMessageRequest ,
@@ -171,6 +177,7 @@ async def on_message_send(
171177 except A2AError as e :
172178 return _build_error_response (request_id , e )
173179
180+ @validate_version (constants .PROTOCOL_VERSION_1_0 )
174181 @validate_async_generator (
175182 lambda self : self .agent_card .capabilities .streaming ,
176183 'Streaming is not supported by the agent' ,
@@ -209,6 +216,7 @@ async def on_message_send_stream(
209216 e ,
210217 )
211218
219+ @validate_version (constants .PROTOCOL_VERSION_1_0 )
212220 async def on_cancel_task (
213221 self ,
214222 request : CancelTaskRequest ,
@@ -235,6 +243,7 @@ async def on_cancel_task(
235243
236244 return _build_error_response (request_id , TaskNotFoundError ())
237245
246+ @validate_version (constants .PROTOCOL_VERSION_1_0 )
238247 @validate_async_generator (
239248 lambda self : self .agent_card .capabilities .streaming ,
240249 'Streaming is not supported by the agent' ,
@@ -273,6 +282,7 @@ async def on_subscribe_to_task(
273282 e ,
274283 )
275284
285+ @validate_version (constants .PROTOCOL_VERSION_1_0 )
276286 async def get_push_notification_config (
277287 self ,
278288 request : GetTaskPushNotificationConfigRequest ,
@@ -299,6 +309,7 @@ async def get_push_notification_config(
299309 except A2AError as e :
300310 return _build_error_response (request_id , e )
301311
312+ @validate_version (constants .PROTOCOL_VERSION_1_0 )
302313 @validate (
303314 lambda self : self .agent_card .capabilities .push_notifications ,
304315 'Push notifications are not supported by the agent' ,
@@ -336,6 +347,7 @@ async def set_push_notification_config(
336347 except A2AError as e :
337348 return _build_error_response (request_id , e )
338349
350+ @validate_version (constants .PROTOCOL_VERSION_1_0 )
339351 async def on_get_task (
340352 self ,
341353 request : GetTaskRequest ,
@@ -362,6 +374,7 @@ async def on_get_task(
362374
363375 return _build_error_response (request_id , TaskNotFoundError ())
364376
377+ @validate_version (constants .PROTOCOL_VERSION_1_0 )
365378 async def list_tasks (
366379 self ,
367380 request : ListTasksRequest ,
@@ -390,6 +403,7 @@ async def list_tasks(
390403 except A2AError as e :
391404 return _build_error_response (request_id , e )
392405
406+ @validate_version (constants .PROTOCOL_VERSION_1_0 )
393407 async def list_push_notification_configs (
394408 self ,
395409 request : ListTaskPushNotificationConfigsRequest ,
@@ -415,6 +429,7 @@ async def list_push_notification_configs(
415429 except A2AError as e :
416430 return _build_error_response (request_id , e )
417431
432+ @validate_version (constants .PROTOCOL_VERSION_1_0 )
418433 async def delete_push_notification_config (
419434 self ,
420435 request : DeleteTaskPushNotificationConfigRequest ,
0 commit comments