pub trait ToolObserver: Send + Sync {
// Required methods
fn on_tool_start(
&self,
tool_name: &str,
input_summary: &str,
) -> Pin<Box<dyn Future<Output = ()> + Send + '_>>;
fn on_tool_complete(
&self,
tool_name: &str,
duration: Duration,
) -> Pin<Box<dyn Future<Output = ()> + Send + '_>>;
fn on_tool_error(
&self,
tool_name: &str,
error: &str,
) -> Pin<Box<dyn Future<Output = ()> + Send + '_>>;
}Expand description
Observer for tool call lifecycle events.
pe-tools calls these methods around each tool execution. pe-runtime
provides a streaming implementation that converts them to StreamEvent.
Injected into NodeContext alongside the stream sender. pe-tools
extracts it from NodeContext::tool_observer().
Required Methods§
Sourcefn on_tool_start(
&self,
tool_name: &str,
input_summary: &str,
) -> Pin<Box<dyn Future<Output = ()> + Send + '_>>
fn on_tool_start( &self, tool_name: &str, input_summary: &str, ) -> Pin<Box<dyn Future<Output = ()> + Send + '_>>
Called before a tool starts executing.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".