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.1.tar.gz (49.8 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.1-py3-none-any.whl (16.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: roomkit_sandbox-0.2.1.tar.gz
  • Upload date:
  • Size: 49.8 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.1.tar.gz
Algorithm Hash digest
SHA256 8169f8b270ceaac77cc0fa328093b971ba0e77e1cd664e189182602dfa6e0583
MD5 9bb8eaef0042405234405df2a4e775a5
BLAKE2b-256 cf6598b968c47d1f31e5df28e697576c4533a1b4de0cfbe87be167f58103072a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for roomkit_sandbox-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 04f0ae4e4ae5ed99fa4191c41353fba7e4e37bd4cfa6fd82e10ab0df420bdfd0
MD5 eebb69b4ad9f35148786b228ad4a376d
BLAKE2b-256 b68cbedf5f26da99bd7e7b60244b56e7015d8e3e39134cb755bd9afdadd0777a

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