diff --git a/python/packages/autogen-agentchat/src/autogen_agentchat/teams/_group_chat/_base_group_chat.py b/python/packages/autogen-agentchat/src/autogen_agentchat/teams/_group_chat/_base_group_chat.py index e075d0e87660..d27865e0a4ab 100644 --- a/python/packages/autogen-agentchat/src/autogen_agentchat/teams/_group_chat/_base_group_chat.py +++ b/python/packages/autogen-agentchat/src/autogen_agentchat/teams/_group_chat/_base_group_chat.py @@ -406,7 +406,6 @@ async def stop_runtime() -> None: recipient=AgentId(type=self._group_chat_manager_topic_type, key=self._team_id), cancellation_token=cancellation_token, ) - # Collect the output messages in order. output_messages: List[AgentEvent | ChatMessage] = [] # Yield the messsages until the queue is empty. @@ -426,8 +425,7 @@ async def stop_runtime() -> None: finally: # Wait for the shutdown task to finish. - if shutdown_task is not None: - await shutdown_task + await shutdown_task # Clear the output message queue. while not self._output_message_queue.empty():