AfterInvocationEvent
Defined in: src/hooks/events.ts:191
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.
Extends
Section titled “Extends”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new AfterInvocationEvent(data): AfterInvocationEvent;Defined in: src/hooks/events.ts:208
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
data | { agent: LocalAgent; invocationState: InvocationState; } & HookableEventData |
Returns
Section titled “Returns”AfterInvocationEvent
Overrides
Section titled “Overrides”Properties
Section titled “Properties”invocationContext?
Section titled “invocationContext?”readonly invocationContext?: InvocationContext;Defined in: src/hooks/events.ts:100
The request this event belongs to (undefined outside one); pass it to InvokeOptions.invocationContext to join it.
Inherited from
Section titled “Inherited from”HookableEvent.invocationContext
readonly type: "afterInvocationEvent";Defined in: src/hooks/events.ts:192
readonly agent: LocalAgent;Defined in: src/hooks/events.ts:193
invocationState
Section titled “invocationState”readonly invocationState: InvocationState;Defined in: src/hooks/events.ts:194
resume
Section titled “resume”resume: InvokeArgs = undefined;Defined in: src/hooks/events.ts:206
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 or one of the request’s limits is reached, since a resumed run would stop again at once.
If multiple callbacks set resume, the last callback to run wins.
Methods
Section titled “Methods”toJSON()
Section titled “toJSON()”toJSON(): Pick<AfterInvocationEvent, "type">;Defined in: src/hooks/events.ts:223
Serializes for wire transport, excluding the agent reference, invocationState, and mutable resume field. Called automatically by JSON.stringify().
Returns
Section titled “Returns”Pick<AfterInvocationEvent, "type">