Skip to content

AfterInvocationEvent

Defined in: src/hooks/events.ts:171

Event triggered at the end of an agent request. Fired after all processing completes, regardless of success or error. Uses reverse callback ordering for proper cleanup semantics.

new AfterInvocationEvent(data): AfterInvocationEvent;

Defined in: src/hooks/events.ts:187

ParameterType
data{ agent: LocalAgent; invocationState: InvocationState; }
data.agentLocalAgent
data.invocationStateInvocationState

AfterInvocationEvent

HookableEvent.constructor

readonly type: "afterInvocationEvent";

Defined in: src/hooks/events.ts:172


readonly agent: LocalAgent;

Defined in: src/hooks/events.ts:173


readonly invocationState: InvocationState;

Defined in: src/hooks/events.ts:174


resume: InvokeArgs = undefined;

Defined in: src/hooks/events.ts:185

Set by hook callbacks to trigger a follow-up agent invocation with new input. When set, after this event’s callbacks complete the agent re-enters its loop with these args as new input, under the same invocation lock. A fresh BeforeInvocationEvent/AfterInvocationEvent pair fires for the resumed run. Ignored if the invocation ended with an error.

If multiple callbacks set resume, the last callback to run wins.

toJSON(): Pick<AfterInvocationEvent, "type">;

Defined in: src/hooks/events.ts:202

Serializes for wire transport, excluding the agent reference, invocationState, and mutable resume field. Called automatically by JSON.stringify().

Pick<AfterInvocationEvent, "type">