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
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def _handle_tool_call_end(self, event: dict[str, Any]) -> ChatResponseUpdate | N

def _handle_tool_call_result(self, event: dict[str, Any]) -> ChatResponseUpdate:
"""Handle TOOL_CALL_RESULT event."""
tool_call_id = event.get("toolCallId", "")
tool_call_id = self._get_tool_call_id(event) or ""
result = event.get("result") if event.get("result") is not None else event.get("content")

return ChatResponseUpdate(
Expand Down
14 changes: 14 additions & 0 deletions python/packages/ag-ui/tests/ag_ui/test_event_converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,20 @@ def test_tool_call_result_event(self) -> None:
assert update.contents[0].call_id == "call_123"
assert update.contents[0].result == '{"temperature": 22, "condition": "sunny"}'

def test_tool_call_result_event_snake_case_id(self) -> None:
"""TOOL_CALL_RESULT accepts tool_call_id like the other tool call events."""
converter = AGUIEventConverter()
event = {
"type": "TOOL_CALL_RESULT",
"tool_call_id": "call_snake",
"content": "sunny",
}

update = converter.convert_event(event)

assert update is not None
assert update.contents[0].call_id == "call_snake"

def test_run_finished_event(self) -> None:
"""Test conversion of RUN_FINISHED event."""
converter = AGUIEventConverter()
Expand Down
Loading