Skip to main content

ToolExecutor

Trait ToolExecutor 

Source
pub trait ToolExecutor: Send + Sync {
    // Required methods
    fn execute<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        tools: &'life1 HashMap<String, Arc<dyn Tool>>,
        calls: &'life2 [ToolCall],
        base_ctx: &'life3 ToolCallContext,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<ToolExecutionResult>, ToolExecutorError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn name(&self) -> &'static str;

    // Provided method
    fn requires_incremental_state(&self) -> bool { ... }
}
Expand description

Strategy abstraction for tool execution.

Required Methods§

Source

fn execute<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, tools: &'life1 HashMap<String, Arc<dyn Tool>>, calls: &'life2 [ToolCall], base_ctx: &'life3 ToolCallContext, ) -> Pin<Box<dyn Future<Output = Result<Vec<ToolExecutionResult>, ToolExecutorError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Execute tool calls and return results.

Source

fn name(&self) -> &'static str

Strategy name for logging.

Provided Methods§

Source

fn requires_incremental_state(&self) -> bool

Whether the executor needs state refreshed between individual tool calls. Sequential executors return true; parallel executors return false.

Implementors§