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
HIL Inquire Text Input preview

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

External services

openaiupstash

Ready to use?

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

View the pattern on desktop

Related patterns