pub struct ToolExecutor { /* private fields */ }Expand description
Tool executor with workspace sandboxing
This is the main entry point for tool execution. It wraps the ToolRegistry and provides backward-compatible API. Includes file version history tracking for write/edit/patch operations.
Defense-in-depth: An optional permission policy can be set to block denied tools even if the caller bypasses the agent loop’s authorization.
Implementations§
Source§impl ToolExecutor
impl ToolExecutor
pub fn new(workspace: String) -> Self
pub fn set_guard_policy(&mut self, policy: Arc<dyn PermissionChecker>)
pub fn workspace(&self) -> &PathBuf
pub fn registry(&self) -> &Arc<ToolRegistry>
pub fn register_dynamic_tool(&self, tool: Arc<dyn Tool>)
pub fn unregister_dynamic_tool(&self, name: &str)
pub fn file_history(&self) -> &Arc<FileHistory>
pub async fn execute(&self, name: &str, args: &Value) -> Result<ToolResult>
pub async fn execute_with_context( &self, name: &str, args: &Value, ctx: &ToolContext, ) -> Result<ToolResult>
pub fn definitions(&self) -> Vec<ToolDefinition>
Auto Trait Implementations§
impl Freeze for ToolExecutor
impl !RefUnwindSafe for ToolExecutor
impl Send for ToolExecutor
impl Sync for ToolExecutor
impl Unpin for ToolExecutor
impl UnsafeUnpin for ToolExecutor
impl !UnwindSafe for ToolExecutor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more