Setup GuideOpenClawMarch 14, 2026·8 min read

OpenClaw Setup Guide: From Install to First Agent in 5 Minutes

A complete, step-by-step guide to installing OpenClaw and running your first AI agent. Covers installation, onboarding, SOUL.md configuration, gateway startup, channel connections, and troubleshooting. You will go from zero to a working agent in six steps.

What is OpenClaw?

OpenClaw is an open source AI agent framework that lets you build, configure, and deploy autonomous AI agents on your own machine. You define an agent's identity, personality, and rules in a simple markdown file called SOUL.md. The agent then runs locally, connects to language models like Claude, GPT-4o, or Ollama, and can interact with you through the terminal, Telegram, Slack, Discord, or a REST API.

OpenClaw was formerly known as Clawdbot and Moltbot. The project was renamed and open-sourced in late 2025. If you used either of those earlier versions, the core concepts are the same, but the CLI commands and configuration format have been updated. This guide covers the current 2026 version.

What makes OpenClaw different from other agent frameworks is its simplicity. There is no Python environment to manage, no complex YAML pipelines to write, and no web dashboard required. Everything runs from the terminal with a handful of commands. Your agent's entire configuration lives in a single SOUL.md file that you can version control, share, and deploy anywhere.

Prerequisites

Before you start, make sure you have these two things ready:

Node.js 22 or later

OpenClaw is built on Node.js. Version 22 is the minimum. Download it from nodejs.org or use a version manager like nvm. Check your version with node --version.

An API key (or Ollama for local models)

You need an API key from Anthropic (Claude), OpenAI (GPT-4o), or Google (Gemini). If you prefer running models locally for free, install Ollama from ollama.com instead. No API key needed for local models.

# Check your Node.js version
node --version
# Expected: v22.x.x or higher

# If you need to install or upgrade:
nvm install 22
nvm use 22

Step 1: Install OpenClaw

You can install OpenClaw two ways. The npx approach downloads and runs it on demand without a global install. The npm approach adds the openclaw command permanently to your system path. Both give you the same CLI.

Option A: Run with npx (no install needed)
npx openclaw
Option B: Install globally with npm
npm install -g openclaw
Option C: Install with curl (Linux/macOS)
curl -fsSL https://get.openclaw.dev | sh

After installation, verify it works:

openclaw --version
# Output: openclaw v2.x.x

If you see a version number, you are good to go. If you get a "command not found" error, make sure Node.js 22 is active and try the npm install again.

Step 2: Run Onboarding

OpenClaw includes an interactive onboarding wizard that walks you through the initial setup. It creates your project directory, configures your model provider, and scaffolds a starter agent. Run it from the directory where you want your project:

openclaw onboard

The onboarding wizard will ask you to:

1

Choose a project name (creates a new directory)

2

Select your model provider (Anthropic, OpenAI, Google, or Ollama)

3

Paste your API key (skipped for Ollama)

4

Pick a default model (e.g. claude-sonnet-4-5, gpt-4o, llama3)

5

Create your first agent with a starter SOUL.md

After onboarding completes, you will have a project structure like this:

Project file tree
my-agent-project/
├── SOUL.md              # Your agent's identity and rules
├── agents.md            # Multi-agent registry (optional)
├── config/
│   ├── models.yaml      # Model provider settings
│   ├── channels.yaml    # Channel integrations
│   └── skills.yaml      # Tool/skill configuration
├── knowledge/           # Reference docs for your agent
│   └── README.md
└── sessions/            # Conversation history
    └── .gitkeep

Alternative: If you prefer manual setup instead of the wizard, you can run npx openclaw init followed by openclaw configure to set up the project and model provider separately.

Step 3: Configure Your First Agent - Create SOUL.md

The SOUL.md file is the heart of your agent. It defines who the agent is, how it communicates, what rules it follows, and which tools it can use. The onboarding wizard creates a basic one for you, but you should customize it for your specific use case.

Open the SOUL.md file in your editor and structure it with these key sections:

Role

Define what your agent does. Be specific about its domain. Example: 'You are a content marketing specialist for SaaS products.'

Rules

Hard constraints the agent must follow. Use strong language: ALWAYS, NEVER, MUST. Example: 'ALWAYS respond in English.'

Personality

How the agent communicates. Set tone and style. Example: 'Tone: professional but approachable. Use short sentences.'

Tools

Which skills to use and when. Be explicit. Example: 'Use Browser WHEN you need to research a topic before writing.'

