Skip to main content
Project 4 min read

DAVIDGILMOUR2/moltbot-sandbox

OpenClaw AI assistant deployed on Cloudflare Workers. Experimental TypeScript implementation with device pairing, R2 storage, and multi-platform support.

Originally published:

GitHub by DAVIDGILMOUR2

Overview: OpenClaw Meets Cloudflare Workers

The moltbot-sandbox project represents an experimental deployment of OpenClaw (formerly known as Moltbot and Clawdbot) on Cloudflare's serverless infrastructure. This proof-of-concept demonstrates how a personal AI assistant with gateway architecture can run entirely within Cloudflare's Sandbox environment, offering developers an always-on, fully managed deployment option without traditional self-hosting requirements.

Built with TypeScript and leveraging Cloudflare's Workers platform, this project showcases the potential for running sophisticated AI assistants on edge computing infrastructure. While explicitly marked as experimental and unsupported, it provides valuable insights into serverless AI deployment patterns and the capabilities of Cloudflare's ecosystem.

rogerli007/my-openclaw-page

Core Features and Capabilities

OpenClaw itself is a feature-rich personal AI assistant that connects to multiple chat platforms through a gateway architecture. The moltbot-sandbox implementation preserves these capabilities while adapting them for the Cloudflare environment:

  • Web-Based Control UI: A gateway-level chat interface accessible directly through your Workers deployment, providing centralized control over the AI assistant
  • Multi-Channel Support: Integration with popular communication platforms including Telegram, Discord, and Slack, enabling cross-platform AI assistance
  • Device Pairing Security: Explicit approval workflow for new devices connecting to the gateway, requiring admin authorization via a dedicated admin UI at /_admin/
  • Persistent Conversations: Optional R2 storage integration maintains chat history and context across container restarts, ensuring continuity in long-running conversations
  • Agent Runtime: Extensible AI capabilities with workspace management and custom skills support
  • Cloudflare Access Integration: Built-in authentication using Cloudflare's Zero Trust security framework
Cloudflare Workers

Installation and Setup Process

Deploying moltbot-sandbox requires a Cloudflare Workers Paid plan ($5 USD/month) to access Sandbox containers. The setup process involves several key steps:

After installing dependencies with npm install, developers must configure API access either through direct Anthropic API keys or via Cloudflare's AI Gateway for unified billing. A critical security step involves generating a gateway token using OpenSSL, which serves as the primary access credential for the Control UI.

The deployment workflow includes configuring Cloudflare Access for admin UI protection, a non-optional security measure that prevents unauthorized access to device management functions. Administrators must set up Access on their workers.dev domain, configure identity providers (email, Google, GitHub), and establish the CF_ACCESS_TEAM_DOMAIN and CF_ACCESS_AUD secrets for JWT validation.

For production use, enabling R2 storage is strongly recommended to persist paired devices and conversation history across container restarts, preventing data loss during infrastructure updates or scaling events.

Cloudflare R2

Local Development Environment

The project supports local development through a .dev.vars configuration file that enables DEV_MODE, bypassing Cloudflare Access authentication and device pairing requirements for rapid iteration. Optional DEBUG_ROUTES can be enabled to access diagnostic endpoints during development.

Technical Stack Analysis

The project demonstrates sophisticated use of Cloudflare's ecosystem:

  • Runtime: Cloudflare Workers with Sandbox container support for running full-featured applications
  • Language: TypeScript for type-safe development and better maintainability
  • Build Tooling: Vite for development server and bundling, with Vitest for testing infrastructure
  • Authentication: Cloudflare Access for Zero Trust security model, with device pairing for granular control
  • Storage: Optional R2 object storage for persistent data across deployments
  • Additional Services: Browser Rendering API for navigation capabilities, AI Gateway for API routing and analytics

The use of wrangler.jsonc for configuration and Docker support indicates a flexible deployment strategy that could potentially adapt to other container platforms if needed.

Cloudflare AI Gateway

Community and Development Status

As of February 2024, this repository shows minimal community engagement with 0 stars, 0 forks, and 0 watchers. The project consists of 5 commits and has no open issues, suggesting it's in early experimental stages. The repository is licensed under Apache-2.0, providing permissive terms for modification and distribution.

The lack of defined topics and limited documentation beyond the README indicates this is primarily a technical demonstration rather than a production-ready solution. The explicit "experimental" warning in the documentation reinforces that users should expect potential breaking changes and limited support.

Comparison with Alternative Approaches

Compared to traditional self-hosted AI assistant deployments, moltbot-sandbox offers several distinct advantages and trade-offs:

Advantages: Serverless architecture eliminates server maintenance overhead, automatic scaling through Cloudflare's infrastructure, integrated security through Access, and global edge distribution for low-latency responses. The $5/month Workers plan is competitive with basic VPS hosting while providing better reliability.

Trade-offs: The experimental status means production use carries risk, Cloudflare Sandbox containers may have resource limitations compared to dedicated hosting, and the dependency on Cloudflare's ecosystem creates vendor lock-in. Traditional deployments of OpenClaw on self-hosted infrastructure offer more control but require significantly more operational expertise.

AI assistants

Conclusion

The moltbot-sandbox project serves as an intriguing proof-of-concept for deploying sophisticated AI assistants on serverless infrastructure. While not recommended for production use given its experimental status, it demonstrates the viability of running OpenClaw on Cloudflare Workers and provides a foundation for developers interested in edge-based AI deployment patterns. The comprehensive integration with Cloudflare's security and storage services showcases modern approaches to building distributed AI applications.

Share:

Original Source

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

View Original

Last updated: