Skip to content

Commit a0155b0

Browse files
authored
fix: ensure stringified args when emitting tool calls (CopilotKit#2571)
1 parent b4c7737 commit a0155b0

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

sdk-python/copilotkit/langgraph_agui_agent.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import json
12
from typing import Dict, Any, List, Optional, Union, AsyncGenerator
23
from enum import Enum
34
from ag_ui_langgraph import LangGraphAgent
@@ -96,7 +97,8 @@ def _dispatch_event(self, event) -> str:
9697
ToolCallArgsEvent(
9798
type=EventType.TOOL_CALL_ARGS,
9899
tool_call_id=custom_event.value["id"],
99-
delta=custom_event.value["args"],
100+
delta=custom_event.value["args"] if isinstance(custom_event.value["args"], str) else json.dumps(
101+
custom_event.value["args"]),
100102
raw_event=event,
101103
)
102104
)

0 commit comments

Comments
 (0)