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 ~0.5s
Image 37MB (Alpine + RTK) 37MB 1GB (NetBSD + git, curl, bash)
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

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

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

The guest image is built from smolbsd/ (see docs/backends.md).

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 (1GB)
                    │                   │                   │
              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

Metadata

Release files for roomkit-sandbox 0.5.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.5.0
File Size Uploaded
roomkit_sandbox-0.5.0.tar.gz 77.6 kB Details

Built distribution (wheel)

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

Total release size: 104.4 kB

Release files / roomkit_sandbox-0.5.0.tar.gz

Download URL roomkit_sandbox-0.5.0.tar.gz
Size 77.6 kB
Tags Source
SHA-256 checksum
How to use checksums
95cbca899efaa5a10056624cb0f4a32cdfef2dba951738c25e08cda7f16727e8
BLAKE2b-256 checksum
How to use checksums
a2ea7957139fbf6a400eaa17a77d0394878f25b81711b6ce21d35eb98178387a
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.5.0-py3-none-any.whl

Download URL roomkit_sandbox-0.5.0-py3-none-any.whl
Size 26.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
486c9cd64201031401dcca3674e2872ccf0cbe912179cb3104cf616f6a2941d7
BLAKE2b-256 checksum
How to use checksums
df6c61cea927cb1efcc153199ff79651154ad905593d493c6dd0a66a725b5772
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.5.0 This release

2 release files

0.4.0

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