Skip to content

Worker Agent

The worker agent is a lightweight Go binary that runs on each machine and bridges the orchestrator to local Podman (or Docker) DevBoxes. It requires no runtime dependencies — just download and run.

Orchestrator (cloud)
│ WebSocket (outbound from worker)
Worker Agent (your machine)
│ child_process / Podman API
Podman containers
  1. Connects to the orchestrator via WebSocket (outbound, authenticated with worker token)
  2. Registers itself with system info (see below)
  3. Sends heartbeats every 10 seconds (see below)
  4. Receives commands from the orchestrator
  5. Executes DevBox operations locally via Podman or Docker

On connect, the agent sends a worker.register message with:

FieldTypeDescription
namestringWorker name (env, config, or hostname)
hostnamestringSystem hostname
platformstringOS — linux, darwin, or windows
cpuCountintNumber of CPU cores
memoryTotaluint64Total RAM in bytes
containerEnginesstring[]Detected engines (podman, docker)
agentVersionstringAgent version, e.g. 2.0.0
modestringbyom (bring-your-own-machine) or fleet

Every 10 seconds the agent sends a worker.heartbeat with:

FieldTypeDescription
cpuUsagefloat64CPU usage 0–100%
memoryFreeuint64Free RAM in bytes
diskTotaluint64?Total disk in bytes
diskFreeuint64?Free disk in bytes
containersRunningintNumber of running DevBoxes
gatewayStatusstring?Gateway connectivity status
gatewayStatusDetailstring?Additional gateway info
CommandAction
DevBox.createCreate a new DevBox from image
DevBox.setupRun initial setup (clone repo, generate CLAUDE.md)
DevBox.startStart a stopped DevBox
DevBox.stopStop a running DevBox
DevBox.removeRemove a DevBox
DevBox.listList DevBoxes for a tenant
DevBox.list-allList all DevBoxes across tenants
DevBox.execExecute a command inside a DevBox
DevBox.exec.backgroundRun a background command in a DevBox
DevBox.exec.background.killKill a background command
DevBox.exec.background.captureCapture background command output
images.listList available DevBox images
image.checkCheck if an image exists
image.deleteDelete a DevBox image
image.buildBuild a DevBox image from Dockerfile
terminal.openStart an interactive shell session
terminal.inputForward keystrokes to a terminal
terminal.resizeResize terminal dimensions
terminal.closeClose a terminal session
display.openOpen a VNC display session
display.closeClose a VNC display session

Terminal output from DevBoxes is streamed back through the worker agent to the orchestrator, which relays it to the browser via WebSocket. This gives you a live web terminal with full xterm.js rendering.

If the WebSocket connection drops, the agent reconnects automatically with exponential backoff:

1s → 2s → 4s → 8s → 16s → 30s (max)

DevBoxes continue running during disconnection — they’re not affected by the agent’s connection state.

The worker agent reads configuration from environment variables, YAML config files, or CLI flags.

BYOM mode (bring-your-own-machine — default):

PathContents
~/.clustercode/credentials.jsonAuth token from clustercode login
~/.clustercode/worker.jsonWorker registration state
~/.clustercode/config.jsonUser preferences (WORKER_NAME)

Fleet mode (managed deployments):

PathContents
/etc/clustercode/agent.yamlFull agent config (URL, token, mode, security)
AGENT_CONFIG env varOverride the YAML path

Key environment variables: ORCHESTRATOR_WS_URL, WORKER_NAME, AGENT_MODE, PODMAN_PATH, DATA_DIR, SECURITY_FLOOR. See Environment Variables for the full list.

The worker agent runs as a foreground process. To run it as a background service:

Linux (systemd):

Terminal window
clustercode worker

macOS (launchd):

Terminal window
clustercode worker

The agent is designed to be restarted safely — it picks up existing DevBoxes on reconnection.

Getting Started Concepts Guides CLI Self-Hosting Reference Links