Skip to main content

HookExecutor

Trait HookExecutor 

Source
pub trait HookExecutor:
    Send
    + Sync
    + Debug {
    // Required method
    fn fire<'life0, 'life1, 'async_trait>(
        &'life0 self,
        event: &'life1 HookEvent,
    ) -> Pin<Box<dyn Future<Output = HookResult> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided methods
    fn record_agent_event<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        _event: &'life1 AgentEvent,
        _run_id: &'life2 str,
        _session_id: &'life3 str,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait { ... }
    fn record_run_cancelled<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        _run_id: &'life1 str,
        _session_id: &'life2 str,
        _reason: Option<&'life3 str>,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait { ... }
}
Expand description

Hook executor trait

Abstracts hook execution, allowing different implementations (e.g., full engine, no-op, test mocks) while keeping agent logic clean.

Required Methods§

Source

fn fire<'life0, 'life1, 'async_trait>( &'life0 self, event: &'life1 HookEvent, ) -> Pin<Box<dyn Future<Output = HookResult> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Fire a hook event and get the result

Provided Methods§

Source

fn record_agent_event<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, _event: &'life1 AgentEvent, _run_id: &'life2 str, _session_id: &'life3 str, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Observe a product/runtime event emitted by the agent loop.

Hook executors that only supervise lifecycle hooks can ignore this. AHP uses it to publish durable run/task/verification contract events.

Source

fn record_run_cancelled<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, _run_id: &'life1 str, _session_id: &'life2 str, _reason: Option<&'life3 str>, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Observe explicit run cancellation when cancellation happens outside the agent loop’s normal event stream.

Implementors§