diff --git a/python/packages/autogen-core/src/autogen_core/_routed_agent.py b/python/packages/autogen-core/src/autogen_core/_routed_agent.py index a5908278cab9..bd8f3194fa8e 100644 --- a/python/packages/autogen-core/src/autogen_core/_routed_agent.py +++ b/python/packages/autogen-core/src/autogen_core/_routed_agent.py @@ -164,7 +164,7 @@ async def wrapper(self: AgentT, message: ReceivesT, ctx: MessageContext) -> Prod return wrapper_handler - if func is None and not callable(func): + if func is None and not callable(func) or getattr(func, "__isabstractmethod__", False): return decorator elif callable(func): return decorator(func) @@ -284,7 +284,7 @@ async def wrapper(self: AgentT, message: ReceivesT, ctx: MessageContext) -> None return wrapper_handler - if func is None and not callable(func): + if func is None and not callable(func) or getattr(func, "__isabstractmethod__", False): return decorator elif callable(func): return decorator(func) @@ -404,7 +404,7 @@ async def wrapper(self: AgentT, message: ReceivesT, ctx: MessageContext) -> Prod return wrapper_handler - if func is None and not callable(func): + if func is None and not callable(func) or getattr(func, "__isabstractmethod__", False): return decorator elif callable(func): return decorator(func)