Skip to main content

ResourceLimits

Defined in the sandbox module.
Rust AI Agent SDK Resource limits for sandbox execution.

Fields

NameTypeDescription
memory_mbu32Maximum memory in megabytes (0 = unlimited)
cpu_percentu32Maximum CPU percentage (0 = unlimited)
timeout_secondsu32Maximum execution time in seconds
max_processesu32Maximum number of processes
max_open_filesu32Maximum number of open files
network_enabledboolWhether network access is allowed
disk_write_mbu32Maximum disk write in megabytes (0 = unlimited)

Methods

new

fn new() -> Self
Create default resource limits.

minimal

fn minimal() -> Self
Create minimal resource limits for untrusted code.

standard

fn standard() -> Self
Create standard resource limits.

generous

fn generous() -> Self
Create generous resource limits for trusted code.

memory_mb

fn memory_mb(mut self, mb: u32) -> Self
Set memory limit. Parameters:
NameType
mbu32

cpu_percent

fn cpu_percent(mut self, percent: u32) -> Self
Set CPU limit. Parameters:
NameType
percentu32

timeout_seconds

fn timeout_seconds(mut self, seconds: u32) -> Self
Set timeout. Parameters:
NameType
secondsu32

max_processes

fn max_processes(mut self, max: u32) -> Self
Set max processes. Parameters:
NameType
maxu32

max_open_files

fn max_open_files(mut self, max: u32) -> Self
Set max open files. Parameters:
NameType
maxu32

network_enabled

fn network_enabled(mut self, enabled: bool) -> Self
Enable/disable network access. Parameters:
NameType
enabledbool

disk_write_mb

fn disk_write_mb(mut self, mb: u32) -> Self
Set disk write limit. Parameters:
NameType
mbu32

Source

View on GitHub

praisonai/src/sandbox/mod.rs at line 57