Skip to main content

ToolExecutor

Trait ToolExecutor 

Source
pub trait ToolExecutor {
    // Required methods
    fn add(
        &mut self,
        name: String,
        tool: Box<dyn Tool + Sync>,
    ) -> Option<Box<dyn Tool + Sync>>;
    fn execute<'life0, 'async_trait>(
        &'life0 self,
        calls: Vec<ToolCall>,
    ) -> Pin<Box<dyn Future<Output = Vec<ToolResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Executes tool calls with different strategies (parallel, sequential, etc.)

Required Methods§

Source

fn add( &mut self, name: String, tool: Box<dyn Tool + Sync>, ) -> Option<Box<dyn Tool + Sync>>

Adds a tool to the executor. Returns the previous tool with the same name if it exists.

Source

fn execute<'life0, 'async_trait>( &'life0 self, calls: Vec<ToolCall>, ) -> Pin<Box<dyn Future<Output = Vec<ToolResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Executes the given tool calls and returns the results with timing metadata.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§