Here is a complete example of a SOUL.md for a research assistant:

SOUL.md - ResearchAssistant
# ResearchAssistant

## Role
You are a research specialist. You gather
information from the web, summarize findings,
and produce structured research briefs with
sources cited.

## Personality
- Tone: Neutral, academic
- Style: Structured, evidence-based
- Always cite sources with URLs
- Present both sides of any argument

## Rules
- ALWAYS respond in English
- ALWAYS include source URLs
- Target 500-1,000 words per research brief
- NEVER fabricate data or statistics
- Include a confidence score (High/Medium/Low)
  for each finding

## Tools - USE THEM
- Use Browser to read web pages and articles
- Use Search to find relevant sources
- Use Files to save research briefs locally

## Output Format
- Title
- Executive Summary (3-5 sentences)
- Key Findings (bulleted)
- Detailed Analysis (H2 sections)
- Sources (numbered list with URLs)

After editing your SOUL.md, register the agent with OpenClaw:

# Register the agent (from your project directory)
openclaw agents add my-agent --workspace . --non-interactive

# Verify it was registered
openclaw agents list

Step 4: Start the Gateway

The gateway is OpenClaw's runtime engine. It loads your SOUL.md, connects to your model provider, and starts listening for messages on port 18789. Start it from your project directory:

openclaw gateway start

You should see output like this:

Expected terminal output
[OpenClaw] Loading SOUL.md...
[OpenClaw] Agent: ResearchAssistant
[OpenClaw] Model: claude-sonnet-4-5 (Anthropic)
[OpenClaw] Skills: browser, search, files
[OpenClaw] Gateway running on port 18789
[OpenClaw] Type a message to start chatting...

>

Your agent is now live. Type a message directly in the terminal and it will respond based on your SOUL.md configuration. The gateway also exposes a web interface at http://localhost:18789 and a REST API for programmatic access.

To stop the gateway, press Ctrl+C. To restart it after making changes to your SOUL.md or configuration:

openclaw gateway restart

Step 5: Connect to Telegram, Slack, or Discord

By default, you interact with your agent through the terminal. OpenClaw also supports connecting your agent to messaging platforms so you can chat from your phone or workspace. Channels are optional. Your agent works perfectly fine with just the terminal.

Telegram

Create a bot via @BotFather on Telegram, copy the bot token, and add it to your OpenClaw configuration. Your agent will respond to messages sent to the Telegram bot.

openclaw config set channels.telegram.bottoken YOUR_BOT_TOKEN
openclaw gateway restart

Slack

Create a Slack App in the Slack API dashboard, enable Socket Mode, add Bot Token Scopes (chat:write, app_mentions:read, im:history), install the app to your workspace, then configure the tokens.

openclaw config set channels.slack.bottoken xoxb-YOUR-BOT-TOKEN
openclaw config set channels.slack.apptoken xapp-YOUR-APP-TOKEN
openclaw gateway restart

Discord

Create a Discord Application in the Developer Portal, add a Bot, copy the bot token, and invite the bot to your server with the Message Content intent enabled.

openclaw config set channels.discord.bottoken YOUR_DISCORD_BOT_TOKEN
openclaw gateway restart

You can also interact with your agent through the REST API, which is useful for integrating with custom applications:

curl -X POST http://localhost:18789/api/message \
  -H "Content-Type: application/json" \
  -d '{"message": "Research the latest AI trends"}'

Step 6: Test Your Agent

With the gateway running, you can test your agent in three ways. Pick whichever is most convenient for your workflow.

Option 1: Terminal (direct)

Type a message directly in the terminal where the gateway is running. The agent responds inline.

Option 2: CLI command

Send a one-off message from a separate terminal window using the agent command:

openclaw agent --agent my-agent --message "What can you help me with?"

Option 3: Web interface

Open http://localhost:18789 in your browser. The gateway serves a simple chat UI where you can test conversations with your agent.

When testing, pay attention to how well the agent follows your SOUL.md rules. If the responses are off, edit the SOUL.md, then restart the gateway with openclaw gateway restart. The gateway does not hot-reload configuration changes, so a restart is required after every SOUL.md edit.

