const agent = new Agent({
name: 'Streaming Agent',
instructions: 'You are helpful.',
model: openai('gpt-4o'),
memory: {
maxTurns: 10,
},
streaming: {
enabled: true,
},
});
const stream = await agent.processStream({
message: 'Tell me a story',
sessionId: 'session_123',
});
for await (const chunk of stream) {
if (!chunk.done) {
process.stdout.write(chunk.text);
}
}