Skip to main content

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

Release files for roomkit-sandbox 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for roomkit-sandbox 0.4.0
File Size Uploaded
roomkit_sandbox-0.4.0.tar.gz 59.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for roomkit-sandbox 0.4.0
File Interpreter ABI Platform
roomkit_sandbox-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 79.4 kB

Release files / roomkit_sandbox-0.4.0.tar.gz

Download URL roomkit_sandbox-0.4.0.tar.gz
Size 59.7 kB
Tags Source
SHA-256 checksum
How to use checksums
85dcef24abc80cf9b57bd54253f2de100ca9c62a56589be9003ad964c093b786
BLAKE2b-256 checksum
How to use checksums
7b9cc1a3b48a012f2ce58443dfb011e826f1fe88e8540d2e7d24c7d0bf269631
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / roomkit_sandbox-0.4.0-py3-none-any.whl

Download URL roomkit_sandbox-0.4.0-py3-none-any.whl
Size 19.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
88674bad44a108f7b495df93f54347b5e0818b6f0f9adff0476085d7eb515f0b
BLAKE2b-256 checksum
How to use checksums
eacaf287a31cf925b50eabeaf45783ae34e313a47803e8348376f52d67fd3785
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page