Skip to main content

Container-based sandbox executor for RoomKit — gives AI agents sandboxed command execution via RTK

Project description

roomkit-sandbox

Container-based sandbox executor for RoomKit — gives AI agents sandboxed command execution via RTK.

What it does

roomkit-sandbox provides a ready-made SandboxExecutor implementation that runs commands inside lightweight containers or VMs. Any AI agent (Anthropic, OpenAI, Ollama, vLLM) connected to RoomKit gets access to:

Tool Description
sandbox_read Read file contents with line ranges
sandbox_write Write content to a file
sandbox_edit Replace a string in a file
sandbox_ls List directory contents
sandbox_grep Search file contents (regex)
sandbox_find Find files by pattern
sandbox_git Run any git command
sandbox_diff Compare two files
sandbox_delete Delete a file or directory
sandbox_bash Execute shell commands

Installation

# Docker backend (development)
pip install roomkit-sandbox[docker]

# Kubernetes backend (production)
pip install roomkit-sandbox[kubernetes]

# SmolBSD backend (local VM isolation)
pip install roomkit-sandbox

Backends

Three backends for different deployment profiles:

Docker Kubernetes SmolBSD
Isolation Container Pod VM
Boot ~500ms ~2-5s ~5s (SSH)
Image 37MB (Alpine + RTK) 37MB 512MB (NetBSD)
Commands RTK (token-optimized) RTK Native (POSIX)
Use case Dev, CI Production Local assistant

See docs/backends.md for detailed setup instructions.

Quick Start

Docker

from roomkit import Agent
from roomkit_sandbox import ContainerSandboxExecutor
from roomkit_sandbox.docker_backend import DockerSandboxBackend

sandbox = ContainerSandboxExecutor(
    backend=DockerSandboxBackend(image="ghcr.io/roomkit-live/sandbox:latest"),
    session_id="my-sandbox",
)

agent = Agent("reviewer", provider=..., sandbox=sandbox)

Kubernetes

from roomkit_sandbox import ContainerSandboxExecutor
from roomkit_sandbox.k8s_backend import KubernetesSandboxBackend

sandbox = ContainerSandboxExecutor(
    backend=KubernetesSandboxBackend(
        image="ghcr.io/roomkit-live/sandbox:latest",
        namespace="production",
    ),
)

SmolBSD (Experimental)

from roomkit_sandbox import ContainerSandboxExecutor, NativeCommandBuilder
from roomkit_sandbox.smolbsd_backend import SmolBSDSandboxBackend

sandbox = ContainerSandboxExecutor(
    backend=SmolBSDSandboxBackend(smolbsd_dir="/path/to/smolBSD", service="sshd"),
    command_builder=NativeCommandBuilder(),
)

Command Builders

The CommandBuilder ABC controls how tool calls become shell commands:

  • RtkCommandBuilder (default) — uses RTK for 60-90% token reduction
  • NativeCommandBuilder — uses standard Unix commands (cat, grep, find, git)
  • Custom — subclass CommandBuilder for your own tools

See docs/commands.md for details and examples.

Container Image

docker pull ghcr.io/roomkit-live/sandbox:latest

Alpine 3.21 + RTK 0.42.4 + git + bash + curl + jq + gh + uv — 37MB (amd64; arm64 uses a Debian Trixie base).

Architecture

Agent (any provider) ──tool call──> RoomKit AIChannel
                                        │
                                   SandboxExecutor
                                        │
                              ContainerSandboxExecutor
                                        │
                    ┌───────────────────┼───────────────────┐
                    │                   │                   │
              DockerBackend      K8sBackend        SmolBSDBackend
                    │                   │                   │
              Container (37MB)     Pod (37MB)         VM (512MB)
                    │                   │                   │
              RtkCommandBuilder  RtkCommandBuilder  NativeCommandBuilder
                    │                   │                   │
              Token-optimized    Token-optimized    Standard output

Documentation

  • Backends — Docker, Kubernetes, SmolBSD setup and comparison
  • Command Builders — RTK vs Native, creating custom builders

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

roomkit_sandbox-0.3.1.tar.gz (56.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

roomkit_sandbox-0.3.1-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

Details for the file roomkit_sandbox-0.3.1.tar.gz.

File metadata

  • Download URL: roomkit_sandbox-0.3.1.tar.gz
  • Upload date:
  • Size: 56.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for roomkit_sandbox-0.3.1.tar.gz
Algorithm Hash digest
SHA256 e4872d6687884859996d719af9550da577802a8c90eedc2c19234789f6653e03
MD5 9b0c00a669c162df11efa191409d68f5
BLAKE2b-256 f2daba0066bcfff060a30b00ff8210ce5af31b6925da62e0e0a1b8bcf2abdd3c

See more details on using hashes here.

File details

Details for the file roomkit_sandbox-0.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for roomkit_sandbox-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 605e2fe544207d4487de0f61d69a067c310ebdf909e32637812a15ee8e784bd1
MD5 77d2c8a02c443efac7c6503f72ceed82
BLAKE2b-256 28299b7c5693b1f293a3a455f32c63336396ac42fec06f177814b16193cd5522

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page