tool( )





Pattern
HIL Needs Approval
Demonstrate tool approval with async generators. Includes real-time feedback, approval workflows, and interactive management.
IntermediateOct 2025View the full pattern on desktop


Problems solved
- Pause Experimental_Agent tool calls until the user approves
- Handle approval denial gracefully in agent instructions
- Visualize pending and completed tool execution states
- Stream approval UI updates during the agent loop
Use cases
- Sensitive tool actions that need sign-off
- Admin agents gating writes and deletes
- Customer-support agents requiring human approval
- Educational demos of needsApproval agent flows
AI SDK APIs
new Agenttool(stepCountIsExperimental_Agenttools:gatewayUIToolInvocation
Tags
aiagentstool-approvalasync-generatorapproval-patternsai-sdk-v5streamingreal-time-feedbacktool-executionworkflow-management
Requirements
- Node.js
- 24+
- Memory
- 512MB
- Other
- Google AI API key
Environment variables
GOOGLE_AI_API_KEYGet key
External services
google-aiupstash
Ready to use?
View the full interactive pattern with live preview and copy the source code.
View the pattern on desktopRelated patterns


HIL Tool Approval Basic
Chat assistant with human approval workflows for safe tool execution.
aihuman-in-the-loop+6
View pattern β


Multi-Step Tool Pattern
Execute multi-step workflows with typed tools. Includes streaming, tool chaining, and decision-making for automated tasks.
aiagents+8
View pattern β



