Confirmations & Plans





Pattern
Tool Approval
Demonstrate tool execution with user confirmation. Includes approval workflows, confirmation UI, and state management for safe AI operations.
BeginnerOct 2025View the full pattern on desktop


Problems solved
- Require user confirmation before a needsApproval tool runs
- Demonstrate the AI SDK built-in approval mechanism for delete_file
- Keep pending approval state visible in the chat UI
Use cases
- File-deletion confirmations in assistants
- Destructive admin actions gated by the user
- Teaching needsApproval tool flows
- Safe tool execution demos
AI SDK APIs
streamTextconvertToModelMessagesuseChataddToolApprovalResponse
Tags
aitool-approvalconfirmationai-sdkopenaihuman-in-the-loopsafe-aiworkflow
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 the pattern on desktopRelated patterns


Plan
A collapsible plan component for displaying AI-generated execution plans with streaming support and shimmer animations.
aiplan+4
View pattern β


Chat-Base Clone
A comprehensive Chatbase clone demo with widget interface, model selection, web search integration, and human-in-the-loop tool approval workflows.
aichat+8
View pattern β



