Skip to main content

RuntimeHookHandler

Trait RuntimeHookHandler 

Source
pub trait RuntimeHookHandler: Send + Sync {
    // Required method
    fn subscriptions(&self) -> HookSubscriptions;

    // Provided methods
    fn before_model_step<'a>(
        &'a self,
        _context: BeforeModelStepContext,
        _cancellation_token: CancellationToken,
    ) -> HookFuture<'a, BeforeModelDecision> { ... }
    fn after_model_step<'a>(
        &'a self,
        _context: AfterModelStepContext,
        _cancellation_token: CancellationToken,
    ) -> HookFuture<'a, AfterModelDecision> { ... }
    fn before_tool_call<'a>(
        &'a self,
        _context: BeforeToolCallContext,
        _cancellation_token: CancellationToken,
    ) -> HookFuture<'a, BeforeToolDecision> { ... }
    fn after_tool_call<'a>(
        &'a self,
        _context: AfterToolCallContext,
        _cancellation_token: CancellationToken,
    ) -> HookFuture<'a, AfterToolDecision> { ... }
}
Expand description

Object-safe async hook handler evaluated in-process by the Rust runtime.

Required Methods§

Source

fn subscriptions(&self) -> HookSubscriptions

Declares which hook points and tool names this handler cares about.

Provided Methods§

Source

fn before_model_step<'a>( &'a self, _context: BeforeModelStepContext, _cancellation_token: CancellationToken, ) -> HookFuture<'a, BeforeModelDecision>

Intercepts execution before a model step is compiled and sent.

Source

fn after_model_step<'a>( &'a self, _context: AfterModelStepContext, _cancellation_token: CancellationToken, ) -> HookFuture<'a, AfterModelDecision>

Intercepts execution after a model step finishes.

Source

fn before_tool_call<'a>( &'a self, _context: BeforeToolCallContext, _cancellation_token: CancellationToken, ) -> HookFuture<'a, BeforeToolDecision>

Intercepts a tool call before execution.

Source

fn after_tool_call<'a>( &'a self, _context: AfterToolCallContext, _cancellation_token: CancellationToken, ) -> HookFuture<'a, AfterToolDecision>

Intercepts a tool call after execution, before durable commit.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§