From 90a367664eb159d840c0943d98272b83aeb4798f Mon Sep 17 00:00:00 2001 From: ran Date: Fri, 3 Oct 2025 17:10:26 +0200 Subject: [PATCH] fix: ensure args delta on manual tool call are always string --- .../langgraph/python/ag_ui_langgraph/agent.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/typescript-sdk/integrations/langgraph/python/ag_ui_langgraph/agent.py b/typescript-sdk/integrations/langgraph/python/ag_ui_langgraph/agent.py index 54546b62a..13b224445 100644 --- a/typescript-sdk/integrations/langgraph/python/ag_ui_langgraph/agent.py +++ b/typescript-sdk/integrations/langgraph/python/ag_ui_langgraph/agent.py @@ -651,7 +651,13 @@ async def _handle_single_event(self, event: Any, state: State) -> AsyncGenerator ) ) yield self._dispatch_event( - ToolCallArgsEvent(type=EventType.TOOL_CALL_ARGS, tool_call_id=event["data"]["id"], delta=event["data"]["args"], raw_event=event) + ToolCallArgsEvent( + type=EventType.TOOL_CALL_ARGS, + tool_call_id=event["data"]["id"], + delta=event["data"]["args"] if isinstance(event["data"]["args"], str) else json.dumps( + event["data"]["args"]), + raw_event=event + ) ) yield self._dispatch_event( ToolCallEndEvent(type=EventType.TOOL_CALL_END, tool_call_id=event["data"]["id"], raw_event=event)