Skip to main content

Human-in-the-loop

Some tool calls are questions for a person. InteractiveToolCard renders them and holds the agent's turn until the person answers. One component covers three shapes, chosen from the tool call's input and the rendering mode.

The demos below pause where the card appears. Answer the card to let the run continue.

Approval​

The agent stops for a yes or no before a destructive action.

Loading the live demo…

Form​

When the tool call's input carries fields, the card renders a form from them and returns the values as the tool result.

Loading the live demo…

Inline question​

With rendering="minimal" and fewer than two required fields, the card collapses to a single question answered inline in the transcript.

Loading the live demo…

InteractiveToolCard props​

PropTypeNotes
toolCallToolCallRequired. Its input decides the shape: a question, or a list of fields.
stateToolCallStateRequired. The card shows the answer once the call is completed.
rendering'rich' | 'minimal'Required. Card, or inline question.
onComplete(result: ToolResult) => voidRequired. Send the person's answer back to the agent.

Wire it in through toolRenderers on <Chat> or ChatMessageList, keyed by tool name, as in the first snippet above.