Human-in-the-Loop





Pattern
HIL Inquire Multiple Choice
Gather information through AI-driven multiple choice questions. Includes approval workflows and real-time rendering.
IntermediateOct 2025View the full pattern on desktop


Problems solved
- Pause the agent to ask structured multiple-choice questions
- Resume ToolLoopAgent after the user selects an answer
- Collect brand or preference context through guided choices
- Stop the loop on the inquire tool with hasToolCall
Use cases
- Brand intake questionnaires
- Onboarding surveys inside an agent
- Preference gathering for recommendations
- Customer research chats with constrained answers
AI SDK APIs
new Agenttool(stepCountIsvalidateUIMessagesuseChatInferAgentUIMessage
Tags
aihuman-in-the-loopmultiple-choiceinteractive-questionsapproval-workflowsai-sdkbrand-contextstrategic-questioningtool-approvalstreaming
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 Inquire Text Input
Gather detailed information through AI-driven text input questions. Includes approval workflows and real-time rendering.
aihuman-in-the-loop+9
View pattern β


Human in the Loop Plan Builder Agent
Uses ToolLoopAgent pattern to gather requirements and generate plans. Generates markdown plans with structured todo lists.
aihuman-in-the-loop+9
View pattern β



