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
HIL Needs Approval preview

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

External services

google-aiupstash

Ready to use?

View the full interactive pattern with live preview and copy the source code.

View the pattern on desktop

Related patterns