Skip to content

Commit f5a62db

Browse files
committed
Fix: pass tool_name and tool_call_id when handling tool calls in RealtimeSession
1 parent 2b1fd6e commit f5a62db

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/agents/realtime/session.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,12 @@ async def _handle_tool_call(self, event: RealtimeModelToolCallEvent) -> None:
250250
)
251251

252252
func_tool = function_map[event.name]
253-
tool_context = ToolContext.from_agent_context(self._context_wrapper, event.call_id)
253+
tool_context = ToolContext(
254+
context=self._context_wrapper.context,
255+
usage=self._context_wrapper.usage,
256+
tool_name=event.name,
257+
tool_call_id=event.call_id,
258+
)
254259
result = await func_tool.on_invoke_tool(tool_context, event.arguments)
255260

256261
await self._model.send_tool_output(event, str(result), True)

0 commit comments

Comments
 (0)