pub struct SandboxPolicy {
pub agent_id: String,
pub sandbox_type: SandboxType,
pub network: NetworkPolicy,
pub filesystem: FilesystemPolicy,
pub process: ProcessPolicy,
pub env: EnvPolicy,
pub allowed_tools: Vec<String>,
pub denied_tools: Vec<String>,
pub audit_logging: bool,
}Expand description
Per-agent sandbox policy.
Created from an agent’s configuration and enforced at runtime by the
sandbox enforcement layer. Each agent’s tool restrictions map to a
SandboxPolicy.
Fields§
§agent_id: StringAgent or plugin identifier.
sandbox_type: SandboxTypeSandbox isolation type.
network: NetworkPolicyNetwork access policy.
filesystem: FilesystemPolicyFilesystem access policy.
process: ProcessPolicyProcess execution policy.
env: EnvPolicyEnvironment variable access policy.
allowed_tools: Vec<String>Tools this agent is allowed to use (empty = all tools allowed).
denied_tools: Vec<String>Tools explicitly denied to this agent.
audit_logging: boolWhether audit logging is enabled for this agent.
Implementations§
Source§impl SandboxPolicy
impl SandboxPolicy
Sourcepub fn new(agent_id: impl Into<String>) -> Self
pub fn new(agent_id: impl Into<String>) -> Self
Create a new sandbox policy for the given agent.
Sourcepub fn is_tool_allowed(&self, tool_name: &str) -> bool
pub fn is_tool_allowed(&self, tool_name: &str) -> bool
Check whether a specific tool is allowed by this policy.
Sourcepub fn is_domain_allowed(&self, domain: &str) -> bool
pub fn is_domain_allowed(&self, domain: &str) -> bool
Check whether a domain is allowed by the network policy.
Sourcepub fn is_path_readable(&self, path: &Path) -> bool
pub fn is_path_readable(&self, path: &Path) -> bool
Check whether a file path is readable.
Sourcepub fn is_path_writable(&self, path: &Path) -> bool
pub fn is_path_writable(&self, path: &Path) -> bool
Check whether a file path is writable.
Sourcepub fn is_command_allowed(&self, command: &str) -> bool
pub fn is_command_allowed(&self, command: &str) -> bool
Check whether a command is allowed by the process policy.
Sourcepub fn effective_tools(&self) -> HashSet<String>
pub fn effective_tools(&self) -> HashSet<String>
Collect the set of all effective tool names that are allowed.
Sourcepub fn effective_sandbox_type(&self) -> SandboxType
pub fn effective_sandbox_type(&self) -> SandboxType
Return the platform-appropriate sandbox type.
On macOS, downgrades OsSandbox and Combined to Wasm with a
warning, since seccomp/landlock are Linux-only.
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