Skip to content

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)

optional onAbort: (context) => void | Promise<void>

Defined in: agent/hooks.ts:333

Called when the agent loop is terminated by an abort signal

ObserveAbortContext

void | Promise<void>


optional onCompaction: (context) => void | Promise<void>

Defined in: agent/hooks.ts:330

Called when context compaction occurs

ObserveCompactionContext

void | Promise<void>


optional onGadgetExecutionComplete: (context) => void | Promise<void>

Defined in: agent/hooks.ts:321

Called when a gadget execution completes (success or error)

ObserveGadgetCompleteContext

void | Promise<void>


optional onGadgetExecutionStart: (context) => void | Promise<void>

Defined in: agent/hooks.ts:318

Called when a gadget execution starts

ObserveGadgetStartContext

void | Promise<void>


optional onGadgetSkipped: (context) => void | Promise<void>

Defined in: agent/hooks.ts:324

Called when a gadget is skipped due to a failed dependency

ObserveGadgetSkippedContext

void | Promise<void>


optional onLLMCallComplete: (context) => void | Promise<void>

Defined in: agent/hooks.ts:312

Called when an LLM call completes successfully

ObserveLLMCompleteContext

void | Promise<void>


optional onLLMCallError: (context) => void | Promise<void>

Defined in: agent/hooks.ts:315

Called when an LLM call fails

ObserveLLMErrorContext

void | Promise<void>


optional onLLMCallReady: (context) => void | Promise<void>

Defined in: agent/hooks.ts:309

Called when an LLM call is ready (after controller modifications, before API call)

ObserveLLMCallReadyContext

void | Promise<void>


optional onLLMCallStart: (context) => void | Promise<void>

Defined in: agent/hooks.ts:306

Called when an LLM call starts (before controller modifications)

ObserveLLMCallContext

void | Promise<void>


optional onStreamChunk: (context) => void | Promise<void>

Defined in: agent/hooks.ts:327

Called for each stream chunk

ObserveChunkContext

void | Promise<void>