Human-in-the-Loop





Pattern
HIL Inquire Text Input
Gather detailed information through AI-driven text input questions. Includes approval workflows and real-time rendering.
IntermediateOct 2025View the full pattern on desktop


Problems solved
- Pause the agent to collect free-text answers mid-loop
- Resume ToolLoopAgent after open-ended user input
- Gather detailed brand or requirements context through questions
- Stop on askTextInput with hasToolCall and process responses
Use cases
- Discovery interviews in chat
- Requirements gathering agents
- Customer onboarding with open-ended prompts
- User research intake workflows
AI SDK APIs
new Agenttool(stepCountIsvalidateUIMessagesuseChatInferAgentUIMessagegenerateObject
Tags
aihuman-in-the-looptext-inputinteractive-questionsapproval-workflowsai-sdkbrand-contextstrategic-questioningtool-approvalstreamingopen-ended-questions
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 Multiple Choice
Gather information through AI-driven multiple choice questions. Includes approval workflows and real-time rendering.
aihuman-in-the-loop+8
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 β



