Cloudflare Deployment Guide

Moltworker Deployment: How to Deploy an AI Agent on Cloudflare

Follow this step-by-step Moltworker deployment guide to prepare your Cloudflare account, install the project, configure AI access, deploy your Worker, and verify that your AI agent is running.

What Is Moltworker Deployment?

Moltworker deployment is the process of running the OpenClaw personal AI agent on Cloudflare infrastructure. It uses a Cloudflare Worker as an entry point and a Sandbox container to run the adapted OpenClaw Gateway runtime.

Instead of installing the entire agent on a dedicated computer or managing a traditional Linux server, developers can use Cloudflare's developer platform to host the project. The setup can also connect services such as AI Gateway, R2 storage, Cloudflare Access, and Browser Rendering.

This guide focuses on the deployment process itself: preparing your environment, downloading the source code, installing dependencies, adding the required credentials, deploying the Worker, and checking the result.

Important: Cloudflare describes the official Moltworker repository as an experimental proof of concept. It is not an officially supported Cloudflare product and may change or break without notice. Review the latest repository before deploying.

☁

Cloudflare Hosting

Run the adapted OpenClaw environment using Cloudflare Workers and Sandbox containers.

⌘

AI Connectivity

Configure an AI provider or Cloudflare AI Gateway to process agent requests.

🔐

Protected Access

Use a gateway token, Cloudflare Access, and device pairing to control access.

Moltworker Deployment Requirements

Before deploying Moltworker, prepare the required Cloudflare account, development tools, and AI credentials. Having these ready will make the process easier.

1. Cloudflare Account

You need a Cloudflare account with a Workers Paid plan. Cloudflare Sandbox containers require the Paid plan. Container compute usage can create additional charges beyond the plan fee.

Open Cloudflare Dashboard ↗

2. Development Tools

  • Node.js installed on your computer.
  • npm for installing project dependencies.
  • Git for downloading the source repository.
  • Terminal, PowerShell, or another command-line application.
  • Wrangler CLI for Cloudflare deployment and management.

3. AI Provider Credentials

You need an Anthropic API key for direct Claude access, or the appropriate credentials for the Cloudflare AI Gateway configuration you choose.

Anthropic Console ↗

Cost planning: Do not assume that a $5 Workers Paid plan is the total monthly cost. Sandbox compute, AI provider usage, storage, and other services may add charges. Check the current pricing before deployment.

How to Deploy Moltworker Step by Step

Follow these steps in order to deploy the official Moltworker project. Commands below are based on the current official repository Quick Start.

01

Download the Official Moltworker Repository

First, download the source code from Cloudflare's official GitHub repository. Open your terminal and run:

Git command
git clone https://github.com/cloudflare/moltworker.git
cd moltworker

The first command downloads the project. The second command moves your terminal into the newly created project folder.

Always use the official repository to avoid deploying an unknown or modified copy of the project.

View the official Moltworker repository ↗
02

Install the Required Dependencies

After entering the project directory, install the required packages using npm:

npm install

npm reads the project's package configuration and installs the dependencies needed to build and deploy the application.

Wait until the installation process finishes. If an error appears, check your Node.js version, npm installation, and the repository's current requirements.

03

Authenticate with Cloudflare

Wrangler needs permission to deploy resources to your Cloudflare account. Run the login command:

npx wrangler login

Your browser should open a Cloudflare authentication page. Sign in to the correct account and authorize Wrangler.

After authentication, return to your terminal and continue with the project configuration.

Wrangler documentation ↗
04

Configure Your AI Provider

Moltworker needs an AI provider to generate responses. The official Quick Start documents direct Anthropic access and an alternative Cloudflare AI Gateway configuration.

Option A: Direct Anthropic API Access

If you want to use Anthropic directly, run:

npx wrangler secret put ANTHROPIC_API_KEY

Wrangler will prompt you to enter your API key. Paste the key securely and complete the command.

Option B: Cloudflare AI Gateway

If you choose the native AI Gateway configuration, add the required secrets using the current variable names:

npx wrangler secret put CLOUDFLARE_AI_GATEWAY_API_KEY
npx wrangler secret put CF_AI_GATEWAY_ACCOUNT_ID
npx wrangler secret put CF_AI_GATEWAY_GATEWAY_ID

Enter the corresponding values when prompted. The API key and gateway settings must match your selected provider and authentication method.

Important: Some older deployment guides use AI_GATEWAY_API_KEY and AI_GATEWAY_BASE_URL. The current official repository documents the native configuration names shown above. Do not copy outdated commands without checking the latest README.

05

Generate a Secure Gateway Token

A gateway token is required for remote Control UI access. Generate a random token instead of using a simple password.

export MOLTBOT_GATEWAY_TOKEN=$(openssl rand -hex 32)

Save the generated token securely. Then store it as a Cloudflare Worker secret:

echo "$MOLTBOT_GATEWAY_TOKEN" | npx wrangler secret put MOLTBOT_GATEWAY_TOKEN

Security tip: Never publish your gateway token in a public repository, screenshot, or website article. Anyone with access to a valid token may be able to access the protected interface, subject to the other configured access controls.

06

Deploy Moltworker to Cloudflare

Once the dependencies, AI credentials, and gateway token are configured, you can deploy the project.

Deployment command
npm run deploy

The deployment script builds the project and runs the Wrangler deployment process. Wait for the command to complete successfully.

Wrangler will display the deployed Worker address. It normally uses a workers.dev subdomain unless you have configured another supported route.

First deployment: Keep your terminal open until the deployment process finishes. Do not close it while Wrangler is still building or publishing your Worker.

