Claw Mart
← Back to Blog
February 18, 20269 min readClaw Mart Team

How to Run OpenClaw on Cloudflare (Moltworker) — No Server Needed

Cloudflare built middleware specifically for running OpenClaw on their Developer Platform. No hardware needed. Here's how to deploy in minutes.

How to Run OpenClaw on Cloudflare (Moltworker) — No Server Needed

Let me save you some time: you don't need a server to run OpenClaw. You don't need AWS. You don't need to babysit a $20/month VPS that you'll forget about until the credit card bill comes. You can deploy an OpenClaw agent to Cloudflare's edge network using Moltworker, and the whole thing takes about fifteen minutes if you type slowly.

I'm going to walk you through the entire process — from zero to a globally distributed, always-on AI agent running on Cloudflare's infrastructure. We'll cover setup, configuration, deployment, costs, and how to connect it to Telegram so your agent is actually useful to someone other than you curling localhost in a terminal.

Let's get into it.


Why This Matters

If you've been building with OpenClaw, you already know the platform is the most flexible way to spin up AI agents that actually do things — not just chat, but execute workflows, call APIs, process data, and plug into the tools your business already uses. The problem has always been deployment. You build the agent, it works beautifully in development, and then you stare at the screen wondering where to put it.

Traditional options suck for this use case. A full server is overkill for most agents. Lambda functions have cold start problems. And if you're running something that needs to respond to webhooks from Telegram or Slack or your own frontend, you need something that's always warm, globally distributed, and cheap enough that you don't think twice about it.

That's where Cloudflare Workers come in. And Moltworker is how you get your OpenClaw agent onto them without losing your mind.


What Moltworker Actually Is

Moltworker is the deployment bridge between OpenClaw and Cloudflare's Developer Platform. Think of it as the middleware layer that handles the translation between your OpenClaw agent configuration and what Cloudflare Workers actually need to execute.

Here's the core idea: OpenClaw defines your agent — its logic, its tools, its personality, its API connections. Moltworker takes that definition, wraps it in a Workers-compatible runtime, handles the bindings to Cloudflare services (KV for state, AI for inference, R2 for storage), and deploys the whole package to Cloudflare's edge network. The result is your OpenClaw agent running on over 300 data centers worldwide with sub-10ms cold starts.

You don't configure Cloudflare directly. You don't write Workers boilerplate. Moltworker handles the plumbing. You focus on the agent.


What You Need Before Starting

Let's get the prerequisites out of the way:

  • An OpenClaw account. If you don't have one, head to the OpenClaw listing on Claw Mart and get set up. You'll need at least the Builder tier to export agent configurations for deployment.
  • A Cloudflare account. Free tier works fine for development and low-traffic production. Sign up at dash.cloudflare.com/sign-up.
  • Node.js v18+ installed on your machine.
  • Wrangler CLI — Cloudflare's deployment tool. Moltworker uses it under the hood.
  • Your OpenClaw agent ID. You'll find this in your OpenClaw dashboard under Agent Settings.

That's it. No Docker. No Kubernetes. No infrastructure degree.


Step 1: Install the Tooling

Open your terminal and install both Wrangler and the Moltworker package:

npm install -g wrangler
npm install -g @openclaw/moltworker

Now authenticate with Cloudflare:

wrangler login

This opens your browser. Approve the OAuth request. You're done.

Next, authenticate with OpenClaw:

moltworker auth

This links your local environment to your OpenClaw account. It stores your API key in your system keychain — not in a dotfile, not in plaintext, not in a place where you'll accidentally commit it to GitHub and spend the next two hours rotating credentials.


Step 2: Initialize Your Project

Navigate to wherever you keep your projects and run:

moltworker init my-agent
cd my-agent

This creates a project directory with the following structure:

my-agent/
├── moltworker.toml
├── src/
│   └── index.js
├── wrangler.toml
└── package.json

The key file is moltworker.toml. Open it:

[agent]
id = "your-openclaw-agent-id"
name = "my-agent"

[deployment]
platform = "cloudflare-workers"
region = "global"

[bindings]
ai = true
kv = true
r2 = false

[triggers]
http = true
cron = false
websocket = false

Replace your-openclaw-agent-id with your actual agent ID from the OpenClaw dashboard. If your agent uses file storage (PDFs, images, etc.), flip r2 to true. If you want scheduled runs (like a daily summary agent), set cron = true.

The src/index.js file is pre-populated with the Moltworker runtime. You generally don't need to touch it unless you want custom middleware. Here's what the default looks like:

