Sandbox

July 31, 2026 · View on GitHub

The agent gets bash, readFile, and writeFile in an isolated just-bash workspace. That is not your host shell. Kit guardrails block destructive commands, secret dumps, and hosts you did not allow.

Command list (optional curl, js-exec, python3, …): just-bash supported commands.

Happy path

createTenantHome opens the tenant volume and wires sandbox tools into every session. You do not call createTenantBashToolkit yourself.

import { createTenantHome } from "@socialrobot-io/agent-kit-node";
import { defineCommand } from "@socialrobot-io/agent-kit-sandbox";
import { agent } from "./generated/agent";

const hello = defineCommand("hello", async (args) => ({
  stdout: `Hello, ${args[0] || "world"}!\n`,
  stderr: "",
  exitCode: 0,
}));

const home = await createTenantHome({
  tenantId, // from your auth layer
  agent,
  workspaceFiles: { "README.md": "# workspace\n" },
  sandbox: {
    allowedHosts: ["api.example.com"], // hostnames only; enables curl (GET/HEAD)
    secrets: [process.env.TENANT_API_KEY!],
    javascript: true, // js-exec (QuickJS). Or python: true for python3
    customCommands: [hello], // optional host-defined bash commands
  },
});

const session = await home.openSession(sessionId);
OptionMeaning
sandbox: true or omitSandbox on (default). /workspace persists on the tenant volume.
sandbox: falseNo shell tools.
allowedHostsHostnames only. Registers curl for those hosts (GET/HEAD). Off = no curl.
secretsRedacted from dumps / tool output. Do not put secrets in prompts.
javascripttrue or { bootstrap }js-exec. Node only. Off by default.
pythontruepython3 / python. Node only. Off by default.
customCommandsHost commands from defineCommand. Runs in your process; treat as trusted.
workspaceFilesSeed files under /workspace when the home is created.

With runtimes on, the agent can run for example:

js-exec -c "console.log(1 + 2)"
python3 -c "print(1 + 2)"
curl -s https://api.example.com/health
hello Alice

Demo: examples/example-app at /code-runner (javascript: true).

For product APIs (CRM, billing), prefer a host SessionTool via addTools (Tools), not a custom bash command.

What is blocked

CategoryExamples
Destructiverm -rf /, fork bombs, writing block devices
Credential theftcurl … $SECRET, cat .env, reading SSH keys
Bad networkHost not in allowedHosts

Blocked commands return an error to the model; they do not run. Bash, reads, and writes are audited per tenant.

Next