Question Tool

The ask-user prompt. Takes over the composer card or sits inline as a transcript card.

Kinds

Single choice, multi choice, and free text. Choice prompts include an Other field unless allowCustomAnswer is false. A choice question with layout: 'grid' fills two columns with short, label-only options.

Single choice

Question
Which brand should this agent use?

Multi choice

Question
Which platforms should we monitor?

Free text

Question
What should the agent optimize for?

Two columns

Question
What type of work do you do?

States

A multi-step prompt, the compact prompt, the standalone card used in a transcript, and a completed card. compact replaces the footer with a header pager and a trailing Skip or Next; pass it to promptSlot on a compact composer. Once answered, the card shows a one-line summary. The composer variant has no summary; it stays disabled until the host removes it.

Multi-step

Questions
Which brand should this agent use?
1 of 3

Compact

Which brand should this agent use?
1 of 3

Ask a question…

Card

Question

Which brand should this agent use?

Completed card

Ramp

Usage

QuestionTool is presentational. Product chats own submit, skip, and multi-question navigation, then pass the result in. If a submit handler throws or rejects, the tool shows an error and keeps the answer editable.

QuestionTool Properties

questionsRequired
QuestionConfig[]

Prompt list. Each item is single, multi, or text. See QuestionConfig below.

questionIndex
number

1-based index when the host owns navigation. Omit to let the card step locally.

totalQuestions
number

Progress denominator. Defaults to questions.length.

toolCallId
string

Resets local drafts when the host starts a new tool call.

answer
QuestionAnswer

Completed answer from the host. Marks a single-question prompt done.

variant
'card''composer'

Composer fills the takeover slot. Card is the inline transcript treatment.

Default: card

compact
boolean

Composer only. A header pager and a trailing Skip/Next replace the footer, and choices start unselected.

Default: false

disabled
boolean

Disables the prompt while host-owned work is still pending.

Default: false

chatStatus
string

Host stream status. Disables the card variant while streaming. Ignored for composer.

allowSkip
boolean

Shows the skip action.

Default: true

submitLabel
string

Primary action on the last question.

nextLabel
string

Primary action on earlier questions in a multi-step prompt.

skipLabel
string

Skip action copy.

skippedLabel
string

Summary text for a skipped question on a completed card.

Default: Skipped

onSubmitAnswer
(answer: QuestionAnswer) => void

Called with the last answer, or the only answer on a single prompt. May return a promise.

onSubmitAnswers
(answers: QuestionAnswerMap) => void

Called with every answer, keyed by 1-based index, when the last question in a multi-step prompt is submitted. May return a promise.

onNextQuestion
() => void

Called when the user advances to the next question.

onPreviousQuestion
() => void

Called when the user goes back a question.

renderComposerCounter
(step: number, total: number) => ReactNode

Replaces the composer header's step counter on multi-step prompts.

className
string

Extra classes on the card frame.

choicesClassName
string

Extra classes on the scrollable choices list, e.g. a scroll edge fade.

titlePlacement
'header''step'

Where the composer variant shows the active question's title. `step` keeps it inside the animated step so it crossfades and resizes with the choices.

Default: 'header'

QuestionConfig

kindRequired
'single''multi''text'

Question type

titleRequired
string

Question text

id
string

Stable id for the question

options
QuestionOption[]

Choices for single and multi questions. Each has id, label, and an optional description.

layout
'list''grid'

Grid fills two columns top to bottom with short, label-only options; the Other field spans both. Described options always render as a list.

Default: list

allowCustomAnswer
boolean

Shows the Other field. False submits only offered ids.

Default: true

customLabel
string

Placeholder for the Other field when customPlaceholder is not set

customPlaceholder
string

Placeholder for the Other field

minSelections
number

Fewest picks needed to submit

Default: 1

maxSelections
number

Most picks allowed

ranked
boolean

Multi only. Picks are ranked in order and each badge shows its rank. With maxSelections, the rest lock once that many are picked.

initialSelectedIds
readonly string[]

Ids selected when the question opens. Defaults to the first option; compact questions open empty.

placeholder
string

Placeholder for a text question