Skip to main content

ErasedToolExecutor

Trait ErasedToolExecutor 

Source
pub trait ErasedToolExecutor: Send + Sync {
    // Required methods
    fn execute_erased<'a>(
        &'a self,
        response: &'a str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<ToolOutput>, ToolError>> + Send + 'a>>;
    fn execute_confirmed_erased<'a>(
        &'a self,
        response: &'a str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<ToolOutput>, ToolError>> + Send + 'a>>;
    fn tool_definitions_erased(&self) -> Vec<ToolDef>;
    fn execute_tool_call_erased<'a>(
        &'a self,
        call: &'a ToolCall,
    ) -> Pin<Box<dyn Future<Output = Result<Option<ToolOutput>, ToolError>> + Send + 'a>>;
    fn is_tool_retryable_erased(&self, tool_id: &str) -> bool;

    // Provided methods
    fn execute_tool_call_confirmed_erased<'a>(
        &'a self,
        call: &'a ToolCall,
    ) -> Pin<Box<dyn Future<Output = Result<Option<ToolOutput>, ToolError>> + Send + 'a>> { ... }
    fn set_skill_env(&self, _env: Option<HashMap<String, String>>) { ... }
    fn set_effective_trust(&self, _level: TrustLevel) { ... }
}
Expand description

Object-safe erased version of ToolExecutor using boxed futures.

Implemented automatically for all T: ToolExecutor + 'static. Use Box<dyn ErasedToolExecutor> when dynamic dispatch is required.

Required Methods§

Source

fn execute_erased<'a>( &'a self, response: &'a str, ) -> Pin<Box<dyn Future<Output = Result<Option<ToolOutput>, ToolError>> + Send + 'a>>

Source

fn execute_confirmed_erased<'a>( &'a self, response: &'a str, ) -> Pin<Box<dyn Future<Output = Result<Option<ToolOutput>, ToolError>> + Send + 'a>>

Source

fn tool_definitions_erased(&self) -> Vec<ToolDef>

Source

fn execute_tool_call_erased<'a>( &'a self, call: &'a ToolCall, ) -> Pin<Box<dyn Future<Output = Result<Option<ToolOutput>, ToolError>> + Send + 'a>>

Source

fn is_tool_retryable_erased(&self, tool_id: &str) -> bool

Whether the executor can safely retry this tool call on a transient error.

Provided Methods§

Source

fn execute_tool_call_confirmed_erased<'a>( &'a self, call: &'a ToolCall, ) -> Pin<Box<dyn Future<Output = Result<Option<ToolOutput>, ToolError>> + Send + 'a>>

Source

fn set_skill_env(&self, _env: Option<HashMap<String, String>>)

Inject environment variables for the currently active skill. No-op by default.

Source

fn set_effective_trust(&self, _level: TrustLevel)

Set the effective trust level for the currently active skill. No-op by default.

Implementors§