Skip to main content

ToolProgramObservation

Trait ToolProgramObservation 

Source
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§

Source

fn id(&self) -> &str

Source

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.

Source

fn prepared<'a>( &'a self, arguments: &'a Value, ) -> BoxFuture<'a, Result<(), String>>

The native harness calls this at its execution barrier, with prepared args.

Source

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.

Source

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".

Implementors§