Sandbox Voice

@tuttiai/sandbox — secure code execution with per-session filesystem isolation for TypeScript, Python, and Bash

The Sandbox voice gives agents secure code execution with per-session filesystem isolation, supporting TypeScript, Python 3, and Bash.

Installation

npx tutti-ai add sandbox

Requires tsx (for TypeScript) and python3 (for Python) on the host.

Required permissions

permissions: ["shell"]

Configuration

new SandboxVoice({
  allowed_languages: ["typescript", "python"],
  allowed_packages: ["lodash", "zod", "chalk"],
  timeout_ms: 15_000,
  max_file_size_bytes: 512_000,
})
OptionDefaultDescription
allowed_languagesall threeRestrict execute_code to specific runtimes.
allowed_packagesallAllowlist for install_package.
timeout_ms30_000Default execution timeout.
max_file_size_bytes1_048_576 (1 MB)Max file size for write_file.
envExtra env vars passed to child processes.
install_timeout_ms60_000Timeout for package installs.

Tool reference

ToolDestructiveDescription
execute_codeyesExecute a snippet in typescript / python / bash. Returns stdout, stderr, exit code.
write_fileyesWrite a file to the per-session sandbox dir.
read_filenoRead a previously written file from the sandbox dir.
install_packageyesInstall a package from the configured allowlist (npm or pip).

execute_code

InputTypeDefaultDescription
codestringSource code to execute
language"typescript" | "python" | "bash"Runtime
timeout_msnumber30_000Wall-clock timeout (max 120 000)

Example

import { defineScore, AnthropicProvider } from "@tuttiai/core";
import { SandboxVoice } from "@tuttiai/sandbox";

export default defineScore({
  provider: new AnthropicProvider(),
  agents: {
    coder: {
      name: "coder",
      model: "claude-sonnet-4-20250514",
      system_prompt:
        "You are a coding assistant. Write code to solve problems, execute it to verify, and iterate until correct. You can write files, install packages, and run code in the sandbox.",
      voices: [
        new SandboxVoice({
          allowed_languages: ["typescript", "python"],
          allowed_packages: ["lodash", "zod", "chalk"],
          timeout_ms: 15_000,
          max_file_size_bytes: 512_000,
        }),
      ],
      permissions: ["shell"],
    },
  },
});

Run it:

tutti-ai run coder "Write a TS function that computes the first N Fibonacci numbers, test it, and show me the output for N=15."

Edit this page on GitHub →