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.
- Python
- TypeScript
- Rust
- Go
- C#
- Java
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"),
)
import { Agent, IshClient, Sandbox } from "ish-harness";
const client = new IshClient();
const sandbox = new Sandbox(client, "./my-repo");
const agent = new Agent({
name: "repository_helper",
model: { provider: "openai_chat", name: "gpt-4o-mini" },
tools: sandbox.agentTools(),
});
use std::{env, sync::Arc};
use ish_harness::{Agent, OpenAIModel};
use ish_harness::sandbox::LocalSandbox;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let sandbox = LocalSandbox::new("./my-repo");
let model = OpenAIModel::new(
"gpt-4o-mini".into(),
"https://api.openai.com/v1".into(),
env::var("OPENAI_API_KEY")?,
0.0,
);
let agent = Agent::builder(Arc::new(model)).sandbox(&sandbox).build()?;
let result = agent.run("List files in the repository.").await?;
println!("{}", result.content);
Ok(())
}
sandbox, err := ish.NewSandbox(client, "./my-repo")
if err != nil {
panic(err)
}
defer sandbox.Close()
tools, err := sandbox.AgentTools()
if err != nil {
panic(err)
}
agent := ish.NewAgent(client, ish.AgentRunRequest{
AgentName: "repository_helper",
Model: &ish.AgentModel{Provider: "openai_chat", Name: "gpt-4o-mini"},
Tools: tools,
})
using Ish.Harness;
using var client = new IshClient();
using var sandbox = new Sandbox(client, "./my-repo");
var result = client.Run(new AgentRunRequest
{
AgentName = "repository_helper",
Model = new AgentModel { Provider = "openai_chat", Name = "gpt-4o-mini" },
UserPrompt = "List files in the repository.",
Tools = sandbox.AgentTools(),
});
import com.fasterxml.jackson.databind.JsonNode;
import io.github.ishharness.IshClient;
import io.github.ishharness.Sandbox;
try (var sandbox = new Sandbox(client, "./my-repo")) {
var request =
new IshClient.AgentRequest("gpt-4o-mini", "Inspect repository files.", "List files.")
.provider("openai_chat")
.agentName("repository_helper");
for (JsonNode tool : sandbox.agentTools()) {
request.operationTool(tool);
}
JsonNode result = client.runAgent(request);
System.out.println(result.path("content").asText());
}
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.
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):
- Python
- TypeScript
- Rust
- Go
- C#
- Java
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())
import { IshClient, Sandbox } from "ish-harness";
const client = new IshClient();
const sandbox = new Sandbox(client, "./workspace");
const proc = sandbox.executeKernelProcess("ls -la", {
timeoutMs: 30_000,
network: false,
});
console.log(proc.stdout);
sandbox.close();
client.close();
use std::time::Duration;
use ish_harness::sandbox::{LocalSandbox, ProcessLimits};
let sandbox = LocalSandbox::new("./workspace");
let limits = ProcessLimits::default();
let exec = sandbox.execute_kernel_process("ls -la", Duration::from_secs(30), limits, false)?;
println!("{}", exec.stdout);
sandbox, err := ish.NewSandbox(client, "./workspace")
if err != nil {
panic(err)
}
defer sandbox.Close()
execRes, err := sandbox.ExecuteKernelProcess("ls -la", 30*time.Second, nil, nil, false, false)
if err != nil {
panic(err)
}
fmt.Println(execRes.Stdout)
using Ish.Harness;
using var client = new IshClient();
using var sandbox = new Sandbox(client, "./workspace");
var exec = sandbox.ExecuteKernelProcess("ls -la", TimeSpan.FromSeconds(30), network: false);
Console.WriteLine(exec.Stdout);
import io.github.ishharness.Sandbox;
try (var sandbox = new Sandbox(client, "./workspace")) {
var exec = sandbox.executeKernelProcess("ls -la", 30_000L, null, null, false);
System.out.println(exec.stdout());
}
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.