Learn how to configure Moltworker after deployment. Set up your AI model, secure the Control UI, connect messaging platforms, enable persistent storage, and customize your AI agent.
Deploying Moltworker is only the first part of getting your AI agent ready. After deployment, you need to configure the services that allow it to connect to an AI model, securely communicate with users, and retain important information.
Moltworker combines OpenClaw with Cloudflare's infrastructure. Its configuration can include AI provider credentials, Cloudflare Access, device pairing, R2 storage, messaging integrations, and browser automation.
Connect an AI provider or configure Cloudflare AI Gateway for model requests.
Access the dashboard and manage your AI agent through a browser.
Protect the interface with Cloudflare Access and approve trusted devices.
Use Cloudflare R2 to preserve configuration and conversation data.
Connect supported platforms such as Telegram, Discord, and Slack.
Configure browser-related capabilities using Cloudflare Browser Rendering.
Make sure your initial deployment is complete before following the configuration steps. You will need access to your Cloudflare account and the project files.
Important: Cloudflare's official Moltworker repository describes the project as an experimental proof of concept. It is not an officially supported Cloudflare product and may change or break without notice.
If you have not deployed Moltworker yet, follow our Moltworker Installation Guide first.
Follow these configuration steps to connect your AI provider, secure your dashboard, and enable the features you need.
Start by confirming that your project has been installed and deployed. Open your project directory in the terminal and check that the required packages are installed.
npm install
If you have already completed installation, you can move directly to the configuration steps. For deployment instructions, see the Moltworker installation tutorial.
Moltworker needs access to an AI model to process prompts and generate responses. You can configure direct provider access or use Cloudflare AI Gateway.
If you want to connect directly to Anthropic, add your API key as a Worker secret:
npx wrangler secret put ANTHROPIC_API_KEY
Enter your API key when prompted. Keep the key private and never publish it in frontend code or public repositories.
Cloudflare AI Gateway can route model requests and provide features such as analytics and request monitoring. Configure 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
The gateway API key is used for authentication with your upstream model provider. Follow the current repository instructions for the provider and billing method you choose.
You can optionally specify a model using:
npx wrangler secret put CF_AI_GATEWAY_MODEL
A model identifier uses the format
provider/model-id. Check the official repository for
currently supported providers and model identifiers.
Configuration note: Older guides may show
AI_GATEWAY_API_KEY and
AI_GATEWAY_BASE_URL. The current repository documents
CLOUDFLARE_AI_GATEWAY_API_KEY,
CF_AI_GATEWAY_ACCOUNT_ID, and
CF_AI_GATEWAY_GATEWAY_ID for its native AI Gateway setup.
The gateway token helps protect access to the Moltworker Control UI. Generate a strong random token instead of choosing a simple password.
export MOLTBOT_GATEWAY_TOKEN=$(openssl rand -hex 32) echo "$MOLTBOT_GATEWAY_TOKEN" | npx wrangler secret put MOLTBOT_GATEWAY_TOKEN
Store the generated token securely. You will need it when accessing the remote Control UI.
After adding the required secrets, deploy your updated Worker:
npm run deploy
Once deployment finishes, open your Worker URL. The first request may take a little longer while the container starts.
https://your-worker.workers.dev/?token=YOUR_GATEWAY_TOKEN
Replace the example domain and token with your actual Worker URL and securely stored gateway token. Do not share this URL with its authentication token publicly.
Cloudflare Access adds an authentication layer before users can reach the protected interface. This is an important security step for a remotely accessible AI agent.
After configuring the Access application, obtain its team domain and Application Audience (AUD) value.
Add them as Worker secrets:
npx wrangler secret put CF_ACCESS_TEAM_DOMAIN npx wrangler secret put CF_ACCESS_AUD
Deploy the updated configuration:
npm run deploy
Security reminder: Do not rely only on the gateway token. Follow the official Cloudflare Access configuration for remote dashboard access.
Device pairing allows you to approve devices that connect to your Moltworker instance. When a new device requests access, it may appear as pending until you approve it.
/_admin/ route.Allow a short time for newly requested devices to appear in the admin interface. Never approve an unfamiliar device automatically.
Persistent storage helps protect your configuration and conversation data when the sandbox container restarts. Without R2, some data stored inside the container can be lost after a restart.
Create an R2 bucket in your Cloudflare account and generate the required credentials. Then configure the following secrets:
npx wrangler secret put R2_ACCESS_KEY_ID npx wrangler secret put R2_SECRET_ACCESS_KEY npx wrangler secret put CF_ACCOUNT_ID
Enter the corresponding values when prompted. Keep your R2 credentials private.
The repository includes automatic backup functionality. Check the admin interface for R2 status and available backup controls.
Remember: R2 configuration and backup behavior should be verified in your deployed environment. The repository documents that R2 functionality is intended for production rather than local wrangler dev testing.
You can connect Telegram to communicate with your AI agent through a messaging interface.
npx wrangler secret put TELEGRAM_BOT_TOKEN
Enter your bot token and follow the current repository instructions for enabling and testing the Telegram integration.
Moltworker also documents support for additional messaging integrations. You can configure the required credentials for Discord and Slack.
npx wrangler secret put DISCORD_BOT_TOKEN
Create a Discord application and bot, then provide the appropriate token. Review the official integration instructions for permissions and setup requirements.
npx wrangler secret put SLACK_BOT_TOKEN npx wrangler secret put SLACK_APP_TOKEN
Configure your Slack app and provide the required bot and app-level tokens. Use the permissions required by your intended integration.
Moltworker's architecture can use Cloudflare Browser Rendering for browser-related tasks. This can support workflows that require web page interaction or browser-based information gathering.
Review the current repository configuration and Cloudflare Browser Rendering documentation before enabling browser capabilities. The available features depend on the deployed version and its configured services.
Cloudflare Browser Rendering documentation ↗
You can adjust how long the sandbox container remains active before
going to sleep. The repository documents
SANDBOX_SLEEP_AFTER as a configuration option.
For example, the following values represent different sleep settings:
SANDBOX_SLEEP_AFTER=never SANDBOX_SLEEP_AFTER=10m SANDBOX_SLEEP_AFTER=1h
The appropriate setting depends on your usage and cost requirements. A container that sleeps may need to start again when the next request arrives. Persistent storage helps retain supported data across container restarts.
After completing the setup, verify that your secrets and deployment are working correctly. Wrangler provides useful commands for checking configuration and monitoring Worker activity.
npx wrangler secret list
Use this command to check which secrets have been configured. It does not reveal their secret values.
npx wrangler tail
Review the logs to identify deployment or runtime issues. Avoid sharing logs publicly if they contain sensitive information.
If your AI agent does not work as expected, check the configuration, credentials, and deployment logs before changing multiple settings.
| Problem | What to Check |
|---|---|
| AI model is not responding | Verify the provider API key, gateway credentials, and model configuration. |
| Control UI access denied | Check Cloudflare Access policies, team domain, and Application Audience. |
| Device is not connected | Check pending device requests and approve only trusted devices. |
| Data disappears after restart | Verify R2 credentials, bucket configuration, and backup status. |
| Messaging integration fails | Check the bot or app token and the integration's required permissions. |
| Container takes time to start | Allow time for the sandbox to initialize and inspect Worker logs. |
| Local development issue on Windows | Check Git line endings if shell scripts fail with an exit code such as 126. |
For more detailed troubleshooting, review the official Moltworker GitHub repository.
Your AI agent may have access to connected services, messaging platforms, and other resources. Protecting its credentials and access points is essential.
Store credentials as Worker secrets. Do not place private API keys in public code or browser-side scripts.
Restrict dashboard access to trusted users with Cloudflare Access.
Approve only devices you recognize and trust.
Moltworker uses Cloudflare services, but running it is not necessarily free. The official repository identifies a Cloudflare Workers Paid plan as a requirement for Sandbox containers. The plan has a baseline subscription cost, and additional usage may result in extra charges.
Your total cost can depend on container compute, AI model requests, storage, and the services you enable. AI provider usage may be billed separately depending on your configuration.
Before deploying: Check the latest Cloudflare Workers pricing and the pricing of your selected AI provider. Pricing and free-tier allowances can change.
Use this checklist to review the main configuration tasks.
Moltworker provides an approach to running an OpenClaw-based AI agent using Cloudflare infrastructure. It connects the agent runtime with services such as Sandbox containers, R2 storage, Cloudflare Access, and optional AI Gateway capabilities.
Yes. The official Moltworker repository identifies a Workers Paid plan as a requirement for Cloudflare Sandbox containers. Additional usage charges may also apply.
Yes. The repository documents direct AI provider configuration, including Anthropic API access. Cloudflare AI Gateway is an optional way to route and monitor supported model requests.
Cloudflare Access adds an authentication layer to protect the remote Control UI. It helps restrict access to approved users instead of leaving the administrative interface publicly accessible.
The official repository documents Telegram integration using a bot token configured as a Worker secret. Follow the current repository instructions to complete the integration.
R2 provides persistent storage and backup functionality for supported Moltworker data. It helps preserve information that could otherwise be lost when a sandbox container restarts.
Cloudflare describes the repository as an experimental proof of concept rather than an officially supported product. Review the latest documentation and assess the security and reliability requirements before using it for important workloads.
The official Cloudflare Moltworker GitHub repository is the best place to check the latest installation, configuration, and troubleshooting instructions.
Continue learning with our related Moltworker guides.
Complete your configuration, secure your Control UI, and connect the services required for your AI agent. Always refer to the official repository for the latest changes.
View Official Documentation ↗