Skip to main content
Project 5 min read

dereksgehl/moltbot-sandbox

Experimental OpenClaw AI assistant deployment on Cloudflare Workers. Run personal AI with serverless infrastructure, multi-platform support, and managed ho

Originally published:

GitHub by dereksgehl

OpenClaw Cloudflare Workers Sandbox: AI Assistant Deployment Made Simple

The dereksgehl/moltbot-sandbox project provides an experimental implementation of OpenClaw (formerly known as Moltbot and Clawdbot) designed to run entirely within Cloudflare's serverless infrastructure. This TypeScript-based solution transforms the personal AI assistant into a fully managed, always-on deployment that eliminates the complexity of traditional self-hosting while leveraging Cloudflare's edge computing capabilities.

cloudflare-workers

What Makes This Project Unique

OpenClaw itself is a personal AI assistant featuring a gateway architecture that connects to multiple chat platforms including Telegram, Discord, and Slack. What makes this sandbox implementation particularly interesting is its adaptation to run within Cloudflare Sandbox containers—a proof-of-concept that demonstrates the feasibility of deploying sophisticated AI assistants on serverless infrastructure.

The project packages OpenClaw with a web-based Control UI, multi-channel support, secure device pairing with explicit approval requirements, and persistent conversation history. By containerizing the assistant within Cloudflare's ecosystem, users gain access to a managed deployment without maintaining servers or dealing with infrastructure complexity.

ai-assistant

Technical Architecture and Stack

Built entirely in TypeScript, the project leverages several Cloudflare services to create a cohesive deployment environment. The core runs on a standard-1 container instance (1/2 vCPU, 4 GiB memory, 8 GB disk) using Cloudflare Workers on the paid plan ($5/month minimum).

Key technical components include:

  • Cloudflare Workers - Serverless execution environment
  • Cloudflare Sandbox - Container runtime for the OpenClaw agent
  • Cloudflare Access - Authentication and authorization layer
  • Browser Rendering API - For web navigation capabilities
  • AI Gateway - Optional API routing and analytics
  • R2 Storage - Optional persistence layer for chat history and device pairings

The project includes comprehensive configuration files (wrangler.jsonc, vite.config.ts, vitest.config.ts) and follows modern development practices with testing infrastructure in place. The build system uses Vite, while Wrangler handles deployment to Cloudflare's edge network.

typescript-ai

Installation and Setup Process

Getting started requires a Cloudflare Workers Paid plan and an Anthropic API key for Claude access. The deployment process is straightforward but requires several configuration steps:

After installing dependencies with npm, users must configure secrets including the Anthropic API key (or alternatively Cloudflare AI Gateway credentials) and generate a secure gateway token using OpenSSL. The deployment command packages everything and pushes it to Cloudflare's infrastructure.

The first request typically takes 1-2 minutes as the container initializes. A critical post-deployment requirement is configuring Cloudflare Access to protect the admin UI at /_admin/, where device pairing and management occurs. This involves setting up Access on the workers.dev domain, configuring allowed users, and providing the worker with JWT validation credentials.

The documentation recommends enabling R2 storage for persistence across container restarts—without it, paired devices and conversation history are lost when containers cycle.

Cost Considerations

The project provides transparent cost estimates for 24/7 operation. Based on Cloudflare's container pricing, approximate monthly costs total around $34.50, including the $5 Workers plan, ~$26 for memory (4 GiB provisioned), ~$2 for CPU at 10% utilization, and ~$1.50 for disk storage.

Importantly, users can significantly reduce costs by configuring the SANDBOX_SLEEP_AFTER parameter to put containers to sleep during idle periods. A container running only 4 hours daily would cost approximately $5-6/month in compute resources plus the base plan fee.

cloudflare-cost-optimization

Community and Development Status

As of February 2025, this repository shows minimal community engagement with 0 stars, 0 forks, and 0 open issues. The project is explicitly labeled as experimental and a proof-of-concept, with clear warnings that it's not officially supported and may break without notice.

Released under the Apache-2.0 license, the codebase was last updated on February 7, 2026. The lack of GitHub topics and minimal community metrics suggest this is either a very early-stage project or a personal implementation shared for reference purposes rather than a production-ready solution seeking widespread adoption.

Comparison with Alternative Approaches

Traditional AI assistant deployments typically require dedicated servers, container orchestration platforms like Kubernetes, or managed services like AWS ECS. The Cloudflare Workers approach offers several distinct advantages: zero server management, automatic scaling, edge distribution, and integrated security through Cloudflare Access.

However, the experimental nature and cold-start latency (1-2 minutes on first request) make this less suitable for production use compared to traditional deployments. The cost structure also differs significantly—while serverless can be economical for intermittent use, 24/7 operation at ~$35/month may exceed basic VPS hosting costs while providing less control over the runtime environment.

self-hosted-ai

Final Assessment

The moltbot-sandbox project represents an innovative exploration of running AI assistants on serverless infrastructure. While clearly experimental, it demonstrates technical feasibility and provides a complete reference implementation for developers interested in Cloudflare Workers for AI applications. The comprehensive documentation, including cost breakdowns and security setup, shows attention to practical deployment concerns.

For developers comfortable with experimental software and interested in serverless AI deployment patterns, this project offers valuable insights. Production users should wait for the project to mature beyond its proof-of-concept status or consider it as a starting point for custom implementations rather than a turnkey solution.

Share:

Original Source

https://github.com/dereksgehl/moltbot-sandbox

View Original

Last updated: