Description
MESSAGES_SNAPSHOT contains doubled tool_call arguments when streaming with client-side tools
Description
When using the AG-UI protocol with client-side tool calls, the MESSAGES_SNAPSHOT event contains doubled function.arguments strings for tool calls. Instead of receiving the expected JSON arguments once, the arguments string is duplicated back-to-back.
Example:
Expected tool_calls[0].function.arguments:
{"todoText":"buy groceries"}
Actual tool_calls[0].function.arguments:
{"todoText":"buy groceries"}{"todoText":"buy groceries"}
Reproduction steps
- Configure an agent with a client-side tool (e.g. a simple
add_todo tool)
- Send a request to the
/agui endpoint with a user message that triggers the tool call
- Observe the SSE event stream
- Inspect the
MESSAGES_SNAPSHOT event — assistant messages with tool_calls will have their function.arguments exactly doubled
Minimal request
{
"thread_id": "thread_01",
"run_id": "run_01",
"messages": [
{
"id": "msg_01",
"role": "user",
"content": "Add 'buy groceries' to my todo list"
}
],
"tools": [
{
"type": "function",
"function": {
"name": "add_todo",
"description": "Add a todo item",
"parameters": {
"type": "object",
"properties": {
"todoText": { "type": "string" }
},
"required": ["todoText"]
}
}
}
]
}
Observed behavior in the SSE stream
The TOOL_CALL_DELTA events stream the arguments correctly in chunks. However, the subsequent MESSAGES_SNAPSHOT event contains the full arguments string concatenated with itself.
This causes issues for any client or middleware that relies on MESSAGES_SNAPSHOT for state reconstruction (e.g. thread persistence, late-joining clients, reconnection), since the doubled arguments string is not valid JSON.
Environment
agent-framework-core: 1.0.0b260212
agent-framework-ag-ui: 1.0.0b260212
agent-framework-declarative: 1.0.0b260212
Workaround
We currently sanitize MESSAGES_SNAPSHOT events before consuming them by detecting the exact-doubling pattern (even-length string where both halves are identical and the half is valid JSON) and collapsing it back to a single copy.
Code Sample
Error Messages / Stack Traces
Package Versions
agent-framework-core: 1.0.0b260212, agent-framework-ag-ui: 1.0.0b260212, agent-framework-declarative: 1.0.0b260212
Python Version
No response
Additional Context
No response
Description
MESSAGES_SNAPSHOT contains doubled tool_call arguments when streaming with client-side tools
Description
When using the AG-UI protocol with client-side tool calls, the
MESSAGES_SNAPSHOTevent contains doubledfunction.argumentsstrings for tool calls. Instead of receiving the expected JSON arguments once, the arguments string is duplicated back-to-back.Example:
Expected
tool_calls[0].function.arguments:{"todoText":"buy groceries"}Actual
tool_calls[0].function.arguments:{"todoText":"buy groceries"}{"todoText":"buy groceries"}Reproduction steps
add_todotool)/aguiendpoint with a user message that triggers the tool callMESSAGES_SNAPSHOTevent —assistantmessages withtool_callswill have theirfunction.argumentsexactly doubledMinimal request
{ "thread_id": "thread_01", "run_id": "run_01", "messages": [ { "id": "msg_01", "role": "user", "content": "Add 'buy groceries' to my todo list" } ], "tools": [ { "type": "function", "function": { "name": "add_todo", "description": "Add a todo item", "parameters": { "type": "object", "properties": { "todoText": { "type": "string" } }, "required": ["todoText"] } } } ] }Observed behavior in the SSE stream
The
TOOL_CALL_DELTAevents stream the arguments correctly in chunks. However, the subsequentMESSAGES_SNAPSHOTevent contains the full arguments string concatenated with itself.This causes issues for any client or middleware that relies on
MESSAGES_SNAPSHOTfor state reconstruction (e.g. thread persistence, late-joining clients, reconnection), since the doubled arguments string is not valid JSON.Environment
agent-framework-core: 1.0.0b260212agent-framework-ag-ui: 1.0.0b260212agent-framework-declarative: 1.0.0b260212Workaround
We currently sanitize
MESSAGES_SNAPSHOTevents before consuming them by detecting the exact-doubling pattern (even-length string where both halves are identical and the half is valid JSON) and collapsing it back to a single copy.Code Sample
Error Messages / Stack Traces
Package Versions
agent-framework-core: 1.0.0b260212, agent-framework-ag-ui: 1.0.0b260212, agent-framework-declarative: 1.0.0b260212
Python Version
No response
Additional Context
No response