tool( )





Pattern
HIL Tool Approval Basic
Chat assistant with human approval workflows for safe tool execution.
IntermediateOct 2025View the full pattern on desktop


Problems solved
- Human approval workflows for AI tools
- Safe AI tool execution with oversight
- Interactive chat interface with streaming
- Rate limiting and abuse prevention
- Tool categorization and management
- Real-time approval feedback
- Type-safe tool processing
- Modular component architecture
Use cases
- Content moderation with human oversight
- E-commerce shopping cart approval
- User registration management
- Payment processing workflows
- Weather information services
- Safe AI tool execution patterns
- Human-AI collaboration interfaces
- Approval workflow management
AI SDK APIs
streamTextgatewaystepCountIsconvertToModelMessagestool(tools:
Tags
aihuman-in-the-loopai-sdktool-approvalchat-interfacerate-limitingsafe-aiworkflow-management
Requirements
- Node.js
- 24+
- Memory
- 512MB
- Other
- OpenAI API key
Environment variables
OPENAI_API_KEYGet key
External services
openaiupstash
Ready to use?
View the full interactive pattern with live preview and copy the source code.
View the pattern on desktopRelated patterns


HIL Needs Approval
Demonstrate tool approval with async generators. Includes real-time feedback, approval workflows, and interactive management.
aiagents+8
View 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.
aitools+7
View pattern →
You’ve reached the end of this pattern.



