Skip to content

HookOrder

const HookOrder: {
SDK_FIRST: -100;
INTERVENTION_OUTPUT: -90;
DEFAULT: 0;
INTERVENTION_INPUT: 90;
SDK_LAST: 100;
};

Defined in: src/hooks/types.ts:48

Presets for hook execution order. Lower values run first. Any number is a valid order — these presets are not bounds, just convenient reference points. SDK_FIRST/SDK_LAST mark where the SDK’s own hooks run, so you can position yours relative to them.

NameTypeDefault valueDefined in
SDK_FIRST-100-100src/hooks/types.ts:49
INTERVENTION_OUTPUT-90-90src/hooks/types.ts:50
DEFAULT00src/hooks/types.ts:51
INTERVENTION_INPUT9090src/hooks/types.ts:52
SDK_LAST100100src/hooks/types.ts:53
agent.addHook(BeforeToolCallEvent, callback, { order: HookOrder.SDK_FIRST }) // run with the SDK's earliest hooks
agent.addHook(BeforeToolCallEvent, callback, { order: HookOrder.SDK_FIRST - 1 }) // run before the SDK's earliest hooks