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§
Sourcefn point(&self) -> AgentHookPoint
fn point(&self) -> AgentHookPoint
Which hook point this hook subscribes to.
Sourcefn 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,
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.