Skip to content

Commit f1ebc69

Browse files
committed
imple
Signed-off-by: myan <[email protected]>
1 parent c3287fd commit f1ebc69

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/agents/_run_impl.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -429,17 +429,17 @@ async def execute_function_tool_calls(
429429
context_wrapper: RunContextWrapper[TContext],
430430
config: RunConfig,
431431
) -> 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
435435
with function_span(func_tool.name) as span_fn:
436436
if config.trace_include_sensitive_data:
437437
span_fn.span_data.input = tool_call.arguments
438438
try:
439439
_, _, result = await asyncio.gather(
440-
hooks.on_tool_start(context_wrapper, agent, func_tool),
440+
hooks.on_tool_start(context_wrapper, agent, action),
441441
(
442-
agent.hooks.on_tool_start(context_wrapper, agent, func_tool)
442+
agent.hooks.on_tool_start(context_wrapper, agent, action)
443443
if agent.hooks
444444
else _coro.noop_coroutine()
445445
),
@@ -472,7 +472,7 @@ async def run_single_tool(
472472
tasks = []
473473
for tool_run in tool_runs:
474474
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))
476476

477477
results = await asyncio.gather(*tasks)
478478

@@ -831,9 +831,9 @@ async def execute(
831831
)
832832

833833
_, _, output = await asyncio.gather(
834-
hooks.on_tool_start(context_wrapper, agent, action.computer_tool),
834+
hooks.on_tool_start(context_wrapper, agent, action),
835835
(
836-
agent.hooks.on_tool_start(context_wrapper, agent, action.computer_tool)
836+
agent.hooks.on_tool_start(context_wrapper, agent, action)
837837
if agent.hooks
838838
else _coro.noop_coroutine()
839839
),
@@ -918,4 +918,4 @@ async def _get_screenshot_async(
918918
elif isinstance(action, ActionWait):
919919
await computer.wait()
920920

921-
return await computer.screenshot()
921+
return await computer.screenshot()

0 commit comments

Comments
 (0)