GitHub Repository
Source code and provisioning scripts.
Prerequisites
- Node.js 20+ installed locally
- An Anthropic API key (for Claude, used by the OpenClaw agent)
- An OpenComputer API key
Step 1: Sign Up for OpenComputer
Go to app.opencomputer.dev and create an account.Step 2: Generate an API Token
From the OpenComputer dashboard, generate an API token. You’ll use this to authenticate SDK calls that create and manage sandboxes.Step 3: Set Up the Project
Clone the template repository and install dependencies:Step 4: Build the Snapshot
The snapshot is a reusable base image with Node.js and OpenClaw pre-installed. Building it takes a few minutes but only needs to happen once.openclaw-ready. All future sandboxes boot from this snapshot in seconds.
Step 5: Provision an Agent
Provision an OpenClaw instance for a user:Step 6: Start the Chat Server
The chat server is a lightweight proxy that serves a web UI per user and routes messages to their sandbox via the OpenComputer SDK. No gateway URLs or tokens are exposed to the browser.http://localhost:3000/emp-001 in your browser to start chatting with the agent.
The landing page at http://localhost:3000 lists all running agents.
Step 7: (Optional) Add Telegram
Each agent can be connected to its own Telegram bot. First, create a bot via @BotFather on Telegram, then configure it:How It Works
Provisioning Flow
- Sandbox is created from the pre-built snapshot using
Sandbox.create()— this takes seconds, not minutes. - OpenClaw config is written with a unique gateway auth token, the selected model, and security settings (exec auto-approval, loopback-only binding).
- API key is written to an env file sourced by the gateway process.
- Gateway starts via a startup script that launches OpenClaw in the background and waits for it to become ready.
- Device pairings are auto-approved so internal connections (cron jobs, Telegram) work without manual intervention.
Chat Proxy Architecture
The chat server uses the OpenComputer SDK to execute commands inside each sandbox. When a user sends a message:- The browser sends a
POST /api/chat/:employeeIdto the chat server. - The server looks up the sandbox ID from the fleet registry.
- It connects to the sandbox via
Sandbox.connect()and reads the gateway token from the config file. - It writes the message payload to a temp file inside the sandbox and runs
curlagainst the gateway’s/v1/chat/completionsendpoint on127.0.0.1. - The SSE response is streamed back to the browser.
Security Model
- Loopback-only gateway — the OpenClaw gateway binds to
127.0.0.1, not accessible from outside the sandbox. - No preview URLs — unlike other OpenComputer use cases, no ports are exposed. All access is proxied through the OC SDK.
- Per-sandbox tokens — each sandbox gets a unique gateway auth token generated at provision time using
crypto.randomBytes(). - Exec auto-approval — since agents run in fully isolated sandboxes, tool execution is auto-approved (
tools.exec.security: "full").
Fleet Management
The template includes scripts for managing multiple agents:fleet-registry.json (swap for a database in production).
Customization
Changing the Model
Pass--model when provisioning, or update an existing agent’s config:
Adding More Channels
OpenClaw supports WhatsApp, Discord, Slack, and more. Configure them viaopenclaw config set inside the sandbox: