Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/agents/realtime/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,7 @@ async def _handle_tool_call(
RealtimeModelSendToolOutput(
tool_call=event,
output=error_message,
start_response=True,
start_response=False,
)
)
await self._put_event(
Expand Down
4 changes: 2 additions & 2 deletions tests/realtime/test_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -1288,7 +1288,7 @@ async def test_handoff_tool_handling(self, mock_model):

@pytest.mark.asyncio
async def test_unknown_tool_handling(self, mock_model, mock_agent, mock_function_tool):
"""Test that unknown tools complete the model call and emit a RealtimeError event"""
"""Test that unknown tools complete the model call without starting a response."""
# Set up agent to return different tool than what's called
mock_function_tool.name = "known_tool"
mock_agent.get_all_tools.return_value = [mock_function_tool]
Expand All @@ -1307,7 +1307,7 @@ async def test_unknown_tool_handling(self, mock_model, mock_agent, mock_function
sent_call, sent_output, start_response = mock_model.sent_tool_outputs[0]
assert sent_call == tool_call_event
assert "Tool unknown_tool not found" in sent_output
assert start_response is True
assert start_response is False

# Should have emitted a RealtimeError event
assert session._event_queue.qsize() >= 1
Expand Down
Loading