Pattern
BEG·Nov 25
Preliminary Tool Results
Return preliminary tool results using async iterables. Stream status updates during tool execution before the final result is available.
View Full Pattern on Desktop

Problems Solved
- Stream preliminary tool results during execution
- Provide status updates before final result
- Use async iterables for progressive tool results
- Display intermediate states during tool execution
Use Cases
- Streaming tool execution status
- Progressive tool result updates
- Long-running tool operations
- Understanding async generator tool patterns
AI SDK APIs
streamTextconvertToModelMessagestool(useChatasync-generator
Tags
aitoolspreliminary-resultsasync-iterablesgenerator-functionsstreamingai-sdktool-api
Requirements
- Node.js
- 24+
- Memory
- 512MB
- Other
- OpenAI API key
Environment Variables
OPENAI_API_KEYGet key →
External Services
openai
Ready to use?
View the full interactive pattern with live preview and copy the source code.
View Pattern on DesktopRelated Patterns


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.
aitools+7
View →


Tool API Context
Pass arbitrary context from generateText/streamText to tool execution via experimental_context. Access context in tool execute functions for dynamic behavior.
aitools+5
View →
End of Pattern