import { MoltworkerRuntime } from '@openclaw/moltworker';

const runtime = new MoltworkerRuntime();

export default {
  async fetch(request, env, ctx) {
    return runtime.handle(request, env, ctx);
  },

  async scheduled(event, env, ctx) {
    return runtime.handleScheduled(event, env, ctx);
  }
};

That's the entire application. The MoltworkerRuntime class pulls your agent configuration from OpenClaw, manages state through KV bindings, routes incoming requests to the right agent workflows, and returns responses. All the complexity lives in the runtime package and your OpenClaw agent definition — not in deployment code.


Step 3: Configure Your Wrangler Settings

The wrangler.toml file is auto-generated, but you should review it:

name = "my-agent"
main = "src/index.js"
compatibility_date = "2025-06-01"
compatibility_flags = ["nodejs_compat"]

[ai]
binding = "AI"

[[kv_namespaces]]
binding = "AGENT_STATE"
id = ""

[vars]
OPENCLAW_AGENT_ID = "your-openclaw-agent-id"

The KV namespace ID is blank because we need to create it. Run:

wrangler kv namespace create AGENT_STATE

Copy the output ID and paste it into wrangler.toml. This KV namespace is where your agent stores conversation state, user preferences, and any persistent data between requests. On the free tier, you get 100,000 reads and 1,000 writes per day — more than enough for most agents.

If you turned on R2 storage, also add:

[[r2_buckets]]
binding = "STORAGE"
bucket_name = "my-agent-files"

And create the bucket:

wrangler r2 bucket create my-agent-files

Step 4: Test Locally

Before deploying to the world, make sure it works:

moltworker dev

This wraps wrangler dev with OpenClaw-specific tooling. Your agent is now running at http://localhost:8787. Hit it with a test request:

curl -X POST http://localhost:8787/chat \
  -H "Content-Type: application/json" \
  -d '{"message": "What can you do?"}'

You should get back your agent's response, formatted according to whatever you configured in OpenClaw. If you get an error, check that your agent ID is correct and your OpenClaw API key is authenticated.

The local dev server supports hot reload. Change your agent configuration in the OpenClaw dashboard, and the local server picks it up on the next request. No restarts needed.


Step 5: Deploy

Ready? One command:

moltworker deploy

Under the hood, this runs wrangler deploy with the right flags, registers your worker endpoint with OpenClaw for webhook routing, and outputs your live URL:

✅ Deployed successfully!
🌐 https://my-agent.your-account.workers.dev
📊 Dashboard: https://dash.cloudflare.com/workers/my-agent

Your agent is now live on Cloudflare's global network. Someone in Tokyo and someone in São Paulo will both get sub-50ms responses. You didn't provision a single server.


Step 6: Connect Telegram

A live URL is nice, but most agents need a user-facing interface. Telegram is the fastest to set up, and OpenClaw has first-class support for it.

First, create a Telegram bot via @BotFather. Get your bot token.

Add it to your Moltworker config:

[integrations.telegram]
enabled = true

Set the token as a secret (never put API keys in config files):

wrangler secret put TELEGRAM_BOT_TOKEN

Paste your token when prompted. Now redeploy:

moltworker deploy

Moltworker automatically registers your Cloudflare Worker URL as the Telegram webhook endpoint. Open Telegram, find your bot, send a message. Your OpenClaw agent responds.

The entire flow: User sends message → Telegram sends webhook to your Worker → Moltworker runtime processes it through your OpenClaw agent → Response sent back to Telegram. Round trip is typically under 200ms for text responses, depending on agent complexity and which AI models you're calling.


Cost Breakdown

Here's the part everyone skips to. Let's talk money.

ComponentFree TierPaid Tier
Cloudflare Workers100,000 requests/day$5/mo for 10M requests, then $0.30/million
Workers KV100K reads/day, 1K writes/day$0.50/million reads, $5.00/million writes
Workers AI10,000 neurons/day$0.011/1K neurons (model-dependent)
R2 Storage10GB free$0.015/GB/month
OpenClawCheck Claw Mart for current pricingVaries by tier

For a personal project or small business bot handling a few hundred conversations a day, you're looking at $0/month on Cloudflare's side. The free tier is genuinely generous.

For a production agent handling 10,000+ daily conversations with AI inference on every request, budget roughly $15–40/month on Cloudflare, plus your OpenClaw subscription. Compare that to a dedicated server or even a managed container service and it's not close.

