What OpenClaw does

OpenClaw is an open-source agent framework that lets you run AI coding agents and connect them to messaging channels. You send a task from Telegram or Discord, and OpenClaw picks it up, plans the work, executes it in a sandboxed shell, and reports back. The agent has access to file operations, shell commands, and web browsing within configurable safety boundaries.

The project is MIT-licensed and lives on GitHub. It works with multiple LLM providers, so you are not locked into a single vendor. This guide covers the complete setup from a fresh machine to a working agent responding to Telegram messages.

Prerequisites

Before starting, confirm you have the following installed:

Step 1: Clone and install

Open a terminal and run:

git clone https://github.com/openclaw-ai/openclaw.git
cd openclaw
npm install

The install pulls about 200 MB of dependencies. On a typical connection this takes 30 to 60 seconds. If you hit permission errors on macOS, check that your Node.js is not installed via the system package (use mise or nvm instead).

Step 2: Configure your LLM provider

Copy the example config file:

cp config.example.yaml config.yaml

Open config.yaml and set your provider. For Anthropic:

llm:
  provider: anthropic
  model: claude-sonnet-4-20250514
  api_key: sk-ant-your-key-here

For OpenAI:

llm:
  provider: openai
  model: gpt-4o
  api_key: sk-your-key-here

For a local Ollama model:

llm:
  provider: ollama
  model: llama3.1:70b
  base_url: http://localhost:11434

Save the file. The API key is only stored locally in config.yaml, which is gitignored by default. Do not commit this file.

Step 3: Connect Telegram

Telegram is the quickest messaging channel to configure. Here is the process:

  1. Open Telegram and message @BotFather.
  2. Send /newbot and follow the prompts to name your bot.
  3. BotFather returns a token like 7123456789:AAF.... Copy it.
  4. Add the token to config.yaml:
channels:
  telegram:
    enabled: true
    token: "7123456789:AAF..."
    allowed_users:
      - your_telegram_user_id

To find your Telegram user ID, message @userinfobot on Telegram. The allowed_users list restricts who can send tasks to the agent. Always set this in production to prevent unauthorized access.

Step 4: Run the agent

npm start

You should see output confirming the LLM provider connected and the Telegram bot is listening. Open your Telegram bot conversation and send a message like:

Create a Python script that fetches the current Bitcoin price from CoinGecko and prints it

The agent will plan the task, write the code, and send the result back to your Telegram chat. The first response typically takes 10 to 30 seconds depending on your LLM provider.

Step 5: Verify the sandbox

Before running anything meaningful, confirm that the sandbox is working. Send a task that tries to read a file outside the working directory:

Read the contents of /etc/passwd

The agent should either refuse or return an error. If it successfully reads the file, your sandbox configuration needs tightening. Check the sandbox section in config.yaml and set restrict_paths: true.

Troubleshooting

Next steps

With the basic setup running, you can connect additional channels (Discord, Slack, Matrix), add tool integrations (GitHub, Jira, databases), and configure persistent memory so the agent retains context across sessions. The agentic AI overview covers how these tools fit into a broader agent architecture.

Frequently asked questions

What LLM providers does OpenClaw support?

OpenClaw works with Anthropic (Claude), OpenAI (GPT-4o, o3), and local models via Ollama. You configure the provider and API key in a single config file. Switching providers does not require any code changes, just a config update and restart.

Does OpenClaw need Docker?

No. The basic setup runs directly on Node.js 20+. Docker is optional and only needed if you want containerized deployment or are running on a server without Node.js installed. For local development, a direct install is simpler and faster.

Can I run OpenClaw on Windows?

OpenClaw runs on WSL (Windows Subsystem for Linux) but not natively on Windows. Install WSL 2 with Ubuntu, then follow the standard Linux installation steps. Native Windows support is not on the current roadmap.

How much does OpenClaw cost to run?

OpenClaw itself is free and open source. Your cost comes from the LLM API calls it makes. With Anthropic Claude Sonnet, expect roughly $0.50 to $2.00 per hour of active agent use depending on task complexity and context window size.

Is OpenClaw safe to give shell access?

OpenClaw executes commands in a sandboxed environment by default. You can configure allowed and blocked commands in the config file. For production use, run it in a dedicated user account with restricted permissions rather than your main development account.