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.34.2 + git + bash + curl + jq — 37MB.

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.2.3.tar.gz (51.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.2.3-py3-none-any.whl (17.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for roomkit_sandbox-0.2.3.tar.gz
Algorithm Hash digest
SHA256 fbf346ceb8dbab41c0ec19f225129ff4a57a9d074f37b9df6d0306e448d704bb
MD5 1f0a17fd57e76cb843cd340ff6052663
BLAKE2b-256 592ec6289d2e5b0788a2cded0922081d1a6b3d184dd94ceac8d0a84cf585fca1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for roomkit_sandbox-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 6d1a21b9da80c8f436087382577899d00bfa78eeba6984d9a51b9d12490d0879
MD5 191ec819bf6b9ad01c21990efe824ff1
BLAKE2b-256 bac170cce536c304597970496029e900065f968984c665d06ec7b80cea083043

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