@@ -429,17 +429,17 @@ async def execute_function_tool_calls(
429
429
context_wrapper : RunContextWrapper [TContext ],
430
430
config : RunConfig ,
431
431
) -> list [FunctionToolResult ]:
432
- async def run_single_tool (
433
- func_tool : FunctionTool , tool_call : ResponseFunctionToolCall
434
- ) -> Any :
432
+ async def run_single_tool (action : ToolRunFunction ) -> Any :
433
+ func_tool = action . function_tool
434
+ tool_call = action . tool_call
435
435
with function_span (func_tool .name ) as span_fn :
436
436
if config .trace_include_sensitive_data :
437
437
span_fn .span_data .input = tool_call .arguments
438
438
try :
439
439
_ , _ , result = await asyncio .gather (
440
- hooks .on_tool_start (context_wrapper , agent , func_tool ),
440
+ hooks .on_tool_start (context_wrapper , agent , action ),
441
441
(
442
- agent .hooks .on_tool_start (context_wrapper , agent , func_tool )
442
+ agent .hooks .on_tool_start (context_wrapper , agent , action )
443
443
if agent .hooks
444
444
else _coro .noop_coroutine ()
445
445
),
@@ -472,7 +472,7 @@ async def run_single_tool(
472
472
tasks = []
473
473
for tool_run in tool_runs :
474
474
function_tool = tool_run .function_tool
475
- tasks .append (run_single_tool (function_tool , tool_run . tool_call ))
475
+ tasks .append (run_single_tool (function_tool , tool_run ))
476
476
477
477
results = await asyncio .gather (* tasks )
478
478
@@ -831,9 +831,9 @@ async def execute(
831
831
)
832
832
833
833
_ , _ , output = await asyncio .gather (
834
- hooks .on_tool_start (context_wrapper , agent , action . computer_tool ),
834
+ hooks .on_tool_start (context_wrapper , agent , action ),
835
835
(
836
- agent .hooks .on_tool_start (context_wrapper , agent , action . computer_tool )
836
+ agent .hooks .on_tool_start (context_wrapper , agent , action )
837
837
if agent .hooks
838
838
else _coro .noop_coroutine ()
839
839
),
@@ -918,4 +918,4 @@ async def _get_screenshot_async(
918
918
elif isinstance (action , ActionWait ):
919
919
await computer .wait ()
920
920
921
- return await computer .screenshot ()
921
+ return await computer .screenshot ()
0 commit comments