pub struct SandboxPolicy {
pub network: NetworkPolicy,
pub filesystem: FilesystemPolicy,
pub environment: EnvironmentPolicy,
pub timeout: Duration,
pub max_stdout_bytes: usize,
pub max_stderr_bytes: usize,
pub working_directory: Option<PathBuf>,
}Expand description
Sandbox policy describing the requested execution constraints.
Backends compare this policy against their BackendCapabilities and
reject execution if they cannot enforce a requested control.
§Example
use adk_code::SandboxPolicy;
let policy = SandboxPolicy::strict_rust();
assert_eq!(policy.max_stdout_bytes, 1_048_576);Fields§
§network: NetworkPolicyNetwork access policy.
filesystem: FilesystemPolicyFilesystem access policy.
environment: EnvironmentPolicyEnvironment variable access policy.
timeout: DurationMaximum execution duration.
max_stdout_bytes: usizeMaximum bytes captured from stdout before truncation.
max_stderr_bytes: usizeMaximum bytes captured from stderr before truncation.
working_directory: Option<PathBuf>Working directory for execution, if any.
Implementations§
Source§impl SandboxPolicy
impl SandboxPolicy
Sourcepub fn strict_rust() -> Self
pub fn strict_rust() -> Self
Strict policy for Rust sandbox execution.
- No network access
- No filesystem access
- No environment variables
- 30-second timeout
- 1 MB stdout/stderr limits
Sourcepub fn host_local() -> Self
pub fn host_local() -> Self
Host-local policy for backends that run on the host without isolation.
Unlike strict_rust, this policy uses
NetworkPolicy::Enabled and FilesystemPolicy::None so that
host-local backends (which cannot enforce network or filesystem
restrictions) pass policy validation. The trade-off is that the
executed code has the same network and filesystem access as the
host process.
- Network access: allowed (host-local cannot restrict)
- Filesystem access: none requested
- Environment variables: none exposed
- 30-second timeout
- 1 MB stdout/stderr limits
Trait Implementations§
Source§impl Clone for SandboxPolicy
impl Clone for SandboxPolicy
Source§fn clone(&self) -> SandboxPolicy
fn clone(&self) -> SandboxPolicy
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more