OpenClaw Beginner's Guide: Deploy an Always-On AI Agent
10 min read
Updated
A complete step-by-step setup guide for OpenClaw. Learn how to host your own 24/7 AI agent, connect communication channels, and secure your setup.
OpenClaw is an open-source AI agent framework with over 333,000 GitHub stars that runs on its own server, connects to your applications, and performs real actions on your behalf. By following this guide, you will set up a secure, always-on assistant that can message you on Telegram, manage your Google Workspace, execute scheduled tasks, and respond to voice instructions.
No coding knowledge is required, and every step is explained in detail below.
What OpenClaw Actually Is
Most AI assistants operate as websites that you visit only when you need a specific question answered. OpenClaw functions differently by running continuously on its own server.
The framework is built on three core pillars:
- Brain and memory: Connects to external AI models via APIs, stores historical context in local Markdown files, and improves iteratively.
- Always-on operation: Operates 24/7, enabling the agent to schedule tasks, monitor external events, and send proactive updates.
- Tools and actions: Integrates with services like Telegram, Gmail, Calendar, Drive, Slack, and Discord to complete actual tasks.
Note: The project was previously known as Clawdbot and briefly Moltbot before settling on OpenClaw.
Common Use Cases
Here are some of the practical workflows users configure with OpenClaw:
- Daily Briefings: Scan your calendar and inbox every morning, then send a prioritized agenda summary via Telegram.
- Meeting Preparation: When an interview or meeting is added to your calendar, automatically research the company and compile a prep document.
- Class & Event Booking: Monitor scheduling platforms and book a spot the moment registration opens.
- Drafting Approvals: Write draft email responses and hold them for your manual approval before sending.
- Code Review: Scan code repositories nightly for open pull requests and post review summaries directly to Slack.
Where to Run OpenClaw
Choosing the right hosting environment depends on your budget and requirements:
| Option | Pros | Cons |
|---|---|---|
| Personal Computer | Free and quick to set up | Stops working when the computer sleeps; exposes local personal files to the agent |
| Dedicated Local Hardware (e.g., Mac Mini) | Good isolation; remains online if kept powered | Upfront hardware costs; requires manual network management |
| Cloud VPS (Virtual Private Server) | Affordable ($5–$13/mo); always online; isolated environment | Small recurring monthly fee |
For most beginners, a Cloud VPS is the recommended path. It keeps the agent online 24/7 and isolates its file operations from your primary device. While this guide references VPS templates that automate Docker setup, you can manually install the agent on any VPS provider (such as DigitalOcean or Hetzner) using the standard installation methods from the official project site.
Deploying on a VPS
Many VPS providers offer templates that configure Docker, dependencies, and environment setups automatically.
Choosing a Plan:
- Entry-Level (1 CPU, 2GB RAM): Sufficient for basic text-based tasks and minor automation workflows.
- Mid-Tier (2 CPU cores, 8 GB RAM): Comfortable for most active multi-integration setups.
- High-Tier (4+ CPU cores): Necessary if you plan to host local open-source models using Ollama.
Recommendations During Setup:
- Avoid choosing generic pre-packaged "ready-to-use AI" add-ons that charge a markup. You will configure your own model API keys directly to keep costs low.
- Enable daily automated backups. Since OpenClaw has the ability to write to its own workspace, having a rollback option is critical.
- Pick the hosting data center location closest to you to reduce latency.
Initial Configuration
Once the deployment completes, navigate to your instance administration panel.
The most important field is your gateway token—this is the master password used to access your control panel. Copy it immediately, store it in a secure password manager, and never share it.
Connecting Your First AI Model (Anthropic Example)
OpenClaw requires an external language model to think. You can connect one using an API key:
- Log into your AI provider dashboard (e.g., the Anthropic Console).
- Add credits to your account. When using Anthropic, starting with at least $40 moves your account to Tier 2 rate limits (450,000 tokens/min), preventing performance bottlenecks during initial agent runs.
- Set a monthly spend limit (e.g., $100) under your usage settings.
- Disable auto-reload options to prevent unexpected charges.
- Create a new API key, copy it, and paste it into your OpenClaw environment configuration.
(You can add keys for OpenAI, Google Gemini, or other providers using this same method.)
Accessing the Dashboard
After the server finishes initializing:
- Navigate to your VPS Docker dashboard or instance IP address.
- Input your saved gateway token to log in.
Note: Ensure your setup is eventually secured behind HTTPS or a secure VPN overlay (like Tailscale) before entering sensitive information on public Wi-Fi networks.
First Run and Identity Setup
In your dashboard's chat box, enter the following command:
"Hey, let's get you set up. Read BOOTSTRAP.md and walk me through it."
This starts the first-run configuration script. Provide specific answers regarding:
- Your name, role, and timezone.
- Your preferred name for the assistant.
- Your communication style (e.g., "Direct, professional, and concise. No filler phrases.").
- Your core project priorities.
Once complete, the agent locks these settings into its permanent configuration and deletes the temporary bootstrap file.
Critical Security Setup
OpenClaw has the ability to execute terminal commands, modify local workspace files, and browse the web. Proper security isolation is necessary.
- Consult the official OpenClaw security documentation.
- Paste the security guidelines link into the chat and instruct:
"Implement and verify everything on this page, but leave allow_insecure set to true." - Confirm that the bot completes the audit and restarts the server gateway.
Behavioral Guardrails
Explicitly configure safety rules by messaging the bot:
"When sending messages on my behalf, always draft the message first and wait for my approval.""Always ask for confirmation before deleting files or making external network requests.""If a task fails three times consecutively, stop executing. Limit total runtime to 10 minutes."
These guidelines are stored in your workspace rules (AGENTS.md). Start by connecting lower-risk tools first. Do not link high-access accounts (like primary email, banking, or password managers) until you are comfortable with the agent's behavior.
Connecting Telegram
To control your agent via chat on your mobile device, ask the bot: "Let's set up Telegram."
- Open Telegram and message @BotFather.
- Send the command
/newbot. - Provide a name and a unique username ending in
bot. - Copy the HTTP API token provided by BotFather.
- Paste this token into the OpenClaw configuration interface.
- Send a message to your newly created Telegram bot to receive a pairing code.
- Enter that pairing code in OpenClaw to register your user account on the secure access list.
Test the connection by sending "Hello" in Telegram. The bot should reply directly to you.
Installing Skills
Skills are modular plugins that extend what the agent can do. You can find them in the official community index or directly by sending /clawhub to your bot.
[!WARNING] Verify Skill Sources: Always review the requested permissions of any skill before installing. For example, a basic notes plugin should not require network access. Prefer verified, open-source plugins to avoid security risks.
Google Workspace Integration
You can link Gmail, Google Calendar, Google Drive, and Google Contacts:
- Request the bot to install the Google Workspace skill.
- If hosting on a Linux VPS, specify:
"I am on a VPS running Ubuntu, not macOS. Walk me through setting up OAuth." - Go to the Google Cloud Console and create a project named
"OpenClaw". - Enable the APIs you require (Gmail, Calendar, Drive, etc.).
- Configure the OAuth Consent Screen as an external app and add your own email address as a test user.
- Create an OAuth client ID credential (select "Desktop app" as the application type).
- Download the client secret JSON file.
- Upload this JSON file to the OpenClaw chat and instruct:
"I enabled all Google Workspace APIs and configured OAuth. Here is my client secret JSON. Please connect my Google account." - Click the authorization link, approve the permissions under your Google Account, and paste the redirect code back to your agent.
Example Prompts:
"Add a meeting with Sarah to my calendar this Friday at 2:00 PM for 1 hour.""Show me my scheduled appointments for tomorrow."
Understanding Workspace Files
OpenClaw saves its entire state as simple Markdown files in its local workspace instead of using a structured database.
Eight files dictate how the agent behaves:
| File | Purpose |
|---|---|
SOUL.md | The agent's core personality traits and baseline rules. |
AGENTS.md | Active behavioral rules, permission gates, and execution limits. |
USER.md | Information about you (name, location, preferences). |
MEMORY.md | Historical logs and long-term details remembered by the agent. |
TOOLS.md | Configured active integrations and API parameters. |
IDENTITY.md | The agent's name and registration credentials. |
HEARTBEAT.md | Scripts for background loops and active monitoring tasks. |
BOOTSTRAP.md | Setup steps, deleted automatically after initialization. |
To inspect or alter these settings, write directly to the bot:
"Show me the contents of SOUL.md.""Add this rule to AGENTS.md: Always ask for approval before draft emails are sent."
Memory Management
To keep your agent's memory organized over long projects, prompt the bot: "Enable compaction, memory flush, and session memory."
This ensures that:
- Key facts are summarized and written to disk before context window limits are reached.
- Context remains consistent across separate chat sessions.
- Large conversation histories do not slow down responses.
Configuring Automations
Scheduled Tasks (Cron Jobs)
You can schedule recurring events at specific times.
- Example Prompt:
"Create a daily job: Every morning at 8:00 AM, retrieve my Google Calendar items, check the weather, scan my inbox for high-priority emails, and send a summary to my Telegram."
Heartbeats
A heartbeat routine runs at short intervals (e.g., every 30 minutes) to check for time-sensitive events.
- Enable this by prompting:
"Enable HEARTBEAT.md." - Best Practice: Use cron jobs for fixed-time tasks and heartbeats only for continuous monitoring. Running heavy background queries too frequently will quickly consume API tokens.
Model Choice and Cost Optimization
While the OpenClaw codebase is free and open-source, you are responsible for hosting fees and API usage costs:
| Expense Category | Typical Monthly Cost |
|---|---|
| VPS Server Hosting | $5 – $13 |
| Budget Models (Claude Haiku, GPT-4o Mini) | $5 – $20 |
| Mid-Tier Models (Claude Sonnet, GPT-4o) | $30 – $80 |
| Flagship Models (Claude Opus) | $100 – $300+ |
| Local Open-Source Models (via Ollama) | Free (resource dependent) |
Why API Costs Can Rise:
Every time the agent runs a task, it reads the relevant files in its workspace to maintain context. If you run multiple background tasks or set a frequent heartbeat interval, the number of tokens processed accumulates quickly.
Setting Up Smart Model Routing:
Save money by instructing the bot to route tasks dynamically based on complexity:
"Use Claude Sonnet by default. For complex programming or logic tasks, use Claude Opus. For routine tasks, notifications, and scheduled summary runs, route queries through Claude Haiku or GPT-4o Mini. Save this routing rule in AGENTS.md."
Troubleshooting and System Recovery
Updating the Software
- In Telegram, send:
"Check for updates." - Alternatively, log into your VPS docker management panel and trigger an image update.
Emergency Stop Procedures
If your agent gets stuck in an infinite processing loop or acts unexpectedly:
- Send
"Stop all processes right now"via chat. - If the bot does not respond, log into your hosting dashboard and stop the Docker container manually.
- If needed, temporarily revoke the active API keys inside your AI provider console (Anthropic, OpenAI, etc.).
- Restore the workspace state using your automated VPS backups. Ensure you capture a system snapshot before testing major configuration changes.