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.
Type Declaration
Section titled “Type Declaration”| Name | Type | Default value | Defined in |
|---|---|---|---|
SDK_FIRST | -100 | -100 | src/hooks/types.ts:49 |
INTERVENTION_OUTPUT | -90 | -90 | src/hooks/types.ts:50 |
DEFAULT | 0 | 0 | src/hooks/types.ts:51 |
INTERVENTION_INPUT | 90 | 90 | src/hooks/types.ts:52 |
SDK_LAST | 100 | 100 | src/hooks/types.ts:53 |
Example
Section titled “Example”agent.addHook(BeforeToolCallEvent, callback, { order: HookOrder.SDK_FIRST }) // run with the SDK's earliest hooksagent.addHook(BeforeToolCallEvent, callback, { order: HookOrder.SDK_FIRST - 1 }) // run before the SDK's earliest hooks