pub trait ToolProgramObservation: Send + Sync {
// Required methods
fn id(&self) -> &str;
fn update(&self, partial: Arc<AgentToolResult>) -> Result<(), String>;
fn prepared<'a>(
&'a self,
arguments: &'a Value,
) -> BoxFuture<'a, Result<(), String>>;
fn finish<'a>(
&'a self,
result: &'a AgentToolResult,
is_error: bool,
cancelled: bool,
) -> BoxFuture<'a, Result<(), String>>;
fn close<'a>(
&'a self,
reason: Option<&'a str>,
) -> BoxFuture<'a, Result<(), String>>;
}Required Methods§
fn id(&self) -> &str
Sourcefn update(&self, partial: Arc<AgentToolResult>) -> Result<(), String>
fn update(&self, partial: Arc<AgentToolResult>) -> Result<(), String>
Nonblocking acceptance of the actual partial, without replay/truncation.
Queue/byte overflow must return an error, never silently drop a payload.
The driver retires admitted callbacks before finish or close starts.
Sourcefn prepared<'a>(
&'a self,
arguments: &'a Value,
) -> BoxFuture<'a, Result<(), String>>
fn prepared<'a>( &'a self, arguments: &'a Value, ) -> BoxFuture<'a, Result<(), String>>
The native harness calls this at its execution barrier, with prepared args.
Sourcefn finish<'a>(
&'a self,
result: &'a AgentToolResult,
is_error: bool,
cancelled: bool,
) -> BoxFuture<'a, Result<(), String>>
fn finish<'a>( &'a self, result: &'a AgentToolResult, is_error: bool, cancelled: bool, ) -> BoxFuture<'a, Result<(), String>>
The known post-hook native result, even if transport encoding later fails.
Sourcefn close<'a>(
&'a self,
reason: Option<&'a str>,
) -> BoxFuture<'a, Result<(), String>>
fn close<'a>( &'a self, reason: Option<&'a str>, ) -> BoxFuture<'a, Result<(), String>>
Explicitly retire the writer and drain/join its work before returning, even when reporting an error. Catching a panic cannot guarantee cleanup; implementations must keep worker ownership panic-safe through shutdown.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".