You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think I found the core issue that eventually led me to #187
It looks like streaming long tool-input deltas causes lag in useUIMessages / useThreadMessages, while normal text deltas do not trigger the same slowdown.
Here’s a video showing the issue (left = long tool input, right = normal text):
issue4.mp4
Left side:
I give the agent a ~12,000‑character HTML string and ask it to save it to a file via a (mock) writeFile tool.
Since tool calls stream their args, the whole 12k characters are streamed to the tool input.
After a few seconds, the UI begins lagging heavily to low fps
Right side:
I give the exact same 12k characters but simply ask the agent to "repeat this"
Even though the assistant message gets extremely long, there’s no lag at all.
It seems that tool-input deltas are handled differently from normal text deltas, and something about how useUIMessages or useThreadMessages processes the tool‑input stream causes massive slowdown.
But normal assistant deltas of the same size do not cause any slowdown, even when they are equally huge.
If helpful, I can provide the exact reproduction setup used in the video.
It’s just a small mock tool on top of the agent example
I think I found the core issue that eventually led me to #187
It looks like streaming long tool-input deltas causes lag in useUIMessages / useThreadMessages, while normal text deltas do not trigger the same slowdown.
Here’s a video showing the issue (left = long tool input, right = normal text):
issue4.mp4
Left side:
I give the agent a ~12,000‑character HTML string and ask it to save it to a file via a (mock) writeFile tool.
Since tool calls stream their args, the whole 12k characters are streamed to the tool input.
After a few seconds, the UI begins lagging heavily to low fps
Right side:
I give the exact same 12k characters but simply ask the agent to "repeat this"
Even though the assistant message gets extremely long, there’s no lag at all.
It seems that tool-input deltas are handled differently from normal text deltas, and something about how useUIMessages or useThreadMessages processes the tool‑input stream causes massive slowdown.
But normal assistant deltas of the same size do not cause any slowdown, even when they are equally huge.
If helpful, I can provide the exact reproduction setup used in the video.
It’s just a small mock tool on top of the agent example