pub struct HookStack { /* private fields */ }Expand description
Ordered composable hook stack.
Model selections chain in registration order: each hook sees the candidate selected by earlier hooks, the last selection wins, and a stop is terminal. Nested stacks preserve the same composition semantics.
Implementations§
Trait Implementations§
Source§impl AgentHook for HookStack
impl AgentHook for HookStack
Source§fn on_model_select(
&self,
ctx: &HookContext,
event: ModelSelection<'_>,
) -> ModelSelectionAction
fn on_model_select( &self, ctx: &HookContext, event: ModelSelection<'_>, ) -> ModelSelectionAction
Selects the model for the pending model-call boundary. Read more
Source§async fn on_completion_call(
&self,
ctx: &HookContext,
event: CompletionCall<'_>,
) -> CompletionCallAction
async fn on_completion_call( &self, ctx: &HookContext, event: CompletionCall<'_>, ) -> CompletionCallAction
Runs before a completion request is sent. Read more
Source§async fn on_completion_response(
&self,
ctx: &HookContext,
event: CompletionResponse<'_>,
) -> ObservationAction
async fn on_completion_response( &self, ctx: &HookContext, event: CompletionResponse<'_>, ) -> ObservationAction
Observes a completed model response. Read more
Source§async fn on_model_turn_finished(
&self,
ctx: &HookContext,
event: ModelTurnFinished<'_>,
) -> ModelTurnAction
async fn on_model_turn_finished( &self, ctx: &HookContext, event: ModelTurnFinished<'_>, ) -> ModelTurnAction
Observes or rejects the content produced at the end of a model turn. Read more
Source§async fn on_text_delta(
&self,
ctx: &HookContext,
event: TextDelta<'_>,
) -> ObservationAction
async fn on_text_delta( &self, ctx: &HookContext, event: TextDelta<'_>, ) -> ObservationAction
Observes a text delta from a streaming response. Read more
Source§async fn on_reasoning_delta(
&self,
ctx: &HookContext,
event: ReasoningDelta<'_>,
) -> ObservationAction
async fn on_reasoning_delta( &self, ctx: &HookContext, event: ReasoningDelta<'_>, ) -> ObservationAction
Observes a reasoning delta from a streaming response. Read more
Source§async fn on_tool_call_delta(
&self,
ctx: &HookContext,
event: ToolCallDelta<'_>,
) -> ObservationAction
async fn on_tool_call_delta( &self, ctx: &HookContext, event: ToolCallDelta<'_>, ) -> ObservationAction
Observes an argument delta for a streaming tool call. Read more
Source§async fn on_stream_response_finish(
&self,
ctx: &HookContext,
event: StreamResponseFinish<'_>,
) -> ObservationAction
async fn on_stream_response_finish( &self, ctx: &HookContext, event: StreamResponseFinish<'_>, ) -> ObservationAction
Observes a completed streaming response in canonical Rig form. Read more
Source§async fn on_invalid_tool_call(
&self,
ctx: &HookContext,
event: &InvalidToolCallContext,
) -> Option<InvalidToolCallAction>
async fn on_invalid_tool_call( &self, ctx: &HookContext, event: &InvalidToolCallContext, ) -> Option<InvalidToolCallAction>
Resolves a model-emitted tool call that cannot be dispatched as written. Read more
Source§async fn on_tool_call(
&self,
ctx: &HookContext,
event: ToolCall<'_>,
) -> ToolCallAction
async fn on_tool_call( &self, ctx: &HookContext, event: ToolCall<'_>, ) -> ToolCallAction
Runs before a valid tool call is executed. Read more
Source§async fn on_tool_result(
&self,
ctx: &HookContext,
event: ToolResultEvent<'_>,
) -> ToolResultAction
async fn on_tool_result( &self, ctx: &HookContext, event: ToolResultEvent<'_>, ) -> ToolResultAction
Runs after a tool call resolves and before its presentation is sent to the model. Read more
Source§fn observes(&self, kind: StepEventKind) -> bool
fn observes(&self, kind: StepEventKind) -> bool
Observation interest hint, primarily for high-frequency deltas.
Auto Trait Implementations§
impl !RefUnwindSafe for HookStack
impl !UnwindSafe for HookStack
impl Freeze for HookStack
impl Send for HookStack
impl Sync for HookStack
impl Unpin for HookStack
impl UnsafeUnpin for HookStack
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more