Skip to content

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:

  1. Pause execution and wait for human input
  2. If requestHumanInput callback is provided, call it and await the answer
  3. Return the user’s answer as the gadget’s result
  4. 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.

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);
}
}
  • Error

new HumanInputRequiredException(question): HumanInputRequiredException

Defined in: gadgets/exceptions.ts:66

string

HumanInputRequiredException

Error.constructor

readonly question: string

Defined in: gadgets/exceptions.ts:64