Full record of building the self-hosted AI agent “Moltworker” on Cloudflare

Written by
John Doe
Published on
2026-01-31

table of contents

Full record of building the self-hosted AI agent “Moltworker” on Cloudflare

Entering 2026, AI assistants are no longer rare. However, in the end, every service depends on the cloud, and I honestly don't really understand where my data is or how it is being used. What I found when I was in such a mess was “Moltworker,” which Cloudflare has published as open source.

MoltWorker is a project that makes it possible to run a personal AI assistant called OpenClaw (formerly called Moltbot) without a dedicated machine like a Mac mini. Since Cloudflare's edge computing platform is used, there is no need to prepare your own server. I thought it would be interesting, so I actually built it, so I'll leave that process behind.

Things to prepare before building

First of all, as an assumption, a Cloudflare Workers paid plan ($5 per month) is required to run Moltworker. This is to use a container execution environment called Cloudflare Sandbox. After that, I'll also prepare an Anthropic API key.

I started by cloning the repository from GitHub and installing dependencies.

git clone https://github.com/cloudflare/moltworker.git
CD Moltworker
npm install

Next, log in to Cloudflare with Wrangler. The browser opens and an authentication is requested, but the first attempt timed out. When I did it again, it went through, so it's probably just that the network wasn't working well. There is no point in worrying about this kind of temporary trouble.

Authentication information is stored with Cloudflare's secret management function. First, a gateway token for remote access was generated.

export MOLTBOT_GATEWAY_TOKEN=$ (openssl rand -hex 32)

This token is used to access Control UI. You'll need it later, so you have to keep it down somewhere.

How to set an Anthropic API keyWrangler secret putUse it. The mechanism is that values are encrypted and stored in Cloudflare. At this point, there is no Worker yet, so I'm asked if I want to create a new one, but there is no problem with Yes.

Docker wasn't in

Now, when I was excited that it was finally time to deploy, I suddenly stumbled. An error called “The Docker CLI could not be considered” came up.

It's natural if you think about it, Moltworker needs to build a container, so it won't work without Docker locally. When I checked, sure enough, Docker Desktop wasn't included. I tried to install it with Homebrew, but sudo permission was requested and I ended up typing my password in the terminal.

Brew install --cask Docker

After installation, start Docker Desktop and wait until the daemon is fully started.Docker infoI checked the operation and then moved on.

Repeated deployments, errors, and checks

Now that Docker is ready, run the deployment again. However, this was where the real test began.

The first error that came up was “Please enable R2 through the Cloudflare Dashboard”. R2 is Cloudflare's object storage and is used to store Moltworker data. I went to the dashboard and activated R2. There's a free tier, so there's no additional charge for regular use.

When I enabled R2 and tried again, it was said “You need a workers.dev subdomain” this time. It seems that it is automatically created when you open the Workers & Pages page. However, the Cloudflare dashboard was renewed, and it was necessary to search for “Workers & Pages” in the section called “Compute & AI.” If you're not used to it, you'll get lost.

Now that the subdomain is ready, deploy it again. The build progressed smoothly, and the Docker image was built, pushed to the Cloudflare registry, and “Unauthorized” at the very end.

When I looked it up, a Workers paid plan was essential in order to use the Containers function. I subscribed to the $5 monthly plan from the “Containers” page on the dashboard and finally moved on.

Deployment was successful, but it's not over yet

After upgrading to a paid plan, the deployment was an easy success. The new Worker URL is displayed in the console.

https://moltbot-xxxxxxx.workers.dev

But that wasn't the end of it. There are still settings left for security and data persistence.

Configure Cloudflare Access to protect the Admin UI. Select a worker that has already been deployed in Workers & Pages, search for the workers.dev line from Settings > Domains & Routes, and select “Enable Cloudflare Access.” Two values, team domain and application audience (AUD), are required for Access settings, and AUD can be obtained from the Access settings screen, and team domains can be checked on the Zero Trust dashboard.

npx wrangler secret put CF_ACCESS_AUD
npx wrangler secret put CF_ACCESS_TEAM_DOMAIN

Since there is a possibility that data will disappear when the container is restarted, cooperation with R2 storage is also important. An API token was newly created on the R2 dashboard, and permissions were limited to “Object Read & Write” and the target bucket to “moltbot-data.” The generated Access Key ID and Secret Access Key, and then the Cloudflare account ID are registered as secrets.

npx wrangler secret put R2_ACCESS_KEY_ID
npx wrangler secret put R2_SECRET_ACCESS_KEY
npx wrangler secret put CF_ACCOUNT_ID

Another error on initial access

Once you've made all the settings, it's time to access Control UI. Attach a gateway token to the URL as a query parameter.

https://moltbot-xxxxxxx.workers.dev/?token = <GATEWAY_TOKEN>

The moment I opened it, an error called “Configuration Required” appeared. It is said that ANTHROPIC_API_KEY is not recognized. When I reviewed the list of secrets, I noticed that the variable name and value were entered in reverse at the time of setting. it was my own mistake. Set it back up correctly and then redeploy.

