File tree Expand file tree Collapse file tree
python/packages/autogen-agentchat/src/autogen_agentchat/agents Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1197,22 +1197,24 @@ async def _execute_tool_calls(
11971197 function_calls : List [FunctionCall ],
11981198 stream_queue : asyncio .Queue [BaseAgentEvent | BaseChatMessage | None ],
11991199 ) -> List [Tuple [FunctionCall , FunctionExecutionResult ]]:
1200- results = await asyncio .gather (
1201- * [
1202- cls ._execute_tool_call (
1203- tool_call = call ,
1204- workbench = workbench ,
1205- handoff_tools = handoff_tools ,
1206- agent_name = agent_name ,
1207- cancellation_token = cancellation_token ,
1208- stream = stream_queue ,
1209- )
1210- for call in function_calls
1211- ]
1212- )
1213- # Signal the end of streaming by putting None in the queue.
1214- stream_queue .put_nowait (None )
1215- return results
1200+ try :
1201+ results = await asyncio .gather (
1202+ * [
1203+ cls ._execute_tool_call (
1204+ tool_call = call ,
1205+ workbench = workbench ,
1206+ handoff_tools = handoff_tools ,
1207+ agent_name = agent_name ,
1208+ cancellation_token = cancellation_token ,
1209+ stream = stream_queue ,
1210+ )
1211+ for call in function_calls
1212+ ]
1213+ )
1214+ return results
1215+ finally :
1216+ # Signal the end of streaming by putting None in the queue.
1217+ stream_queue .put_nowait (None )
12161218
12171219 task = asyncio .create_task (_execute_tool_calls (current_model_result .content , stream ))
12181220
You can’t perform that action at this time.
0 commit comments