Skip to content

TaskCompletionSignal

Defined in: gadgets/exceptions.ts:27

Signal that a gadget throws to indicate task completion and agent termination.

When a gadget throws this signal, the agent loop will:

  1. Complete the current iteration
  2. Return the signal message as the gadget’s result
  3. Exit the loop instead of continuing to the next iteration
import { z } from 'zod';
class FinishGadget extends Gadget({
name: 'Finish',
description: 'Signals task completion',
schema: z.object({
message: z.string().optional(),
}),
}) {
execute(params: this['params']): string {
const message = params.message || 'Task completed';
throw new TaskCompletionSignal(message);
}
}
  • Error

new TaskCompletionSignal(message?): TaskCompletionSignal

Defined in: gadgets/exceptions.ts:28

string

TaskCompletionSignal

Error.constructor