Skip to main content
Project 5 min read

surfing-the-singularity/moltbot-sandbox

Deploy OpenClaw AI assistant on Cloudflare Workers with moltbot-sandbox. Multi-platform chat, secure pairing, persistent conversations in managed serverles

Originally published:

GitHub by surfing-the-singularity

Overview: OpenClaw Personal AI Assistant on Cloudflare Workers

The moltbot-sandbox project represents an experimental proof-of-concept deployment of OpenClaw (formerly known as Moltbot and Clawdbot) running entirely within Cloudflare's serverless infrastructure. This innovative implementation demonstrates how a fully-featured personal AI assistant can operate in a managed cloud environment without traditional server management, leveraging Cloudflare Workers and the Cloudflare Sandbox container runtime.

OpenClaw is a gateway-architecture AI assistant that connects to multiple chat platforms while providing a centralized control interface. Key capabilities include a web-based chat UI, multi-channel support for Telegram, Discord, and Slack, secure device pairing with DM authentication, persistent conversation history, and an extensible agent runtime with workspace and skills. This Cloudflare Workers implementation packages these features into a production-ready deployment that runs 24/7 without self-hosting requirements.

cloudflare-workers

Installation and Setup Process

Setting up moltbot-sandbox requires a Cloudflare Workers Paid plan ($5/month) to access Sandbox containers, plus an Anthropic API key for Claude integration. The installation process is straightforward for developers familiar with Node.js and command-line tools.

After installing dependencies with npm install, users must configure several essential secrets. The Anthropic API key can be set directly, or alternatively, the project supports Cloudflare AI Gateway for unified billing and API routing. A critical security step involves generating a gateway token using OpenSSL, which secures remote access to the Control UI. This token must be stored securely as it's required for all subsequent access.

The deployment process uses npm run deploy to push the worker to Cloudflare's network. However, deployment alone isn't sufficient for production use. Users must complete three additional critical steps: configuring Cloudflare Access for authentication, pairing devices through the admin UI at /_admin/, and optionally enabling R2 storage for persistence across container restarts. The first request may take 1-2 minutes as the container initializes.

cloudflare-deployment

Technical Stack Analysis

The project is built with TypeScript, providing type safety and modern JavaScript features. The technology stack leverages several Cloudflare services that offer generous free tiers, including Cloudflare Access for authentication, Browser Rendering for web navigation capabilities, AI Gateway for optional API routing and analytics, and R2 Storage for optional persistence.

The container runs on a standard-1 instance specification with 1/2 vCPU, 4 GiB memory, and 8 GB disk space. The project includes comprehensive configuration files including Vite for build tooling, Vitest for testing, Docker support, and Wrangler configuration for Cloudflare deployment. Development tooling includes Oxlint and Oxfmt configurations, suggesting attention to code quality standards.

The architecture diagram included in the repository shows a clean separation between the gateway component, agent runtime, and various chat platform integrations. This modular design allows for extensibility through a skills system, enabling developers to add custom capabilities to the AI assistant.

typescript-ai

Cost Considerations and Resource Management

A significant aspect of this project is its transparent cost documentation. Running the container 24/7 results in approximately $34.50 monthly costs, broken down as follows: ~$26/month for 4 GiB memory (2,895 GiB-hours over free tier), ~$2/month for CPU at 10% utilization (~1,815 vCPU-minutes over free tier), and ~$1.50/month for 8 GB disk (5,640 GB-hours over free tier), plus the $5 Workers Paid plan.

Importantly, CPU billing only applies to active usage, not provisioned capacity. The project includes a configurable SANDBOX_SLEEP_AFTER parameter that enables the container to sleep during idle periods, dramatically reducing costs. A container running only 4 hours daily would cost approximately $5-6/month in compute resources plus the $5 plan fee, making it economical for personal use cases. Network egress, Workers requests, Durable Objects, and logs incur additional minimal charges for typical personal usage patterns.

ai-deployment-costs

Community Statistics and Project Status

As of February 2025, moltbot-sandbox shows early-stage development metrics with 0 stars, 0 forks, and 0 watchers on GitHub. The repository has 0 open issues and was last updated on February 7, 2026. The project is clearly marked as experimental with explicit warnings that it's a proof of concept, not officially supported, and may break without notice.

Despite minimal community engagement metrics, the project demonstrates technical sophistication with comprehensive documentation including AGENTS.md and CONTRIBUTING.md files. The Apache-2.0 license encourages open-source contribution and modification. The repository contains well-organized code structure with dedicated directories for skills, tests, and source code, along with professional development tooling configurations.

Comparison with Alternative AI Assistant Deployments

Compared to traditional self-hosted AI assistants, moltbot-sandbox offers significant operational advantages through serverless architecture. Unlike running personal AI assistants on VPS or home servers, this approach eliminates server maintenance, provides automatic scaling, and includes built-in DDoS protection and global CDN distribution through Cloudflare's network.

The cost structure differs markedly from alternatives like hosting on AWS EC2 or DigitalOcean, where minimum viable instances often cost $10-20/month for always-on availability. The ability to configure sleep mode makes moltbot-sandbox potentially more economical for intermittent usage patterns. However, the requirement for a Cloudflare Workers Paid plan creates a baseline cost floor that may not suit all users.

Compared to fully managed AI assistant services, this project offers greater customization through its extensible skills system and agent runtime, while maintaining lower costs than enterprise solutions. The trade-off is technical complexity in setup and the experimental nature of the implementation, requiring users comfortable with command-line tools, secret management, and Cloudflare's ecosystem.

ai-assistant-comparison
Share:

Original Source

https://github.com/surfing-the-singularity/moltbot-sandbox

View Original

Last updated: