Documentation Index Fetch the complete documentation index at: https://docs.praison.ai/llms.txt
Use this file to discover all available pages before exploring further.
SandboxProtocol
Defined in the sandbox module.
Rust AI Agent SDK
Protocol for sandbox implementations. Sandboxes provide isolated environments for safe code execution. Implementations can use Docker, subprocess isolation, or other containerization technologies.
Methods
is_available
fn is_available ( & self ) -> bool
Whether the sandbox backend is available.
sandbox_type
fn sandbox_type ( & self ) -> & str
Type of sandbox (docker, subprocess, etc.).
start
async fn start ( &mut self ) -> Result <()>
Start/initialize the sandbox environment.
stop
async fn stop ( &mut self ) -> Result <()>
Stop/cleanup the sandbox environment.
execute
async fn execute (
& self ,
code : & str ,
language : & str ,
limits : Option < ResourceLimits >,
env : Option < HashMap < String , String >>,
working_dir : Option < String >,
) -> Result < SandboxResult >
Execute code in the sandbox.
Parameters:
Name Type code&strlanguage&strlimitsOption<ResourceLimits>envOption<HashMap<Stringworking_dirOption<String>
execute_file
async fn execute_file (
& self ,
file_path : & str ,
args : Option < Vec < String >>,
limits : Option < ResourceLimits >,
env : Option < HashMap < String , String >>,
) -> Result < SandboxResult >
Execute a file in the sandbox.
Parameters:
Name Type file_path&strargsOption<Vec<String>>limitsOption<ResourceLimits>envOption<HashMap<String
run_command
async fn run_command (
& self ,
command : & str ,
limits : Option < ResourceLimits >,
env : Option < HashMap < String , String >>,
working_dir : Option < String >,
) -> Result < SandboxResult >
Run a shell command in the sandbox.
Parameters:
Name Type command&strlimitsOption<ResourceLimits>envOption<HashMap<Stringworking_dirOption<String>
write_file
async fn write_file ( & self , path : & str , content : & [ u8 ]) -> Result < bool >
Write a file to the sandbox.
Parameters:
Name Type path&strcontent&[u8]
read_file
async fn read_file ( & self , path : & str ) -> Result < Option < Vec < u8 >>>
Read a file from the sandbox.
Parameters:
list_files
async fn list_files ( & self , path : & str ) -> Result < Vec < String >>
List files in a sandbox directory.
Parameters:
get_status
fn get_status ( & self ) -> SandboxStatusInfo
Get sandbox status information.
cleanup
async fn cleanup ( &mut self ) -> Result <()>
Clean up sandbox resources.
reset
async fn reset ( &mut self ) -> Result <()>
Reset sandbox to initial state.
Source
View on GitHub praisonai/src/sandbox/mod.rs at line 0