Explore tool input lifecycle hooks: onInputStart, onInputDelta, and onInputAvailable. See how to track tool input generation in real-time during streaming.
Use this when you want UI state, like a spinner or progress label, to react to tool input starting, streaming, and becoming fully available.
Similar patterns, and when each one is the better fit.

Multi-Step Tool PatternUse this when a chat agent must call several typed tools in a row, feeding each result into the next step, with a step limit to stop runaway loops.
Tool ApprovalUse this when a destructive action, such as deleting a file, needs an in-chat confirm or deny step built only on the AI SDK's own approval flow.
Tool API ContextUse this when you call generateText or streamText directly and want one tool definition to adapt to each user's preferences or session settings.
Loop Control: stopWhenUse this when you are tuning at which step an agent loop halts and want to see each step on a timeline as your stop rules trigger.Requirements, wiring steps, and what this pattern adds to your project.
Pick how you want to pull this pattern in. Then wire env vars and routes the same way.
Download → Next.js app
Use Download → Next.js app in the preview toolbar. You get a zip scaffold (Pro downloads rewrite preview `/view/.../api/*` paths to `/api/*` automatically).
Extract the zip and install dependencies
Unzip the archive, then run `pnpm install` (or npm / yarn) in the project folder.
Fill .env.local
The download includes .env.local placeholders when needed. Add real values for: OPENAI_API_KEY.
Customize the agent and tool files
Adapt prompts, tools, and stop conditions in the generated project for your product.
Run the app and open the pattern route
Run `pnpm dev`, open the setup/checklist page if present, then navigate to the generated pattern route and verify responses.
OPENAI_API_KEYGet keyAI SDK APIs
streamTextconvertToModelMessagestooluseChatonInputStartonInputDeltaonInputAvailableProviders
app/page.tsxapp/layout.tsxapp/api/tool-input-lifecycle/route.tscomponents/input-lifecycle-demo.tsxtools/weather.tstools/weather-ui.tsxnpm packages
7
Registry components
tools/weather.tsWeather tool demonstrating all three tool input lifecycle hooks: onInputStart, onInputDelta, and onInputAvailable. Core pattern for monitoring tool input generation.
Explore tool input lifecycle hooks: onInputStart, onInputDelta, and onInputAvailable. See how to track tool input generation in real-time during streaming.
Use this when you want UI state, like a spinner or progress label, to react to tool input starting, streaming, and becoming fully available.
Similar patterns, and when each one is the better fit.

Multi-Step Tool PatternUse this when a chat agent must call several typed tools in a row, feeding each result into the next step, with a step limit to stop runaway loops.
Tool ApprovalUse this when a destructive action, such as deleting a file, needs an in-chat confirm or deny step built only on the AI SDK's own approval flow.
Tool API ContextUse this when you call generateText or streamText directly and want one tool definition to adapt to each user's preferences or session settings.
Loop Control: stopWhenUse this when you are tuning at which step an agent loop halts and want to see each step on a timeline as your stop rules trigger.Requirements, wiring steps, and what this pattern adds to your project.
Pick how you want to pull this pattern in. Then wire env vars and routes the same way.
Download → Next.js app
Use Download → Next.js app in the preview toolbar. You get a zip scaffold (Pro downloads rewrite preview `/view/.../api/*` paths to `/api/*` automatically).
Extract the zip and install dependencies
Unzip the archive, then run `pnpm install` (or npm / yarn) in the project folder.
Fill .env.local
The download includes .env.local placeholders when needed. Add real values for: OPENAI_API_KEY.
Customize the agent and tool files
Adapt prompts, tools, and stop conditions in the generated project for your product.
Run the app and open the pattern route
Run `pnpm dev`, open the setup/checklist page if present, then navigate to the generated pattern route and verify responses.
OPENAI_API_KEYGet keyAI SDK APIs
streamTextconvertToModelMessagestooluseChatonInputStartonInputDeltaonInputAvailableProviders
app/page.tsxapp/layout.tsxapp/api/tool-input-lifecycle/route.tscomponents/input-lifecycle-demo.tsxtools/weather.tstools/weather-ui.tsxnpm packages
7
Registry components
tools/weather.tsWeather tool demonstrating all three tool input lifecycle hooks: onInputStart, onInputDelta, and onInputAvailable. Core pattern for monitoring tool input generation.
Loading preview…
Early-bird pricing — limited time


Open on desktop for the interactive preview.
Explore tool input lifecycle hooks: onInputStart, onInputDelta, and onInputAvailable. See how to track tool input generation in real-time during streaming.
Loading preview…
Early-bird pricing — limited time


Open on desktop for the interactive preview.
Explore tool input lifecycle hooks: onInputStart, onInputDelta, and onInputAvailable. See how to track tool input generation in real-time during streaming.