Skip to content
Rookery OS

RookeryOS — Dual-Container Pod Architecture

Two containers. One operating system. The LLM is the kernel.

Architecture Diagram

The RookeryOS Agent Pod — Container 1 (Kernel) running s6-overlay, the reverse-proxy API gate, the Hudson gateway agent engine, and the chelper bootstrap; Container 2 (Sidecar) running entrypoint.sh, headless Chromium on CDP :9222, an Xvfb virtual display, x11vnc + websockify for noVNC :6080, and the Browser-Use FastAPI on :9223; shared volumes for CDP socket coordination and the 10Gi agent workspace — all on the Rookery OS base.

Container 1: Kernel

The Kernel is the brain of the pod. It runs Hudson Gateway — the agent execution engine that orchestrates LLM calls, tool invocations, memory management, and terminal sandbox operations.

Boot Sequence

RookeryOS pod initialization flow — Pod Start launches tini (PID 1) for signal handling and s6-overlay v3, which runs the init-config-gen oneshot (generates hudson.json from the Platform API config), then the init-chelper oneshot (validates the sidecar CDP on localhost:9222, validates the PVC mount, fetches agent config, restores cookies from the vault, and exits 0), then the long-running svc-nginx reverse proxy and svc-hudson gateway services, ending in the Pod Ready readiness state.

Kernel Components

ComponentFilePurpose
chelperapps/hudson-gateway/src/bootstrap/chelper.tsBootstrap validator
Hudson Gatewayapps/hudson-gateway/Agent execution engine
Sidecar Browser Providerapps/hudson-gateway/src/browser/sidecar-browser-provider.tsCDP connection to sidecar
Browser-Use Bridgeapps/hudson-gateway/src/browser/browser-use-bridge.tsDOM distillation bridge
Login Detectorapps/hudson-gateway/src/tools/login-detector.tsAuth page heuristics
HITL Controllerapps/hudson-gateway/src/tools/hitl-controller.tsHuman-in-the-Loop flow
Cookie Injectorapps/hudson-gateway/src/tools/cookie-injector.tsCookie restoration
Output Formatterapps/hudson-gateway/src/tools/output-formatter.tsLighthouse format output
nginxs6-overlay configReverse proxy, static assets

Kernel Docker Image

Base: rookery-os-base (hardened Debian bookworm-slim)
  → node:22-bookworm-slim (Node.js runtime)
    → Hudson Gateway compiled JS
      → s6-overlay service definitions

Location: infrastructure/docker/rookery-kernel/Dockerfile


Container 2: Sidecar (Eye/Hand)

The Sidecar provides the browser interface. It runs a headless Chromium browser that the kernel controls via CDP, plus a VNC stack so humans can see and interact with the browser when needed.

Service Stack

The Sidecar service stack started by entrypoint.sh — an Xvfb :99 virtual display (1280×720×24), headless Chromium with remote debugging on port 9222, x11vnc mirroring the Xvfb display to the VNC protocol, websockify bridging :6080 to localhost:5900 to serve the noVNC web client, and the Browser-Use FastAPI on :9223 whose POST /distill endpoint navigates and extracts structured content.

Sidecar Components

ComponentPortPurpose
Chromium9222 (CDP)Headless browser, controlled by Kernel via CDP
noVNC6080 (HTTP/WS)Browser-based VNC client for human viewing
Browser-Use9223 (HTTP)Python FastAPI for DOM distillation

Browser-Use DOM Distillation

The Browser-Use service converts raw web pages into LLM-readable tokens:

# POST /distill
{
  "url": "https://salesforce.com/dashboard",
  "action": "extract"  # or "click", "type", "screenshot"
}

# Response
{
  "title": "Salesforce Dashboard",
  "text": "Cleaned page content...",
  "links": [{"text": "Contacts", "href": "/contacts"}],
  "forms": [...],
  "is_login_page": false
}

Purpose: Instead of sending raw HTML (100KB+) to the LLM, Browser-Use distills it to structured, meaningful content (~2KB). This saves tokens and improves accuracy.

Location: infrastructure/docker/rookery-sidecar/browser-use-server.py


Inter-Container Communication

CDP (Chrome DevTools Protocol)

The primary communication channel between Kernel and Sidecar:

Kernel (Hudson Gateway)
  → Playwright CDP connection to localhost:9222
    → Sidecar Chromium
      → Navigate URLs
      → Click elements
      → Extract content
      → Take screenshots
      → Execute JavaScript

Why localhost? Both containers share the pod's network namespace. localhost:9222 in the Kernel reaches 0.0.0.0:9222 in the Sidecar.

noVNC (Human-in-the-Loop)

When a login page is detected, humans view the browser through noVNC:

Human browser
  → app.agentworksstudio.com/novnc-proxy
    → API Server WebSocket relay
      → Pod Sidecar :6080 (noVNC)
        → Xvfb display
          → Chromium browser (visible)

Browser-Use (DOM Distillation)

When the agent needs to understand a page:

Kernel (Hudson Gateway)
  → HTTP POST to localhost:9223/distill
    → Sidecar Browser-Use FastAPI
      → Navigates page via CDP
        → Extracts structured content
          → Returns clean JSON to Kernel

Shared Resources

emptyDir Volume: /tmp/cdp

A shared ephemeral volume for CDP socket coordination:

  • Created with the pod, destroyed when pod terminates
  • Used for passing CDP WebSocket URLs between containers
  • Ensures Kernel and Sidecar can coordinate browser sessions

PersistentVolumeClaim: agent-workspace

A 10Gi persistent volume for agent state:

  • Hudson workspace directory (HUDSON_STATE_DIR)
  • Agent memory files and SOUL.md
  • Session logs and conversation history
  • Survives pod restarts and migrations

Not available for Navigator tier (ephemeral only).


Resource Allocation

ContainerCPU RequestCPU LimitMemory RequestMemory Limit
Kernel250m1000m512Mi2Gi
Sidecar250m1000m512Mi2Gi
Total Pod500m2000m1Gi4Gi
ContainerCPU RequestCPU LimitMemory RequestMemory Limit
Kernel only200m500m256Mi512Mi
No Sidecar

Health Checks

ProbeContainerEndpointThreshold
StartupKernel:8080/health10s period, 3 failures
LivenessKernel:8080/health30s period
ReadinessKernel:8080/health10s period
SidecarSidecar:9223/healthCustom script

Lifecycle

Provisioning

  1. Agent Provisioner receives create request
  2. Generates K8s manifest from agent-pod-v2.yaml template
  3. Applies namespace, RBAC, NetworkPolicy
  4. Creates PVC for persistent storage
  5. Submits pod spec to K8s API
  6. Pod starts → chelper bootstraps → Hudson ready

Running

  1. Hudson Gateway listens for agent commands
  2. Browser interactions go through Sidecar via CDP
  3. Human-in-the-Loop events sent via WebSocket
  4. Lighthouse knowledge queries via Platform API
  5. Cookie Vault reads/writes via Platform API

Teardown

  1. Agent Provisioner receives delete request
  2. Deletes K8s pod, PVC, and all namespace resources
  3. Cookie Vault entries cleaned up
  4. Lighthouse documents preserved (tenant-level)

File Locations

The infrastructure/ source tree — docker/ holds the hardened rookery-os-base image, the rookery-kernel container with its s6-overlay service definitions (init-chelper, init-config-gen, svc-hudson, svc-nginx, and the chelper script), and the rookery-sidecar container with its entrypoint.sh and browser-use-server.py; k8s/ holds the dual-container agent-pod-v2 template and the Navigator isolation manifests; and cloudbuild-pod.yaml drives the multi-image build.