Purpose
moltworker is used to run the OpenClaw (formerly known as Moltbot, Clawdbot) personal AI assistant on Cloudflare Workers. It packages OpenClaw into a Cloudflare Sandbox container, providing a fully managed, always-on deployment method without needing to host your own server. The project is positioned as a proof of concept, is not officially supported, may stop working at any time, and is used at your own risk.
Main Capabilities
- Run the OpenClaw personal AI assistant in a Cloudflare Sandbox container.
- Control UI: a web chat interface provided by the gateway.
- Multi-channel support: Telegram, Discord, Slack.
- Device pairing: secure private message authentication, requiring explicit approval.
- Persistent sessions: retain chat history and context across sessions.
- Agent runtime: extensible AI capabilities, including workspace and skills.
- Optional R2 storage: enables data persistence after container restarts.
- Optional browser automation (CDP shim): supports web scraping, screenshots, automated testing, etc.
- Optional Cloudflare AI Gateway: for caching, rate limiting, analytics, and cost tracking.
- Built-in skills: skills preinstalled in the container under /root/clawd/skills/, such as cloudflare-browser (including screenshot.js, video.js, cdp-client.js).
Usage
- Prerequisites: Workers paid plan ($5/month, required for Cloudflare Sandbox containers); Anthropic API key (for Claude access), or use AI Gateway's unified billing. Cloudflare Access, Browser Rendering, AI Gateway, and R2 Storage have free quotas.
- After deployment, open the Control UI using the token: replace your-worker with the actual worker subdomain, and YOUR_GATEWAY_TOKEN with the generated token. The first request may take 1-2 minutes while waiting for the container to start.
- Required: set up Cloudflare Access to protect the admin interface; pair devices through the /_admin/ admin interface.
- It is recommended to enable R2 storage so that paired devices and session history are retained after container restarts.
- The admin interface /_admin/ requires Cloudflare Access authentication (for local development, DEV_MODE=true can be set).
- Local development: create a .dev.vars file; device pairing authentication is used by default, and new devices must be approved via /_admin/.
- Gateway token: when accessing the Control UI remotely, the token must be passed via a query parameter; even if the token is valid, new devices still need approval via /_admin/.
- Persistent storage (R2): create an R2 API Token (Object Read & Write permission), select the moltbot-data bucket, and copy the Access Key ID and Secret Access Key; when the container starts, if R2 has backup data it is restored to the configuration directory, and during operation it syncs every 5 minutes; manual backup is also possible in the admin interface.
- Container lifecycle: always on by default (SANDBOX_SLEEP_AFTER=never), cold start takes 1-2 minutes; idle sleep can be configured to reduce costs.
- Debug endpoints: after enabling DEBUG_ROUTES=true and passing through Cloudflare Access, /debug/processes, /debug/logs, and /debug/version can be accessed.
- Optional chat channels, browser automation (CDP), Cloudflare AI Gateway (set three required secrets; the model can be specified with CF_AI_GATEWAY_MODEL in provider/model-id format).
Applicable Scenarios
- Users who want to deploy a personal AI assistant in a fully managed way without building their own server.
- Scenarios that need to use an AI assistant across multiple channels such as Telegram, Discord, and Slack.
- Security-sensitive scenarios that require device pairing and access control.
- Agent tasks that require browser automation (scraping, screenshots, testing).
- Personal assistant deployments that require persistent sessions and configuration.
Limitations
- Experimental project, not officially supported, may stop working at any time.
- Requires a Workers paid plan($5/month), container runtime incurs additional compute charges.
- Requires an Anthropic API key or AI Gateway unified billing.
- Cold start takes 1-2 minutes.
- R2 mounts are only effective in the production environment and are unavailable under wrangler dev.
- In local development, wrangler dev has known limitations with WebSocket proxying; HTTP works but WebSocket may fail.
- On Windows, Git may check out scripts with CRLF, causing start-openclaw.sh to exit with code 126; LF line endings must be configured.
- The device list command takes 10-15 seconds due to WebSocket connection overhead.
- Only one provider can be used at a time through the gateway; multiple providers require using direct keys.
- The legacy AI_GATEWAY_API_KEY + AI_GATEWAY_BASE_URL configuration is still supported but deprecated.