tool( )

Pattern

Tool Input Lifecycle Hooks

Explore tool input lifecycle hooks: onInputStart, onInputDelta, and onInputAvailable. See how to track tool input generation in real-time during streaming.

BeginnerNov 2025View the full pattern on desktop
Tool Input Lifecycle Hooks preview

Problems solved

  • Observe tool input generation with onInputStart
  • Stream partial tool arguments via onInputDelta
  • React when full tool input becomes available with onInputAvailable

Use cases

  • Debugging streaming tool argument construction
  • UI spinners tied to tool input lifecycle events
  • Teaching AI SDK tool input hooks
  • Monitoring long tool-argument generation

AI SDK APIs

streamTextconvertToModelMessagestool(useChatonInputStartonInputDeltaonInputAvailable

Tags

aitoolslifecycle-hooksonInputStartonInputDeltaonInputAvailablestreamingai-sdktool-api

Requirements

Node.js
24+
Memory
512MB
Other
  • OpenAI API key

Environment variables

External services

openai

Ready to use?

View the full interactive pattern with live preview and copy the source code.

View the pattern on desktop

Related patterns