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§
Sourcefn subscriptions(&self) -> HookSubscriptions
fn subscriptions(&self) -> HookSubscriptions
Declares which hook points and tool names this handler cares about.
Provided Methods§
Sourcefn before_model_step<'a>(
&'a self,
_context: BeforeModelStepContext,
_cancellation_token: CancellationToken,
) -> HookFuture<'a, BeforeModelDecision>
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.
Sourcefn after_model_step<'a>(
&'a self,
_context: AfterModelStepContext,
_cancellation_token: CancellationToken,
) -> HookFuture<'a, AfterModelDecision>
fn after_model_step<'a>( &'a self, _context: AfterModelStepContext, _cancellation_token: CancellationToken, ) -> HookFuture<'a, AfterModelDecision>
Intercepts execution after a model step finishes.
Sourcefn before_tool_call<'a>(
&'a self,
_context: BeforeToolCallContext,
_cancellation_token: CancellationToken,
) -> HookFuture<'a, BeforeToolDecision>
fn before_tool_call<'a>( &'a self, _context: BeforeToolCallContext, _cancellation_token: CancellationToken, ) -> HookFuture<'a, BeforeToolDecision>
Intercepts a tool call before execution.
Sourcefn after_tool_call<'a>(
&'a self,
_context: AfterToolCallContext,
_cancellation_token: CancellationToken,
) -> HookFuture<'a, AfterToolDecision>
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".