Skip to main content

make_shell

Function make_shell 

Source
pub fn make_shell(options: MakeShellOptions) -> Result<FunctionTool>
Expand description

Creates a sandbox shell tool: it runs command with the sandbox’s execute and returns a ShellOutput as JSON.

A non-zero exit code is a result; a timeout fails with a ShellTimeoutError that carries the partial output, cancellation of the call stops the command and fails with the sandbox’s SandboxAbortError with the partial output appended to its message as JSON with exit code 130, and any other sandbox failure with a ShellExecutionError.

use strands::vended_tools::shell::{MakeShellOptions, make_shell};

let shell = make_shell(MakeShellOptions::builder().default_timeout(30.0).build())?;
let agent = strands::Agent::builder().tools([shell]).printer(false).build()?;
assert!(agent.tool_registry().get("shell").is_some());

§Errors

When default_timeout is not a positive finite number.