HIL Inquire Multiple Choice
HIL Inquire Multiple Choice
Gather information through AI-driven multiple choice questions. Includes approval workflows and real-time rendering.
Loading preview…
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
Setup
Requirements, wiring steps, and what this pattern adds to your project.
Getting started
Pick how you want to pull this pattern in — then wire env vars and routes the same way.
- 1
Install from the preview toolbar

Copy the install command above and run it in your project — Pro patterns include a short-lived token.
- 2
Add environment variables to .env.local
OPENAI_API_KEY
- 3
Point client fetches at your API routes
Replace preview `/view/.../api/...` paths with `/api/...` in the installed files.
- 4
Customize the agent and tool files
Adapt prompts, tools, and stop conditions for your product — Copy for AI in the toolbar helps seed that work.
- 5
Run your dev server and open the pattern route
Install dependencies if needed, then start the app and verify responses.
Environment variables
OPENAI_API_KEYGet key
Capabilities
AI SDK APIs
AgenttoolstepCountIsvalidateUIMessagesuseChatInferAgentUIMessageProviders
External services
Files added
7 filesapp/page.tsxapp/layout.tsxapp/api/inquire-multiple-choice/route.tslib/ai/multiple-choice-inquire-agent.tslib/ai/tools/ask-multiple-choice-tool.tslib/tool-approval-types.tsREADME.md
Dependencies
13 totalnpm packages
6
Registry components
Critical files
ai/multiple-choice-inquire-agent.tsAgent implementation using ToolLoopAgent with hasToolCall stop condition. Contains processMultipleChoiceToolCalls for handling user answers and respondWithProcessing for the message pipeline.
tools/ask-multiple-choice-tool.tsTool that dynamically generates multiple-choice questions using generateObject with a structured schema. Core tool for the inquire pattern.
Requirements
- Complexity
- Intermediate
- Setup time
- ~15 minutes
- Node
- 24+
- Memory
- 512MB









