moltworker: Run OpenClaw on Cloudflare Workers
Deploy the open-source personal AI assistant OpenClaw into a Cloudflare Sandbox container for a fully managed, always-on multi-platform chat assistant.
Evidence shows: README describes multi-layer authentication (Cloudflare Access, gateway token, device pairing) and requires explicit device approval, reflecting user confirmation. However, least privilege is not clearly addressed; optional debug and CDP endpoints may expand attack surface. Data flow transparency is limited; no detailed data flow description. Sensitive data handling mentions secrets but lacks encryption details. Dependency security lists dependencies but no vulnerability scanning or lockfile. External effects include cost estimates and container lifecycle but not explicit external calls. Rollback mentions R2 backup/restore but not version rollback. Source attribution links to OpenClaw but not clear code provenance.
Evidence shows: README provides detailed configuration and troubleshooting, showing good self-consistency. Dependency availability lists dependencies but no lockfile or version pinning, affecting reproducibility. Failure messages include common errors like Windows permission issue, but not comprehensive error handling.
Evidence shows: README targets personal AI assistant users, offers multiple deployment scenarios (Telegram, Discord, Slack, CDP, AI Gateway), and states environment requirements (Workers Paid plan). Capability boundaries are described for optional features but not limitations. Trigger precision is detailed via configuration options and secrets reference, but not trigger conditions. Environment fit explains local vs production differences but not detailed compatibility.
Evidence shows: README has clear structure with quick start, architecture, configuration, security, troubleshooting, showing good information architecture. Install notes are detailed with dependencies, secrets, and deploy commands. Naming stability is weak: project renamed from Moltbot to OpenClaw but README still uses old names, causing confusion. Examples and FAQ: README provides examples and troubleshooting but no FAQ section. Known limitations are explicitly stated as experimental and known issues. License is Apache-2.0 with LICENSE file. Versioning and changelog: package.json has version but no CHANGELOG. Maintenance responsibility is not clearly stated.
Evidence shows: README provides clear deployment and usage instructions, good output usability. Marginal value is unique in running OpenClaw on Cloudflare, but may overlap with other deployments. Cost-benefit includes detailed cost estimates, but no performance benchmarks.
Evidence shows: Claims in README are mostly supported by documentation, but no independent verification sources. Cross-source corroboration links to OpenClaw and Cloudflare docs, but no other independent sources. Fact-inference separation distinguishes facts (cost estimates) from inferences (utilization assumptions), but not explicitly labeled.
- Project is experimental and may break without notice; no official support.
- README still uses old name Moltbot, which may cause confusion.
- Dependencies are not pinned, affecting reproducibility.
- Debug and CDP endpoints may expand attack surface; configure carefully.
- No CHANGELOG provided, version changes are not transparent.
What does this agent do, and when should you use it?
moltworker is a proof-of-concept that packages OpenClaw (formerly Moltbot/Clawdbot), a personal AI assistant, into a Cloudflare Sandbox container and exposes it via Cloudflare Workers. It leverages Cloudflare's infrastructure to provide a fully managed runtime, eliminating the need to self-host a server. Core components include the Cloudflare container (running the OpenClaw gateway), a Cloudflare Access-protected admin UI (/_admin/) for device pairing and management, and optional R2 object storage for persisting configuration and conversation history. Deployment requires a Workers Paid plan ($5/month) and an Anthropic API key (or AI Gateway with Unified Billing). The project provides detailed setup scripts, a secret reference, and cost estimates, and supports Telegram, Discord, Slack channels plus browser automation through a CDP shim. It is explicitly marked experimental, not officially supported, and may break without notice.
Packages OpenClaw into a Cloudflare Sandbox container (standard-1 instance: 1/2 vCPU, 4 GiB memory, 8 GB disk) and routes requests through Workers. It sets secrets via npx wrangler secret put, including ANTHROPIC_API_KEY (or CLOUDFLARE_AI_GATEWAY_API_KEY etc.) and MOLTBOT_GATEWAY_TOKEN. After deployment, it provides a Control UI at https://your-worker.workers.dev/?token=YOUR_GATEWAY_TOKEN and an admin UI at /_admin/ for device pairing (protected by Cloudflare Access). It supports Telegram, Discord, and Slack channels by setting respective bot tokens. Optional R2 storage (set R2_ACCESS_KEY_ID, R2_SECRET_ACCESS_KEY, CF_ACCOUNT_ID) provides persistence across container restarts, with automatic backups every 5 minutes. Browser automation is enabled through a CDP shim: after setting CDP_SECRET and WORKER_URL, endpoints like /cdp/json/version, /cdp/json/list, /cdp/json/new, and WS /cdp/devtools/browser/{id} are available, with pre-installed scripts screenshot.js and video.js for capturing screenshots and videos. AI Gateway integration routes requests through the gateway to providers like Anthropic, OpenAI, or Workers AI. Debug endpoints /debug/processes, /debug/logs, etc. are available when DEBUG_ROUTES=true.
- Cloudflare users who want to deploy a personal AI assistant on Cloudflare's infrastructure without managing a server.
- Teams or individuals who want to use Telegram, Discord, or Slack as chat interfaces, with secure device pairing approval.
- Developers needing browser automation capabilities via Chrome DevTools Protocol (CDP) for tasks like screenshotting and video generation, integrated as OpenClaw skills.
- Deployers who want persistent storage of conversation history and paired devices using R2, surviving container restarts.
- Developers who want unified AI gateway for API routing, analytics, and cost tracking, especially with Workers AI Unified Billing.
What are this agent's strengths and limitations?
- Leverages Cloudflare's managed container runtime for a fully managed, always-on personal assistant without self-hosting.
- Device pairing with explicit approval provides strong security for the admin UI and API.
- Optional R2 persistence retains configuration, paired devices, and conversation history across restarts.
- Native support for Cloudflare AI Gateway offers caching, rate limiting, analytics, and unified billing.
- Pre-built CDP shim and scripts enable browser automation (screenshots and video generation).
- Experimental project: not officially supported, may break without notice, and changes are not guaranteed to be backward-compatible.
- Platform lock-in: core operation depends on Cloudflare Workers Paid plan, Sandbox containers, and specific secrets; migration to other platforms is difficult.
- Ongoing costs are relatively high: approximately $34.50/month with 24/7 operation (including $5 plan fee), requiring careful use of SANDBOX_SLEEP_AFTER.
- Configuration is complex: involves multiple secrets (at least 3-5) and administrators must set up Cloudflare Access.
- Cold start latency: first request waits 1-2 minutes, not suitable for low-latency interactions.
- Known issue on Windows: CRLF line endings cause shell script failure (exit code 126), requiring Git line-ending configuration.
How do you install or deploy this agent?
- Enable a Cloudflare Workers Paid plan ($5/month). 2. Clone the repository and run
npm install. 3. Set secrets:npx wrangler secret put ANTHROPIC_API_KEY(or the three AI Gateway secrets: CLOUDFLARE_AI_GATEWAY_API_KEY, CF_AI_GATEWAY_ACCOUNT_ID, CF_AI_GATEWAY_GATEWAY_ID). 4. Generate a gateway token:export MOLTBOT_GATEWAY_TOKEN=$(openssl rand -hex 32), thennpx wrangler secret put MOLTBOT_GATEWAY_TOKEN. 5. Runnpm run deploy. Requires a Cloudflare account with Containers enabled in the dashboard.
How do you use this agent?
After deployment, access the Control UI with the gateway token: https://your-worker.workers.dev/?token=YOUR_GATEWAY_TOKEN. The first request may take 1-2 minutes. You MUST first set up Cloudflare Access (set CF_ACCESS_TEAM_DOMAIN and CF_ACCESS_AUD) to protect /_admin/, then pair your device via the admin UI to start using. Optionally, set R2 secrets for persistence, and configure SANDBOX_SLEEP_AFTER=10m to reduce costs. To add chat channels, set the respective bot tokens and redeploy. For browser automation, set CDP_SECRET and WORKER_URL, then use the /cdp/ endpoints.
FAQ
How much does it cost to run this project?
Which API keys are required?
Will my conversation history and paired devices be lost on container restart?
Why can't I access the Control UI after deployment?
Can this be developed locally?
wrangler dev has limitations with WebSocket proxying, so WebSocket connections may fail; R2 mounting only works in production. For local development, set DEV_MODE=true in .dev.vars to skip Cloudflare Access and device pairing, but this is only for local development.