When I accessed it again, “Required Required” was displayed this time. This is a security function, and administrator approval is required for connections from a new device. I went to Admin UI (/_admin/path) and approved my device from Pending Requests.

After approving it, I went back to Control UI and reloaded, and finally the chat screen appeared. When I sent “hello” as a test, they introduced themselves back in English. If you give instructions to return in Japanese, you will be able to converse in Japanese thereafter.

What I think when I look back

What I felt during this construction was the high degree of integration of the Cloudflare ecosystem. Multiple services such as Workers, R2, Access, and Containers are seamlessly connected. However, there are many services that must be enabled in the initial settings for that amount, and deployment fails if even one is missing. I think the error message is kind, but if you're not used to the dashboard configuration, it takes time and effort to find the corresponding settings screen.

You also need to be careful about managing secrets.Wrangler secret putis designed to interactively input values, but if scripted, values can also be passed through pipes. However, care must be taken not to confuse the variable name with the value. I actually did it.

Also, it's easy to overlook the existence of Docker. The Cloudflare Sandbox is a serverless container environment, but images are built locally. If you check beforehand whether Docker is in the development machine, it will proceed smoothly.

Get your own personal AI for $5 a month

To be honest, building self-hosted AI with MoltWorker wasn't easy. But once you set it up, you can get an environment where your own AI assistant runs all the time. The data is stored on Cloudflare's infrastructure, and session information is maintained even when the container is restarted in cooperation with R2.

I think it's quite attractive to be able to put personal AI on enterprise-grade infrastructure for $5 per month. For people who are concerned about privacy or who want to fiddle with AI assistants according to their own preferences, I think it's worth considering.

Relation

関連記事

This is some text inside of a div block.

Full record of building the self-hosted AI agent “Moltworker” on Cloudflare

This is some text inside of a div block.
7 min read
This is some text inside of a div block.

I dissected all pages of the “Textbook on Psychological Manipulation” that arrived in the mail -- the invisible design of sales letters deciphered with behavioral economics

This is some text inside of a div block.
7 min read
This is some text inside of a div block.

Claude Code User Guide 2025 Latest Edition/From Introduction to Application

This is some text inside of a div block.
7 min read
This is some text inside of a div block.

Google's NotebookLM is finally integrated with Gemini, and AI research tools enter a new era

This is some text inside of a div block.
7 min read
This is some text inside of a div block.

Will Google's new weapon “Titans” dramatically change AI's memory? Approaching the mystery of long-term memory that surpasses Transformers

This is some text inside of a div block.
7 min read
This is some text inside of a div block.

Thorough explanation of how to use Google Antigravity | Towards an age where anyone can develop apps with AI

This is some text inside of a div block.
7 min read
This is some text inside of a div block.

When I made an AI that automatically writes medical articles, it hit an unexpected wall

This is some text inside of a div block.
7 min read
This is some text inside of a div block.

A story about how I decided to quit “round throwing” on that day when advertising expenses of 4 million yen a month disappeared

This is some text inside of a div block.
7 min read
This is some text inside of a div block.

Let's talk about the case where the new features announced at Webflow Conf 2025 are dangerous from a field perspective

This is some text inside of a div block.
7 min read
This is some text inside of a div block.

[Breaking News] Claude Code on the Web is here! Next-generation AI coding starting with browsers and smartphones has arrived!

This is some text inside of a div block.
7 min read
This is some text inside of a div block.

A story about the “future” of web production that I felt when I participated in Webflow Conf 2025

This is some text inside of a div block.
7 min read
This is some text inside of a div block.

Do Google Business Profile Posts Really Increase Search Rankings? Explain survey results in an easy-to-understand manner

This is some text inside of a div block.
7 min read
This is some text inside of a div block.

I tried making use of Hawkins's author “Power or Force” on the sales page

This is some text inside of a div block.
7 min read
This is some text inside of a div block.

The complete guide to MCP Toolbox for Databases! An innovative tool to securely link AI agents with databases

This is some text inside of a div block.
7 min read
This is some text inside of a div block.

The future that Google's ApertureDB will change! Understanding the Next Generation Database Revolution with Familiar Examples

This is some text inside of a div block.
7 min read
This is some text inside of a div block.

Google's latest technology “MUVERA”! A new-age algorithm that fundamentally changes the search experience

This is some text inside of a div block.
7 min read
This is some text inside of a div block.

SEO strategies in the AI era! In response to the evolution of search engines, I will talk about the importance of GEO using the example of attracting customers to treatment centers

This is some text inside of a div block.
7 min read
This is some text inside of a div block.

AI is changing advertising! Google AI Max for Search Campaign and the Future of Advertising

This is some text inside of a div block.
7 min read
This is some text inside of a div block.

What is query fan-out? The future of search changed by Google's AI Mode and how to understand it with familiar examples

This is some text inside of a div block.
7 min read
This is some text inside of a div block.

What is the new trend “LLMO countermeasures” in the generative AI era? Essential strategies for your website to survive

This is some text inside of a div block.
7 min read
This is some text inside of a div block.

What content is being read and evaluated? Learn the secrets of SEO writing from search intent

This is some text inside of a div block.
7 min read
This is some text inside of a div block.

