HumanInputRequiredException
Defined in: gadgets/exceptions.ts:63
Exception that gadgets can throw to request human input during execution.
When a gadget throws this exception, the agent loop will:
- Pause execution and wait for human input
- If
requestHumanInputcallback is provided, call it and await the answer - Return the user’s answer as the gadget’s result
- Continue the loop with the answer added to conversation history
If no callback is provided, the loop will yield a human_input_required event
and the caller must handle it externally.
Example
Section titled “Example”import { z } from 'zod';
class AskUserGadget extends Gadget({ name: 'AskUser', description: 'Ask the user a question and get their answer', schema: z.object({ question: z.string().min(1, 'Question is required'), }),}) { execute(params: this['params']): string { throw new HumanInputRequiredException(params.question); }}Extends
Section titled “Extends”Error
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new HumanInputRequiredException(
question):HumanInputRequiredException
Defined in: gadgets/exceptions.ts:66
Parameters
Section titled “Parameters”question
Section titled “question”string
Returns
Section titled “Returns”HumanInputRequiredException
Overrides
Section titled “Overrides”Error.constructor
Properties
Section titled “Properties”question
Section titled “question”
readonlyquestion:string
Defined in: gadgets/exceptions.ts:64