streamText
The most commonly used streaming text generation API in the AI SDK. Tool calls are validated and executed within its request-response lifecycle, allowing generated text and tool invocations to be handled together. It returns a streaming result that can be consumed incrementally by client applications.
Core Facts
Timeline (last 90 days)
The AI SDK uses a layered design: the core layer (the ai package) provides unified interfaces such as streamText and generateText, and each model vendor integrates through a separate provider package.
Projects using Valibot can use @ai-sdk/valibot to perform type-safe validation of tool parameters in calls such as generateText and streamText.
@ai-sdk/tool-web-fetch is a standard tool that can be mounted directly into the tools parameter of streamText or generateText without additional adaptation.
In generateText, streamText, and WorkflowAgent, the SDK rejects tool calls directly before local execution, even if the model returned a tool call intent.
The aligned behaviors include: default values, transforms, type coercion, refinement validation, unknown key handling, custom validators, repairToolCall, and various lifecycle callbacks.
Commit 6ac1ee1 makes WorkflowAgent use the original tool schema to validate and normalize tool input, thereby staying consistent with streamText behavior.
streamText is a commonly used streaming text generation API in the AI SDK, and tool calls complete validation and execution within its synchronous request-response lifecycle.
In the AI SDK, developers use unified core functions such as generateText, streamText and generateObject, and which provider's model is actually called is determined by the provider instance
Updates to internal utility packages such as workflow-harness are imperceptible to most developers using the upper-level API and do not change the way generateText, streamText, or Agent workflows are called.
Vercel AI SDK wraps tool calling into a unified generateText/streamText API, where developers only need to declare the tool's JSON Schema without manually managing the finish_reason: tool_calls state machine.
1 more timeline events
All Facts (11)
Vercel AI SDK provides unified abstract interfaces (such as generateText and streamText), allowing developers to maintain a consistent coding style when calling different model providers.
90%UnverifiedThe AI SDK uses a layered design: the core layer (the ai package) provides unified interfaces such as streamText and generateText, and each model vendor integrates through a separate provider package.
70%UnverifiedProjects using Valibot can use @ai-sdk/valibot to perform type-safe validation of tool parameters in calls such as generateText and streamText.
50%Unverified@ai-sdk/tool-web-fetch is a standard tool that can be mounted directly into the tools parameter of streamText or generateText without additional adaptation.
50%UnverifiedIn generateText, streamText, and WorkflowAgent, the SDK rejects tool calls directly before local execution, even if the model returned a tool call intent.
50%UnverifiedThe aligned behaviors include: default values, transforms, type coercion, refinement validation, unknown key handling, custom validators, repairToolCall, and various lifecycle callbacks.
50%UnverifiedCommit 6ac1ee1 makes WorkflowAgent use the original tool schema to validate and normalize tool input, thereby staying consistent with streamText behavior.
50%UnverifiedstreamText is a commonly used streaming text generation API in the AI SDK, and tool calls complete validation and execution within its synchronous request-response lifecycle.
50%UnverifiedIn the AI SDK, developers use unified core functions such as generateText, streamText and generateObject, and which provider's model is actually called is determined by the provider instance
50%UnverifiedUpdates to internal utility packages such as workflow-harness are imperceptible to most developers using the upper-level API and do not change the way generateText, streamText, or Agent workflows are called.
50%UnverifiedVercel AI SDK wraps tool calling into a unified generateText/streamText API, where developers only need to declare the tool's JSON Schema without manually managing the finish_reason: tool_calls state machine.
50%