chatRoute + useChat not working for tool suspension in @mastra/ai-sdk@beta
When using
chatRoute with @ai-sdk useChat hook, tool suspension events
(tool-call-suspended) are not emitted, causing the frontend to
never receive them.
This makes HITL (Human-in-the-Loop) flows impossible with the
chatRoute + useChat combination.
I'm using the same example of conditional approvals by calling the suspend function within the tool execution.
It works in the playground-ui but it doesn't work with ai-sdk.
Reference: https://mastra.ai/blog/tool-approval#conditional-approvals
chatRoute Stream Output
POST /api/agents/.../stream Stream Output
HITL: Ask Before Acting
Learn how to use HITL (Human-in-the-Loop) to safely build tools that require human approval.
1 Reply
š Created GitHub issue: https://github.com/mastra-ai/mastra/issues/10173
š If you're experiencing an error, please provide a minimal reproducible example to help us resolve it quickly.
š Thank you @Boragorn for helping us improve Mastra!