pub struct BashTool {
pub cwd: Option<String>,
pub timeout: Duration,
pub max_output_bytes: usize,
pub deny_patterns: Vec<String>,
pub confirm_fn: Option<ConfirmFn>,
}Expand description
Execute shell commands. Captures stdout + stderr.
Fields§
§cwd: Option<String>Working directory for commands (None = inherit from current process)
timeout: DurationMax execution time per command (default: 120s)
max_output_bytes: usizeMax output bytes to capture (prevents OOM on huge outputs, default: 256KB)
deny_patterns: Vec<String>Commands/patterns that are always blocked (e.g., “rm -rf /”)
confirm_fn: Option<ConfirmFn>Optional callback for confirming dangerous commands (None = auto-allow)
Implementations§
Source§impl BashTool
impl BashTool
pub fn new() -> Self
pub fn with_cwd(self, cwd: impl Into<String>) -> Self
pub fn with_timeout(self, timeout: Duration) -> Self
pub fn with_deny_patterns(self, patterns: Vec<String>) -> Self
pub fn with_confirm( self, f: impl Fn(&str) -> bool + Send + Sync + 'static, ) -> Self
Trait Implementations§
Source§impl AgentTool for BashTool
impl AgentTool for BashTool
Source§fn description(&self) -> &str
fn description(&self) -> &str
Description for the LLM
Source§fn parameters_schema(&self) -> Value
fn parameters_schema(&self) -> Value
JSON Schema for parameters
Auto Trait Implementations§
impl Freeze for BashTool
impl !RefUnwindSafe for BashTool
impl Send for BashTool
impl Sync for BashTool
impl Unpin for BashTool
impl UnsafeUnpin for BashTool
impl !UnwindSafe for BashTool
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