This guide is based on the official Cloudflare Moltworker repository (https://github.com/cloudflare/moltworker), which allows you to run OpenClaw (formerly Moltbot/Clawdbot) as a self-hosted personal AI agent on Cloudflare Workers. The setup uses Cloudflare's Sandbox containers for execution, with optional persistence via R2 storage. I've adapted the instructions to use the Cloudflare dashboard UI exclusively for setting secrets and configurations (no Wrangler CLI). Note that as of February 2026, some Cloudflare dashboard navigation paths have been updated for better integration with Zero Trust (formerly Cloudflare Access), and I've incorporated the latest from the repo's README and related documentation. The process involves prerequisites, deployment, security setup, storage configuration, and testing. Expect the full setup to take 30-60 minutes, with some waiting time for deployments and container startups.
Before starting, ensure you have everything ready. These are required for deployment and operation.
-
Create or Log In to a Cloudflare Account:
- Go to https://dash.cloudflare.com/signup or log in at https://dash.cloudflare.com/login.
- Verify your email and set up two-factor authentication (2FA) if prompted—it's highly recommended for security.
-
Upgrade to a Workers Paid Plan:
- In the Cloudflare dashboard (https://dash.cloudflare.com), navigate to Workers & Pages > Overview.
- If you're on the free plan, click Upgrade plan or go to Account > Subscriptions > Workers Paid (costs $5 USD/month minimum, plus usage-based fees for Sandbox containers—estimate ~$34.50/month for 24/7 operation on a standard-1 instance, or less with sleep settings).
- Enter payment details and confirm. This enables Sandbox containers, which are essential for running the AI agent.
-
Add an R2 Subscription:
- From the dashboard, go to R2 > Overview.
- If not subscribed, click Add R2 Subscription (it's free with a generous tier: 10 GB storage, 1 million read/write operations per month).
- Confirm the addition (no cost unless you exceed free limits). This is required even if you skip persistence initially, as the deploy button may prompt for it.
-
Obtain an Anthropic API Key:
- Log in to the Anthropic dashboard at https://console.anthropic.com/.
- Navigate to API Keys > Generate New Key.
- Name it something like "Moltworker" and copy the key (it starts with
sk-ant-). Save it securely—you won't see it again. - Note: Top up your Anthropic account with credits if needed (e.g., $10-20 to start), as the AI model (Claude) requires them. Alternatively, you can use Cloudflare's AI Gateway for unified billing (free tier available), but this guide assumes direct Anthropic access for simplicity.
-
Generate a Gateway Token:
- This is a secure password for accessing the control UI.
- Use a secure method to generate a 32-byte hex string. For example:
- On macOS/Linux: Open a terminal and run
openssl rand -hex 32. - On Windows: Use PowerShell with
[guid]::NewGuid().ToString("N")or an online generator like https://www.grc.com/passwords.htm (ensure it's secure).
- On macOS/Linux: Open a terminal and run
- Copy the generated token (e.g., a long string like
a1b2c3d4...) and save it securely. You'll need it during deployment and for UI access.
-
Set Up a GitHub Account:
- If you don't have one, sign up at https://github.com/signup.
- You'll need this to fork or connect the repository during deployment.
Use the one-click deploy button on the repo for initial setup. This creates the Worker, connects GitHub, sets up an R2 bucket, and injects initial secrets.
-
Go to the Moltworker GitHub Repository:
-
Click the Deploy to Cloudflare Button:
- Look for the Deploy to Cloudflare or Deploy with Workers button (it's typically a purple button near the top of the README).
- Click it to start the deployment wizard.
-
Log In and Authorize:
- Log in to Cloudflare if prompted (use the same account from Step 1).
- Verify as human (CAPTCHA) and confirm 2FA.
- Connect your GitHub account: Click Connect GitHub > Install & Authorize on your personal GitHub account or organization.
- Authorize Cloudflare to access repositories (enable 2FA on GitHub if prompted).
-
Configure Deployment Options:
- Repository: Create a new private repository (recommended for security—name it something like "moltworker-sandbox").
- R2 Bucket: Check Create new R2 bucket (default name like "moltbot-data" is fine).
- Location Hint: Optional—select your region (e.g., Asia-Pacific) for better performance.
- Anthropic API Key: Paste the key from Step 1.4.
- Gateway Token: Paste the token from Step 1.5.
- Advanced settings: Leave defaults unless you want to customize (e.g., enable AI Gateway instead of direct Anthropic).
- Click Create and Deploy.
-
Wait for Deployment:
- This may take 1-5 minutes. If you see errors about R2 or paid plans, refresh the page or ensure Steps 1.2-1.3 are complete, then retry.
- Once done, note your Worker URL (e.g., https://moltworker-sandbox..workers.dev). You'll use this for access.
This secures the admin UI with Zero Trust. As of 2026, Cloudflare Access is integrated into Zero Trust—enable the free plan if not already active.
-
Enable Zero Trust (if Needed):
- Go to https://dash.teams.cloudflare.com (Zero Trust dashboard).
- If prompted, select the Zero Trust Free Plan > Review and Purchase (cost: $0).
- Confirm and return to the main dashboard.
-
Enable Cloudflare Access on Your Worker:
- In the Cloudflare dashboard, go to Workers & Pages > Overview > Select your Worker (e.g., "moltworker-sandbox").
- Navigate to Settings > Domains & Routes.
- Find your route (e.g., *.workers.dev) and click the three-dot menu (meatballs icon) > Enable Cloudflare Access.
- In the popup, click Manage > Add your email to the allow list (e.g., your login email).
- Configure identity providers if needed (default: One-time PIN via email).
- Copy the Application Audience (AUD) Tag (a string like "abc123...") and JWKs URL (though you may not need the latter).
- Dismiss the popup.
-
Find Your Team Domain:
- In the Zero Trust dashboard (https://dash.teams.cloudflare.com), go to Settings > Custom Pages.
- Look for your team domain (e.g., https://.cloudflareaccess.com). If not visible, attempt a login to your Worker URL in an incognito window—it will show the domain in the login popup.
-
Add Access Secrets via UI:
- Back in your Worker settings: Settings > Variables & Secrets > Secrets tab > Add a secret.
- Add
CF_ACCESS_AUD: Paste the AUD tag from Step 3.2. - Add
CF_ACCESS_TEAM_DOMAIN: Paste the team domain from Step 3.3 (e.g., "https://your-team.cloudflareaccess.com"). - Click Deploy at the top to apply changes (takes ~30 seconds).
Without this, data (e.g., chat history) is lost on restarts. This is optional but advised for production use.
-
Create an R2 API Token:
- Go to R2 > Overview > Manage R2 API Tokens (updated path as of 2026; if not found, search for "API Tokens" in the dashboard).
- Click Create API Token > Permissions: Object Read & Write > Apply to: Specific buckets > Select your bucket (e.g., "moltbot-data").
- TTL: No expiration > Create.
- Copy the Access Key ID and Secret Access Key. Save them securely.
-
Find Your Cloudflare Account ID:
- In the dashboard, go to Account Home > Right sidebar > Copy Account ID (a 32-character hex string).
-
Add R2 Secrets via UI:
- In your Worker settings: Settings > Variables & Secrets > Secrets tab > Add a secret.
- Add
R2_ACCESS_KEY_ID: Paste the Access Key ID. - Add
R2_SECRET_ACCESS_KEY: Paste the Secret Access Key. - Add
CF_ACCOUNT_ID: Paste your Account ID. - Click Deploy to apply (data will sync every 5 minutes via cron; manual backup available in admin UI).
-
Open the Control UI:
- Visit https://.workers.dev/?token=.
- First load may take 1-2 minutes (container startup). If it disconnects, refresh.
-
Handle Pairing and Admin UI:
- If prompted for pairing: Open the admin UI at https://.workers.dev/_admin/ (after logging in via email code).
- Approve your device in the Pending Paired Devices section.
- R2 status should show as configured; if not, check secrets and redeploy.
-
Test the AI Agent:
- In the UI, start a new session and send a message (e.g., "Hello").
- Check logs in Observability for errors. If no response, verify Anthropic credits or API key.
- Test security: In an incognito window without your email, access should fail (no code sent).
- Optional: Add channel integrations (e.g., Telegram) by adding secrets like
TELEGRAM_BOT_TOKENvia UI and redeploying.
- Deployment Errors: Refresh pages or retry after enabling plans. Check Worker logs in Workers & Pages > Your Worker > Logs.
- Container Costs: Add secret
SANDBOX_SLEEP_AFTER= "10m" to sleep after inactivity (reduces bills). - Updates: The repo was last updated in early February 2026 with rclone for R2 and OpenClaw upgrades—pull changes via GitHub integration if needed.
- Support: If stuck, check the repo's issues or Cloudflare docs at https://developers.cloudflare.com/workers/. For UX issues, the blog notes this is a proof-of-concept.
This setup gives you a secure, cloud-hosted AI agent. If you need expansions (e.g., AI Gateway or browser automation), add the relevant secrets via UI.