The key savings come from the serverless model: you pay per request, not per hour. If your agent gets zero traffic at 3 AM, you pay zero. If it gets a spike of 10,000 requests because someone shared it on Reddit, Cloudflare handles the scaling automatically and you pay for exactly 10,000 requests. No capacity planning. No auto-scaling groups. No Kubernetes cluster sitting idle burning money.


Connecting a Custom Domain

If you don't want your agent living at my-agent.your-account.workers.dev, connect a custom domain:

  1. Add your domain to Cloudflare (free plan works).
  2. In the Cloudflare dashboard, go to Workers & Pages → my-agent → Settings → Domains & Routes.
  3. Add your custom domain: agent.yourdomain.com.
  4. Cloudflare handles the SSL certificate automatically.

Your agent is now at https://agent.yourdomain.com. Professional. Clean. No "workers.dev" in the URL.


Adding Cron Triggers

Some agents need to run on a schedule — daily summaries, monitoring alerts, data aggregation. Update your moltworker.toml:

[triggers]
cron = true
cron_schedule = "0 9 * * *"  # Every day at 9 AM UTC

And your wrangler.toml:

[triggers]
crons = ["0 9 * * *"]

Redeploy with moltworker deploy. Your agent's handleScheduled method will fire every morning at 9 AM. Combine this with a Telegram integration, and you've got a bot that proactively sends you information without being asked. Daily market updates, project status reports, content digests — whatever your OpenClaw agent is configured to do.


Production Hardening

Before you send real traffic to this thing, a few things to configure:

Rate Limiting. Add Cloudflare's rate limiting rules in the dashboard to prevent abuse. A basic rule: 60 requests per minute per IP. Adjust based on your use case.

Error Handling. Moltworker wraps errors by default, but add a custom error handler in your moltworker.toml:

[error_handling]
fallback_message = "Something went wrong. Try again in a moment."
log_errors = true

Secrets Management. Never put API keys in wrangler.toml or moltworker.toml. Use wrangler secret put for everything sensitive:

wrangler secret put OPENCLAW_API_KEY
wrangler secret put TELEGRAM_BOT_TOKEN
wrangler secret put STRIPE_SECRET_KEY  # if your agent handles payments

Monitoring. Use wrangler tail for real-time logs during debugging. For production monitoring, Cloudflare's built-in analytics show request volume, error rates, and latency percentiles. OpenClaw's dashboard shows agent-level metrics — conversation counts, tool usage, error rates per workflow.


What to Build

Now that you know how to deploy, here's what people are actually building with OpenClaw on Cloudflare via Moltworker:

  • Customer support agents that connect to your help desk API and resolve tickets without human intervention.
  • Content generation pipelines that pull data from RSS feeds, generate summaries, and post to Slack or email.
  • E-commerce assistants that answer product questions, check inventory via API, and process simple orders.
  • Internal tools — agents that query your database, generate reports, and deliver them on a schedule.
  • Webhook processors that receive events from Stripe, GitHub, or Shopify and take intelligent action based on the payload.

All of these run on the free tier for low-to-moderate traffic. All of them deploy in minutes. All of them scale automatically if traffic spikes.


Where to Go From Here

You've got the deployment pipeline. Now it's about building the right agent.

Head to Claw Mart to browse OpenClaw and the ecosystem of tools, templates, and integrations that plug into it. If you're new to OpenClaw, start with one of the pre-built agent templates — there are templates for customer support, content generation, data analysis, and more. Customize from there rather than starting from scratch.

The key insight is this: the deployment part is solved. Moltworker and Cloudflare handle the infrastructure. OpenClaw handles the agent logic. Your job is to figure out what the agent should actually do — what problem it solves, what workflows it automates, what value it creates.

Stop thinking about servers. Start thinking about agents.

Deploy one today. You'll have it running globally in fifteen minutes, and you won't pay a dime until it's actually doing something useful.

Recommended for this post

Autonomous PR reviews, bug triage, code generation, and sprint management. Your agent becomes a senior engineer who never sleeps and never misses a CI failure.

Engineering
OO
Otter Ops Max
Buy

The skill every OpenClaw user needs. Gives your agent persistent memory across sessions — daily logs, long-term recall, and structured knowledge that survives restarts. Less than a coffee.

Productivity
OO
Otter Ops Max
Buy

Sentry error comes in, AI coding agent ships the fix, PR gets merged. Automatically.

Engineering
Felix CraftFelix Craft
Buy

More From the Blog