pub struct BashTool { /* private fields */ }Expand description
A single-tool ToolSet exposing bash.
Implementations§
Source§impl BashTool
impl BashTool
pub fn new(name: impl Into<String>) -> Self
pub fn with_timeout(self, d: Duration) -> Self
Sourcepub fn with_env_allowlist<I, S>(self, names: I) -> Self
pub fn with_env_allowlist<I, S>(self, names: I) -> Self
Restrict the subprocess environment to the listed variables. The child starts with no env, then the allowlisted names are copied over from the parent’s env (silently skipped if unset). Recommended for eval / CI / untrusted-LLM work:
ⓘ
let tool = BashTool::default()
.with_env_allowlist(["PATH", "HOME", "USER", "SHELL", "LANG"]);This hides *_API_KEY, AWS_*, ANTHROPIC_*, SSH agent
sockets, and similar secrets from the subprocess. Without
an allowlist the subprocess inherits the full environment.
Trait Implementations§
Source§impl ToolSet for BashTool
impl ToolSet for BashTool
Source§fn execute<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
name: &'life1 str,
input: Value,
ctx: &'life2 ToolContext,
) -> Pin<Box<dyn Future<Output = ToolOutcome> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn execute<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
name: &'life1 str,
input: Value,
ctx: &'life2 ToolContext,
) -> Pin<Box<dyn Future<Output = ToolOutcome> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Execute a tool by name.
name is guaranteed to be one returned from specs()
by the caller; implementations return ToolOutcome::ExecutionError if that
invariant is violated.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