Skip to content

AfterInvocationEvent

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

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:184

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

AfterInvocationEvent

HookableEvent.constructor

readonly type: "afterInvocationEvent";

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


readonly agent: LocalAgent;

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


readonly invocationState: InvocationState;

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


resume: InvokeArgs = undefined;

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

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:199

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

Pick<AfterInvocationEvent, "type">