Skip to content

TimeoutException

Defined in: gadgets/exceptions.ts:102

Exception thrown when a gadget execution exceeds its timeout limit.

When a gadget’s execution time exceeds either:

  • The gadget’s own timeoutMs property, or
  • The global defaultGadgetTimeoutMs configured in runtime/agent loop options

The executor will automatically throw this exception and return it as an error.

import { z } from 'zod';
class SlowApiGadget extends Gadget({
name: 'SlowApi',
description: 'Calls a slow external API',
timeoutMs: 5000, // 5 second timeout
schema: z.object({
endpoint: z.string(),
}),
}) {
async execute(params: this['params']): Promise<string> {
// If this takes longer than 5 seconds, execution will be aborted
const response = await fetch(params.endpoint);
return await response.text();
}
}
  • Error

new TimeoutException(gadgetName, timeoutMs): TimeoutException

Defined in: gadgets/exceptions.ts:106

string

number

TimeoutException

Error.constructor

readonly gadgetName: string

Defined in: gadgets/exceptions.ts:104


readonly timeoutMs: number

Defined in: gadgets/exceptions.ts:103