Skip to main content

AgentHook

Trait AgentHook 

Source
pub trait AgentHook: Send + Sync {
    // Required methods
    fn point(&self) -> AgentHookPoint;
    fn run<'life0, 'life1, 'async_trait>(
        &'life0 self,
        point: AgentHookPoint,
        session: &'life1 Session,
    ) -> Pin<Box<dyn Future<Output = HookResult> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;

    // Provided methods
    fn priority(&self) -> u32 { ... }
    fn name(&self) -> &str { ... }
}
Expand description

Trait for agent lifecycle hooks.

Implementations must be Send + Sync because hooks may be invoked from multiple concurrent agent runs.

Required Methods§

Source

fn point(&self) -> AgentHookPoint

Which hook point this hook subscribes to.

Source

fn run<'life0, 'life1, 'async_trait>( &'life0 self, point: AgentHookPoint, session: &'life1 Session, ) -> Pin<Box<dyn Future<Output = HookResult> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Execute the hook.

Receives immutable access to the session and the current hook point. Returns a HookResult to control flow.

Provided Methods§

Source

fn priority(&self) -> u32

Optional priority (lower runs first). Default is 100.

Source

fn name(&self) -> &str

Optional name for logging and debugging.

Implementors§