Function: streamText()
streamText(
opts):StreamTextResult
Defined in: packages/agentos/src/api/streamText.ts:140
Stateless streaming text generation with optional multi-step tool calling.
Returns a StreamTextResult immediately; the underlying provider call
begins lazily when a consumer starts iterating textStream or fullStream.
Awaiting text, usage, or toolCalls will also drain the stream.
Parameters
opts
Generation options (same shape as generateText).
Returns
A StreamTextResult with async iterables and awaitable promises.
Example
const { textStream } = streamText({ model: 'openai:gpt-4o', prompt: 'Tell me a joke.' });
for await (const chunk of textStream) {
process.stdout.write(chunk);
}