-
Notifications
You must be signed in to change notification settings - Fork 752
@ag-ui/[email protected]
still calls streamVNext
, but Mastra client only exposes stream
#486
Copy link
Copy link
Open
Description
Summary
@ag-ui/[email protected]
continues to invoke agent.streamVNext(...)
, but the current Mastra client (@mastra/[email protected]
) renamed the method to stream
. As a result, CopilotKit requests fail with:
Error: streamVNext has been renamed to stream. Please use stream instead.
at Observable._trySubscribe (../../../src/internal/Observable.ts:244:19)
...
This issue has been reported at #384 (comment).
Environment
@ag-ui/mastra
: 0.1.1@mastra/client-js
: 0.15.1@copilotkit/runtime
: 1.10.5- Next.js 15.5.4 / React 19.1.0
Steps to Reproduce
- Install the packages above in a Next.js app.
- Use
MastraAgent.getRemoteAgents({ mastraClient })
as in the CopilotKit guide. - Start the app and send a chat request (
POST /copilotkit
). - Check the server logs.
Expected Behavior
MastraAgent
should call the new agent.stream(...)
(or fall back appropriately) so streaming works with the latest Mastra client.
Actual Behavior
MastraAgent.streamMastraAgent
invokes this.agent.streamVNext(...)
, which throws the error above and prevents responses from streaming.
Workaround
Monkey-patch the returned agents:
Object.values(mastraAgents).forEach((wrapper: any) => {
if (typeof wrapper?.stream === "function") {
wrapper.streamVNext = wrapper.stream.bind(wrapper);
}
const inner = wrapper.agent ?? wrapper._agent;
if (inner && typeof inner.stream === "function") {
inner.streamVNext = inner.stream.bind(inner);
}
});
Additional Context
PR #384 ( Oh, missunderstoodfeat: support mastra vNext streaming
) already replaces the streamVNext
call. Could you publish that change (e.g., in 0.1.2) so the workaround is no longer required?
Metadata
Metadata
Assignees
Labels
No labels