🏖️ SandAgent

Sandbox Configuration

Local and cloud sandbox options for SandAgent

SandAgent runs Coding Agents inside sandboxes — isolated environments with their own filesystem. You choose between local execution and cloud sandboxes depending on your use case.

Local Sandbox

Built-in, no extra packages. The agent runs directly on your machine's filesystem.

import { createSandAgent, LocalSandbox } from "@sandagent/sdk";

const sandbox = new LocalSandbox({
  workdir: "/path/to/project",
  templatesPath: "./my-agent-template",
  env: { ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY! },
});

const sandagent = createSandAgent({ sandbox, cwd: sandbox.getWorkdir() });

Best for: Electron/Tauri desktop apps, local development, debugging.

OptionDescription
workdirWorking directory for the agent
templatesPathPath to agent template directory (copied into workdir)
runnerCommandCustom runner command (defaults to built-in)
envEnvironment variables passed to the agent

Sandock provides Docker-based cloud sandboxes with persistent volumes and fast startup.

Why Sandock? Coding Agents (Claude Code, Codex CLI, etc.) rely heavily on filesystem append operations and other POSIX semantics during execution. Sandock is currently the only cloud sandbox provider that offers 100% POSIX-compatible filesystems, ensuring Coding Agents run without filesystem-related failures. Additionally, Sandock volumes are persistent and shareable — multiple sandboxes can mount the same named volume, enabling cross-session and cross-sandbox data reuse.

Install

npm install @sandagent/sandbox-sandock

Get an API Key

  1. Go to sandock.ai
  2. Sign up and create an API key
  3. Set SANDOCK_API_KEY in your environment

Usage

import { createSandAgent } from "@sandagent/sdk";
import { SandockSandbox } from "@sandagent/sandbox-sandock";

const sandbox = new SandockSandbox({
  apiKey: process.env.SANDOCK_API_KEY,
  image: "vikadata/sandagent:0.1.0",  // Pre-built image (fast startup)
  skipBootstrap: true,
  workdir: "/workspace",
  env: { ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY! },
});

const sandagent = createSandAgent({ sandbox, cwd: sandbox.getWorkdir() });

Persistent Volumes

Volumes persist across sandbox restarts and can be shared across multiple sandboxes. This means different agent sessions can access the same workspace data, and Claude's session history (stored in /root/.claude) survives sandbox recreation.

const sandbox = new SandockSandbox({
  apiKey: process.env.SANDOCK_API_KEY,
  image: "vikadata/sandagent:0.1.0",
  skipBootstrap: true,
  workdir: "/workspace",
  volumes: [
    { volumeName: "my-workspace", volumeMountPath: "/workspace" },
    { volumeName: "my-claude-session", volumeMountPath: "/root/.claude" },
  ],
  env: { ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY! },
});

Options

OptionDefaultDescription
apiKeySANDOCK_API_KEY envSandock API key
baseUrlhttps://sandock.aiSandock API endpoint
imagesandockai/sandock-code:latestDocker image. Use vikadata/sandagent:0.1.0 for pre-built
skipBootstrapfalsetrue when using pre-built image (skips npm install inside sandbox)
workdir/workspaceWorking directory inside sandbox
volumes[]Named volumes for persistent storage
keeptrueKeep sandbox alive ~30 min after execution
memoryLimitMbMemory limit in MB
cpuSharesCPU shares
timeout300000Command timeout in ms (5 min)
templatesPathLocal template directory to upload into sandbox
nameSandbox name for identification

Bootstrap Modes

Pre-built image (skipBootstrap: true): Uses sandagent run from the image. Fastest startup.

new SandockSandbox({
  image: "vikadata/sandagent:0.1.0",
  skipBootstrap: true,
});

Dynamic install (skipBootstrap: false): Installs @sandagent/runner-cli@latest via npm inside the sandbox. More flexible, slower startup.

new SandockSandbox({
  image: "sandockai/sandock-code:latest",
  skipBootstrap: false,
});

E2B

E2B provides cloud sandboxes optimized for AI agents.

npm install @sandagent/sandbox-e2b
import { E2BSandbox } from "@sandagent/sandbox-e2b";

const sandbox = new E2BSandbox({
  apiKey: process.env.E2B_API_KEY,
});

Daytona

Daytona provides enterprise workspace environments.

npm install @sandagent/sandbox-daytona
import { DaytonaSandbox } from "@sandagent/sandbox-daytona";

const sandbox = new DaytonaSandbox({
  apiKey: process.env.DAYTONA_API_KEY,
});

Comparison

ProviderBest ForPOSIX FSPre-built ImagesNetwork LimitsVolume Reuse Across SandboxesVolume Public Access
LocalSandboxDesktop apps, debugging✅ (native)N/ANoneN/AN/A
SandockCloud production✅ Full POSIXNone
E2BCloud productionNone
DaytonaCloud productionTier 1 & 2
SandockCloud production✅ Full POSIX✅ Cross-sandbox
E2BCloud production⚠️ Partial
DaytonaEnterprise workspaces⚠️ Partial

af04389 (Update documentation)

On this page