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
- Intercept tool calls that require human confirmation before execution
- Resume the agent after approve or deny decisions
- Limit agent loops with stepCountIs during approval flows
- Surface pending tool approvals in a streaming chat UI
Use cases
- Content moderation queues with human sign-off
- E-commerce actions that need cart confirmation
- Admin tools that gate destructive operations
- Customer-support agents requiring human approval
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 desktop






