Skip to main content

bash

Function bash 

Source
pub fn bash() -> FunctionTool
Expand description

Creates the bash tool (bash): mode: "execute" runs command in the calling agent’s session and returns a BashOutput as JSON; mode: "restart" replaces the session.

Each agent has its own session, created on first use with timeout (120 seconds when absent) as its default. A timeout fails with a BashTimeoutError and stops the session; the process exiting fails with a BashSessionError. Either way the next call starts a new process. Sessions end when their agent is dropped and when the tool is dropped.

let agent = strands::Agent::builder().tools([strands::vended_tools::bash::bash()]).printer(false).build()?;
assert!(agent.tool_registry().get("bash").is_some());