Skip to content

ContextEvent

Defined in: packages/sdk/src/hooks.ts:49

What transformContext receives: the conversation as it stands before the model call.

readonly optional callId?: string

Defined in: packages/sdk/src/hooks.ts:41

The tool call’s id, for the two tool hooks; absent for the others.

HookEventBase.callId


readonly optional lastUsage?: Usage

Defined in: packages/sdk/src/hooks.ts:57

The usage of the last response the run went on with, not a failed turn-retry attempt’s. Absent on the first call.


readonly messages: readonly Message[]

Defined in: packages/sdk/src/hooks.ts:53

The whole conversation so far, never a view an earlier call’s transform returned.


readonly model: ModelRef

Defined in: packages/sdk/src/hooks.ts:55

The model the run was started with.


readonly runId: string

Defined in: packages/sdk/src/hooks.ts:37

The run’s id.

HookEventBase.runId


readonly signal: AbortSignal

Defined in: packages/sdk/src/hooks.ts:43

The run’s abort signal. Pass it on to any I/O the hook does.

HookEventBase.signal


readonly stepIndex: number

Defined in: packages/sdk/src/hooks.ts:39

The index of the model call the hook belongs to, counted from 0.

HookEventBase.stepIndex


readonly system: string

Defined in: packages/sdk/src/hooks.ts:51

The system prompt.


readonly timestamp: string

Defined in: packages/sdk/src/hooks.ts:45

When the hook was called, from the run’s clock, in ISO 8601.

HookEventBase.timestamp

These docs are licensedCC BY 4.0. Thelicence text is in the repository.