assistant-ui
assistant-ui copied to clipboard
AI SDK v5 Agent terminates prematurely after using frontendTools
"@assistant-ui/react": "0.11.47",
"@assistant-ui/react-ai-sdk": "^1.1.16",
"@assistant-ui/react-markdown": "^0.11.6",
"@assistant-ui/react-ui": "^0.2.1",
It seems that the result of frontendTools is never passed back into backend agent. And the agent will terminate immediately after using tools defined using frontendTools.
I am facing the same issue both with an agent flow (AI SDK v6) and a simple streamText call. @upwindchange have you been able to find any workaround?
Hi @wh1t3cAt1k , here is my guess according to my observation:
- The team is doing a huge scale rewrite from version 0.11 to 0.12.
- Many things broke during rewrite without being depreciated slowly.
FrontendToolsis just one of them. The human-in-the-loop capability is not working at all since it depends on successfulFrontendToolsusage as well.UseLocalRuntimealso gets broken, I can name many more broken things, literally...
- Currently the best way out is wait for the rewrite to be done and 0.12 to be released, hopefully things will get fixed.
- Another way is to implement everything manually by your self: only use
makeAssistantToolUIto make UI, implement all the communication logic, frontend~backend communication yourself. Do not rely on their implementation of front end tool, avoid using useAssistantTool, makeAssistantTool or human in the loop if you are not confident on the stability of these features.
Hi @wh1t3cAt1k , I resolved the issue using methods mentioned in this issue: #2369