@@ -389,27 +389,8 @@ def async_gen_wrapper(
389389
390390 return cast ('F' , async_gen_wrapper )
391391
392- if inspect .iscoroutinefunction (inspect .unwrap (func )):
393-
394- @functools .wraps (func )
395- async def async_wrapper (self : Any , * args : Any , ** kwargs : Any ) -> Any :
396- actual_version = _get_actual_version (args , kwargs )
397- if not _is_version_compatible (actual_version ):
398- logger .warning (
399- "Version mismatch: actual='%s', expected='%s'" ,
400- actual_version ,
401- expected_version ,
402- )
403- raise VersionNotSupportedError (
404- message = f"A2A version '{ actual_version } ' is not supported by this handler. "
405- f"Expected version '{ expected_version } '."
406- )
407- return await func (self , * args , ** kwargs )
408-
409- return cast ('F' , async_wrapper )
410-
411392 @functools .wraps (func )
412- def sync_wrapper (self : Any , * args : Any , ** kwargs : Any ) -> Any :
393+ async def async_wrapper (self : Any , * args : Any , ** kwargs : Any ) -> Any :
413394 actual_version = _get_actual_version (args , kwargs )
414395 if not _is_version_compatible (actual_version ):
415396 logger .warning (
@@ -421,8 +402,8 @@ def sync_wrapper(self: Any, *args: Any, **kwargs: Any) -> Any:
421402 message = f"A2A version '{ actual_version } ' is not supported by this handler. "
422403 f"Expected version '{ expected_version } '."
423404 )
424- return func (self , * args , ** kwargs )
405+ return await func (self , * args , ** kwargs )
425406
426- return cast ('F' , sync_wrapper )
407+ return cast ('F' , async_wrapper )
427408
428409 return decorator
0 commit comments