[Actual experience] Production time reduced to 1/3 with Webflow AI! The new common sense of creating “sellable” sites without code

This is some text inside of a div block.
7 min read
This is some text inside of a div block.

How to Learn Web Production Efficiently - Optimal Learning Methods Based on Brain Science

This is some text inside of a div block.
7 min read
This is some text inside of a div block.

Do I need coding with Webflow? Thorough explanation of what can and cannot be done with No Code

This is some text inside of a div block.
7 min read
This is some text inside of a div block.

The secret to effective ad copywriting that puts consumer sentiment on your side

This is some text inside of a div block.
7 min read
This is some text inside of a div block.

[GA4 alone isn't enough?] A thorough comparison of eBIS vs Usermaven access analysis tools!

This is some text inside of a div block.
7 min read
This is some text inside of a div block.

One way to transform marketing! Efficiency and automation realized by linking Webflow and Clay

This is some text inside of a div block.
7 min read
This is some text inside of a div block.

Elementor Pro Complete Utilization Guide 2025! Thorough explanation from customization to operation

This is some text inside of a div block.
7 min read
This is some text inside of a div block.

How to automatically calculate and display article reading time with Webflow CMS

This is some text inside of a div block.
7 min read
This is some text inside of a div block.

No more hesitation! How to increase site customer attraction with Webflow SEO measures

This is some text inside of a div block.
7 min read
This is some text inside of a div block.

[2024 update] What is GSAP? The Future of Animation Production Will Change with Webflow Integration | Full Explanation

This is some text inside of a div block.
7 min read
This is some text inside of a div block.

WordPress challenges and WebFlow benefits! The results of analyzing the benefits of migration...

This is some text inside of a div block.
7 min read
This is some text inside of a div block.

Extract data from your entire website with Firecrawl! Thorough explanation of basic understanding and usage

This is some text inside of a div block.
7 min read
This is some text inside of a div block.

[Latest Edition] Must-See Plugins List to Power Up Your Webflow Site

This is some text inside of a div block.
7 min read
This is some text inside of a div block.

[2024 Edition] Explaining how to use Elementor for beginners! Build a full-scale site with WordPress

This is some text inside of a div block.
7 min read
This is some text inside of a div block.

[Website production cost] Market price and breakdown as seen from actual examples

This is some text inside of a div block.
7 min read
This is some text inside of a div block.

Even beginners can earn 50,000 a month! How to start web production as a side job?

This is some text inside of a div block.
7 min read
This is some text inside of a div block.

Use your AI skills as a side job! 11 ways that even beginners can challenge are revealed to the public

This is some text inside of a div block.
7 min read
This is some text inside of a div block.

Realized with no-code technology! What future entrepreneurs should know about digital innovation

This is some text inside of a div block.
7 min read
This is some text inside of a div block.

[From price to features] Comparative analysis between WebFlow and Studio! Which one should I choose?

This is some text inside of a div block.
7 min read
This is some text inside of a div block.

Get creative freedom with the Webflow code output feature

This is some text inside of a div block.
7 min read
This is some text inside of a div block.

Basic usage and features of Microsoft Copilot Studio

This is some text inside of a div block.
7 min read
This is some text inside of a div block.

How to create a concept - the secrets of design that captivates customers

This is some text inside of a div block.
7 min read
This is some text inside of a div block.

This is all you need to read to create a piano classroom website! Strategies for success and 5 case studies

This is some text inside of a div block.
7 min read
This is some text inside of a div block.

New OpenAI feature: GPT customization

This is some text inside of a div block.
7 min read
This is some text inside of a div block.

Beginner's Guide to Prompt Engineering

This is some text inside of a div block.
7 min read
This is some text inside of a div block.

Build a website with Webflow! Anyone can easily create a site without coding

This is some text inside of a div block.
7 min read
This is some text inside of a div block.

Advantages of UI design using Webflow

This is some text inside of a div block.
7 min read
This is some text inside of a div block.

The Evolution of Webflow: New Possibilities for Design, Development, and Collaboration

This is some text inside of a div block.
7 min read
This is some text inside of a div block.

Applied Skills in the AI Era: Experience Strategy and Prompt Design

This is some text inside of a div block.
7 min read
This is some text inside of a div block.

Powering up your website with Webflow: Fivetran customer stories

This is some text inside of a div block.
7 min read
This is some text inside of a div block.

How to create a website to express yourself

This is some text inside of a div block.
7 min read
This is some text inside of a div block.

Responding to a Changing Market: A Global Consulting Firm's Perspective

This is some text inside of a div block.
7 min read

Let's start with a free consultation

I'm very sorry. Our resources are limited, and in order to provide high quality services to each company, we are currently offering this special condition (full refund guarantee+free consultation), limited to [first 5 companies per month].

Furthermore, only for those who have applied for a free consultation, we will give you a free “competitor site analysis & improvement proposal report” usually worth 50,000 yen only for those who have applied for a free consultation.

There is a possibility that the slots will fill up quickly, so please apply as soon as possible.

I agree to the privacy policy and first conduct a free consultation
Thank you! Your submission has been received!
Oops! Something went long while appearing the form.