const stream = await agent.streamVNext("Tell me a story", {
format: 'aisdk',
stopWhen: stepCountIs(3), // Stop after 3 steps
modelSettings: {
temperature: 0.7,
},
});
// Use with AI SDK v5 compatible interfaces
for await (const part of stream.fullStream) {
if (part.type === 'text-delta') {
console.log(part.text);
}
}
// In an API route for frontend integration
return stream.toUIMessageStreamResponse();
const stream = await agent.streamVNext("Tell me a story", {
format: 'aisdk',
stopWhen: stepCountIs(3), // Stop after 3 steps
modelSettings: {
temperature: 0.7,
},
});
// Use with AI SDK v5 compatible interfaces
for await (const part of stream.fullStream) {
if (part.type === 'text-delta') {
console.log(part.text);
}
}
// In an API route for frontend integration
return stream.toUIMessageStreamResponse();