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:
- Complete the current iteration
- Return the signal message as the gadget’s result
- Exit the loop instead of continuing to the next iteration
Example
Section titled “Example”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); }}Extends
Section titled “Extends”Error
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new TaskCompletionSignal(
message?):TaskCompletionSignal
Defined in: gadgets/exceptions.ts:28
Parameters
Section titled “Parameters”message?
Section titled “message?”string
Returns
Section titled “Returns”TaskCompletionSignal
Overrides
Section titled “Overrides”Error.constructor