Tip: If your agent starts behaving oddly after many messages, clear the session history to reset context: rm ~/.openclaw/agents/*/sessions/sessions.json

Common Setup Issues and Fixes

Most OpenClaw setup issues fall into three categories: Node.js version problems, API key errors, and port conflicts. Here are the most common issues and how to fix them.

Gateway won't start

First, check if another process is already using port 18789. Run 'lsof -i :18789' on macOS/Linux to find it. If the port is taken, either stop the other process or change the OpenClaw port: 'openclaw config set gateway.port 18790'. Also make sure your model provider is configured. The gateway will fail to start if no API key is set.

API key errors or 'No model provider configured'

Re-run the model auth command: 'openclaw models auth paste-token --provider anthropic'. Make sure you paste the full API key without extra spaces or line breaks. Verify the key is saved with 'openclaw models auth status'. If the key is valid but you still see errors, check that your API account has available credits.

Port 18789 already in use

Another OpenClaw gateway instance or a different application is using the port. On macOS/Linux, find the process with 'lsof -i :18789' and kill it with 'kill -9 <PID>'. Alternatively, change the gateway port: 'openclaw config set gateway.port 18790'.

'command not found: openclaw'

OpenClaw is not in your system path. If you installed with npm, make sure the npm global bin directory is in your PATH. Run 'npm config get prefix' to find it. On macOS with nvm, this is usually '~/.nvm/versions/node/v22.x.x/bin'. Alternatively, use 'npx openclaw' to run without a global install.

Agent not responding or giving empty replies

Check your SOUL.md for syntax errors. The file must start with a '# AgentName' header. Unclosed markdown blocks or missing sections can cause issues. Also verify your model provider is reachable with 'openclaw models auth status'. If using Ollama, make sure the Ollama server is running with 'ollama serve'.

Windows-specific issues

Use WSL 2 instead of PowerShell or Command Prompt. Install Ubuntu from the Microsoft Store, install Node.js 22 inside WSL, and run all OpenClaw commands from the WSL terminal. Native Windows support is experimental.

If none of these fix your issue, try a full reset. This clears all session data and restarts the gateway cleanly:

# Clear all session data
rm -rf ~/.openclaw/agents/*/sessions/sessions.json

# Restart the gateway
openclaw gateway restart

Quick Reference: All 6 Steps

Here is the complete setup flow in one code block. Copy and run these commands in order:

# Step 1: Install OpenClaw
npm install -g openclaw

# Step 2: Run onboarding
openclaw onboard

# Step 3: Edit your SOUL.md
# (open SOUL.md in your editor and customize)

# Step 4: Start the gateway
openclaw gateway start

# Step 5: Connect a channel (optional)
openclaw config set channels.telegram.bottoken YOUR_TOKEN
openclaw gateway restart

# Step 6: Test your agent
openclaw agent --agent my-agent --message "Hello, what can you do?"

Frequently Asked Questions

What are the system requirements for OpenClaw?

OpenClaw requires Node.js version 22 or later and a terminal. It runs on macOS, Linux, and Windows (via WSL 2). You also need an API key from Anthropic, OpenAI, or Google, unless you plan to use Ollama for local models. The gateway uses minimal resources, around 100-200 MB of RAM. If you run local models through Ollama, plan for 8-16 GB of RAM depending on model size.

Is OpenClaw free to use?

Yes. OpenClaw is open source and completely free. The only cost is the language model API usage. With Anthropic Claude, a typical agent interaction costs $0.003-$0.015 per message. A lightly used agent running 50-100 messages per day costs roughly $1-5 per month in API fees. If you use Ollama for local models, the API cost is zero.

Does OpenClaw work on Windows?

Yes, through WSL 2 (Windows Subsystem for Linux). Install WSL 2 from the Microsoft Store, set up Ubuntu, install Node.js 22 inside the WSL environment, and then follow the standard installation steps from this guide. Native Windows support without WSL is experimental and may have issues with file paths and certain skills.

How do I update OpenClaw to the latest version?

If you installed globally, run 'npm update -g openclaw'. If you use npx, it automatically fetches the latest version each time. After updating, restart your gateway with 'openclaw gateway restart' to apply the new version. Check your current version with 'openclaw --version'.

Want to skip the setup?

CrewClaw gives you 103 ready-to-deploy agent templates. Pick a template, get your deploy package in 60 seconds. No terminal setup, no configuration files, no API key management.

Deploy a Ready-Made AI Agent

Skip the setup. Pick a template and deploy in 60 seconds.

Get a Working AI Employee

Pick a role. Your AI employee starts working in 60 seconds. WhatsApp, Telegram, Slack & Discord. No setup required.

Get Your AI Employee
One-time payment Own the code Money-back guarantee