Skip to main content

Sandbox Filesystem Tools

All six SDKs expose workspace filesystem tools (LocalSandbox / Sandbox), OS-level process isolation helpers (KernelSandbox / executeKernelProcess), and bounded WASI WebAssembly execution (runWasiModule / run_wasi_module). These primitives have different isolation properties: LocalSandbox / Sandbox canonicalizes file operations relative to a workspace root, whereas kernel isolation refuses command execution unless an OS isolation backend (sandbox-exec or bwrap) is available.

For WASI execution, omitting the profile uses Rust's default profile with required_isolation: "runtime". The SDK adapters pass an explicitly supplied profile through and do not create the default themselves.

from ish import Agent, LocalSandbox, filesystem_tools

sandbox = LocalSandbox(root_dir="./my-repo")
agent = Agent(
name="repository_helper",
model="gpt-4o-mini",
tools=filesystem_tools(root_dir="./my-repo"),
)

Workspace filesystem tools​

Expose root-relative file operations to an agent using filesystem_tools (Python), AgentBuilder::sandbox with LocalSandbox (Rust), or Sandbox.agentTools() (TypeScript, Go, C#, and Java):

The filesystem tool catalog includes read_file, write_file, edit_file, delete, ls, glob, and grep operations. Review the exposed paths and attach a PermissionsManager before running against sensitive directories.

Path confinement is not process isolation

The workspace root limits ISH's filesystem tools; it does not restrict an arbitrary shell command or other code running in your process. Use the kernel isolation helpers for commands that need an OS boundary, and keep permissions and tool exposure scoped to the task.

Kernel-backed process isolation​

Execute commands under OS kernel isolation (KernelSandbox in Python or execute_kernel_process / executeKernelProcess on LocalSandbox / Sandbox):

import asyncio
from ish import KernelSandbox


async def main() -> None:
sandbox = KernelSandbox(
root_dir="./workspace",
network=False,
default_timeout=30.0,
)
output = await sandbox.execute("ls -la")
print(output)


asyncio.run(main())

Availability and enforcement depend on the host operating system. Test on your target deployment host and combine process sandboxing with explicit path rules and authorization checks. See Sandboxes for WASI module execution and capability assessment.

sandbox.eval_expression (eval_code)​

The shared deterministic evaluator is available through each SDK's sandbox helpers. It accepts a code string and returns an output string. The Rust implementation owns parsing, the safe expression subset, and error behavior; this is not an arbitrary-language execution environment.