Skip to main content

Hook

Trait Hook 

Source
pub trait Hook: Send + Sync {
    // Required method
    fn on_event(&self, event: HookEvent<'_>) -> HookAction;
}
Expand description

A lifecycle hook that can observe and influence agent behaviour.

Required Methods§

Source

fn on_event(&self, event: HookEvent<'_>) -> HookAction

Called when a lifecycle event occurs.

Return HookAction::Continue to proceed normally. Return HookAction::Skip or HookAction::Error from a PreToolCall event to prevent tool execution. For all other event types, Skip and Error are treated as Continue.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§