Observers
Defined in: agent/hooks.ts:304
Observers: Read-only hooks for side effects.
- Cannot modify data
- Errors are logged but don’t crash the system
- Run in parallel (no ordering guarantees)
Properties
Section titled “Properties”onAbort()?
Section titled “onAbort()?”
optionalonAbort: (context) =>void|Promise<void>
Defined in: agent/hooks.ts:333
Called when the agent loop is terminated by an abort signal
Parameters
Section titled “Parameters”context
Section titled “context”ObserveAbortContext
Returns
Section titled “Returns”void | Promise<void>
onCompaction()?
Section titled “onCompaction()?”
optionalonCompaction: (context) =>void|Promise<void>
Defined in: agent/hooks.ts:330
Called when context compaction occurs
Parameters
Section titled “Parameters”context
Section titled “context”Returns
Section titled “Returns”void | Promise<void>
onGadgetExecutionComplete()?
Section titled “onGadgetExecutionComplete()?”
optionalonGadgetExecutionComplete: (context) =>void|Promise<void>
Defined in: agent/hooks.ts:321
Called when a gadget execution completes (success or error)
Parameters
Section titled “Parameters”context
Section titled “context”Returns
Section titled “Returns”void | Promise<void>
onGadgetExecutionStart()?
Section titled “onGadgetExecutionStart()?”
optionalonGadgetExecutionStart: (context) =>void|Promise<void>
Defined in: agent/hooks.ts:318
Called when a gadget execution starts
Parameters
Section titled “Parameters”context
Section titled “context”Returns
Section titled “Returns”void | Promise<void>
onGadgetSkipped()?
Section titled “onGadgetSkipped()?”
optionalonGadgetSkipped: (context) =>void|Promise<void>
Defined in: agent/hooks.ts:324
Called when a gadget is skipped due to a failed dependency
Parameters
Section titled “Parameters”context
Section titled “context”ObserveGadgetSkippedContext
Returns
Section titled “Returns”void | Promise<void>
onLLMCallComplete()?
Section titled “onLLMCallComplete()?”
optionalonLLMCallComplete: (context) =>void|Promise<void>
Defined in: agent/hooks.ts:312
Called when an LLM call completes successfully
Parameters
Section titled “Parameters”context
Section titled “context”Returns
Section titled “Returns”void | Promise<void>
onLLMCallError()?
Section titled “onLLMCallError()?”
optionalonLLMCallError: (context) =>void|Promise<void>
Defined in: agent/hooks.ts:315
Called when an LLM call fails
Parameters
Section titled “Parameters”context
Section titled “context”Returns
Section titled “Returns”void | Promise<void>
onLLMCallReady()?
Section titled “onLLMCallReady()?”
optionalonLLMCallReady: (context) =>void|Promise<void>
Defined in: agent/hooks.ts:309
Called when an LLM call is ready (after controller modifications, before API call)
Parameters
Section titled “Parameters”context
Section titled “context”ObserveLLMCallReadyContext
Returns
Section titled “Returns”void | Promise<void>
onLLMCallStart()?
Section titled “onLLMCallStart()?”
optionalonLLMCallStart: (context) =>void|Promise<void>
Defined in: agent/hooks.ts:306
Called when an LLM call starts (before controller modifications)
Parameters
Section titled “Parameters”context
Section titled “context”Returns
Section titled “Returns”void | Promise<void>
onStreamChunk()?
Section titled “onStreamChunk()?”
optionalonStreamChunk: (context) =>void|Promise<void>
Defined in: agent/hooks.ts:327
Called for each stream chunk
Parameters
Section titled “Parameters”context
Section titled “context”Returns
Section titled “Returns”void | Promise<void>