07

Open Your Deployed Control UI

After deployment, use the Worker URL shown by Wrangler. The official Quick Start provides this URL pattern:

https://your-worker.workers.dev/?token=YOUR_GATEWAY_TOKEN

Replace the example Worker subdomain and token with your actual values. The first request may take around one or two minutes while the Sandbox container starts.

Keep the complete URL private because it contains your gateway token. Do not share it in public posts or screenshots.

What to Do After Deployment

A successful Worker deployment is an important milestone, but it does not mean every feature is fully configured. Complete the relevant access and storage steps before using your AI agent regularly.

🔐

Cloudflare Access

Protect the administrative interface with an Access application and an appropriate allow policy.

Read the setup guide →
✓

Device Pairing

Review pending device requests and approve only devices you trust through the admin interface.

Learn about device pairing →
▣

R2 Persistence

Configure R2 if you need supported data and backups to persist across container restarts.

Configure persistent storage →

How to Verify Your Moltworker Deployment

Once deployment finishes, check that the Worker is reachable and that the required services are configured correctly.

Check Your Worker Secrets

Run this command to view the configured secret names:

npx wrangler secret list

This helps you identify whether expected secret names have been added. It does not display their private values.

Monitor Deployment Logs

Use Wrangler's live log command to investigate runtime issues:

npx wrangler tail

Review any error messages and compare them with the configuration required by the current repository.

Test the Control UI

  • Open the deployed Worker URL using the correct token.
  • Check whether the Control UI loads.
  • Complete Cloudflare Access authentication if configured.
  • Review and approve the device pairing request.
  • Send a simple test prompt to your AI agent.
  • Check the logs if the agent does not respond.

Common Moltworker Deployment Errors

Deployment problems can come from missing credentials, incorrect account settings, dependency issues, or configuration changes. Here are some common checks.

Deployment issue What to check
Wrangler authentication fails Run npx wrangler login and authorize the correct Cloudflare account.
Dependency installation fails Check Node.js, npm, network access, and the repository's package requirements.
Worker deployment fails Review the terminal error, Wrangler configuration, and Cloudflare account permissions.
AI agent does not respond Check the provider API key, gateway credentials, and selected model configuration.
Control UI access is denied Review the gateway token, Cloudflare Access policy, and required Access secrets.
Container takes time to start Allow time for the Sandbox to initialize and inspect the Worker logs.
Configuration changes do not appear Confirm that the updated secrets or project files were deployed successfully.

Windows users: If a shell script fails with an error such as exit code 126, check Git line endings. The official repository documents a possible CRLF issue and recommends using appropriate LF line endings.

For version-specific problems, check the official Moltworker repository and its current issues.

Moltworker Deployment Cost Considerations

The cost of deploying Moltworker depends on the Cloudflare plan, container runtime, AI provider, and optional services you enable. The Workers Paid plan is required for Sandbox containers, but it should not be treated as the complete cost of running an always-active agent.

Workers Paid Plan

The official repository lists a $5 USD monthly starting plan requirement for Cloudflare Sandbox containers. Check current plan details.

Container Compute

Running the Sandbox container consumes resources and can create additional usage charges.

AI Model Requests

AI provider requests may be billed separately based on the model and your usage.

For accurate estimates, check the current Cloudflare Workers pricing documentation and your selected AI provider's pricing before deployment.

Moltworker Deployment Checklist

Use this checklist to review the main deployment tasks.

Cloudflare account prepared
Workers Paid plan checked
Node.js and npm installed
Git installed
Official repository cloned
Dependencies installed
Wrangler authenticated
AI provider configured
Gateway token generated
Worker deployed successfully
Control UI tested
Access and pairing reviewed

Frequently Asked Questions

What is Moltworker deployment?

Moltworker deployment is the process of installing and running the Cloudflare Moltworker project so an OpenClaw-based AI agent can operate inside Cloudflare Sandbox infrastructure.

How do I deploy Moltworker on Cloudflare?

Start by cloning the official repository, installing dependencies with npm, configuring your AI provider and gateway token, and running the project's deployment command. Then follow the repository instructions for remote access and security.

Do I need a Workers Paid plan to deploy Moltworker?

Yes. The official repository lists a Cloudflare Workers Paid plan as a requirement for Sandbox containers. Additional container compute costs may apply.

Can I deploy Moltworker without a Mac Mini?

Yes. The Cloudflare deployment approach runs the adapted OpenClaw runtime in Cloudflare Sandbox containers, so you do not need a dedicated Mac Mini to host the agent. You still need a computer to manage the deployment.

Which AI provider can I use with Moltworker?

The official Quick Start documents direct Anthropic access and Cloudflare AI Gateway configuration. Check the current repository for supported provider options and model configuration.

How long does Moltworker deployment take?

Deployment time depends on your computer, network, dependency installation, and Cloudflare environment. The first request can take longer while the Sandbox container starts. There is no guaranteed deployment time for every environment.

Is Moltworker deployment free?

No. A Workers Paid plan is required for Sandbox containers, and compute and AI usage may add further costs. Check current pricing before deploying.

Is Moltworker production-ready?

Cloudflare describes the project as an experimental proof of concept rather than an officially supported product. Review its limitations and security requirements before using it for important workloads.

Where can I find the official Moltworker deployment instructions?

The official Cloudflare Moltworker GitHub repository contains the latest Quick Start, configuration details, and project updates.

Ready to Deploy Moltworker?

Start with the official source code, prepare your Cloudflare account, and follow the deployment process carefully. Always check the latest repository instructions before making changes to your environment.

Open Official GitHub Repository ↗