How to Get Started with OpenClaw in 2026 β Complete Beginner's Setup
A practical, step-by-step guide to setting up OpenClaw from scratch. Installation, first project, key commands, and tips to avoid beginner mistakes.
01What is OpenClaw and Why Should You Care?
OpenClaw is an open-source AI agent framework that lets you build, deploy, and manage autonomous AI agents. Unlike closed-source alternatives, OpenClaw gives you full control over your data and infrastructure β which is exactly why it's exploding in popularity in 2026.
Whether you're a developer looking to automate workflows, a startup building AI-powered products, or just someone curious about running your own AI agent, OpenClaw is the tool to learn. Here's why:
- Open source β free to use, inspect, and modify
- Self-hostable β your data stays on your servers
- Extensible β plugins, custom tools, and integrations with everything
- Active community β thousands of contributors and a thriving ecosystem
This guide walks you through everything from installation to running your first agent. No prior experience needed.
02Prerequisites: What You Need Before Installing
Before we start, make sure you have these basics covered:
- A computer running macOS, Linux, or Windows (WSL2 recommended for Windows users)
- Node.js 20+ installed β check with
node --version - Git installed β check with
git --version - A terminal you're comfortable with (Terminal.app, iTerm2, Windows Terminal, etc.)
- 8GB+ RAM β OpenClaw runs local models efficiently, but you need headroom
Don't have Node.js yet? The fastest way to install it:
# macOS / Linux (using nvm - recommended)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash
nvm install 20
nvm use 20
# Verify installation
node --version # Should show v20.x.x
npm --version # Should show 10.x.x
If you're on Windows, install WSL2 first, then follow the Linux instructions inside your WSL terminal. Trust us β this saves headaches down the road.
03Step 1: Install OpenClaw
OpenClaw offers two installation methods. We recommend the CLI for beginners:
Option A: Global CLI Install (Recommended for Beginners)
# Install the OpenClaw CLI globally
npm install -g @openclaw/cli
# Verify it worked
openclaw --version
This gives you the openclaw command everywhere on your system. Simple and clean.
Option B: Docker Install (Recommended for Production)
# Pull the official Docker image
docker pull openclaw/openclaw:latest
# Run OpenClaw
docker run -d --name openclaw \
-p 3000:3000 \
-v openclaw_data:/app/data \
openclaw/openclaw:latest
Docker is better for production deployments because it isolates OpenClaw from your system. But for learning, the CLI is easier.
Pro tip: If you get permission errors with the global npm install, don't use sudo. Instead, fix your npm permissions or use nvm (which avoids this issue entirely).
04Step 2: Initialize Your First Project
Now let's create your first OpenClaw project. This sets up the folder structure and configuration files you'll need:
# Create a new project directory
mkdir my-first-agent && cd my-first-agent
# Initialize an OpenClaw project
openclaw init
# You'll see this structure:
# my-first-agent/
# βββ openclaw.config.yaml # Main configuration
# βββ agents/ # Your agent definitions
# β βββ assistant.yaml # Default agent
# βββ tools/ # Custom tool scripts
# βββ prompts/ # Reusable prompt templates
# βββ .env.example # Environment variables template
The openclaw init command creates everything you need. Let's look at the most important file β openclaw.config.yaml:
# openclaw.config.yaml
project:
name: my-first-agent
version: 1.0.0
runtime:
model: default # Uses the default model
temperature: 0.7 # Creativity level (0 = precise, 1 = creative)
max_tokens: 4096 # Maximum response length
security:
sandbox: true # Run tools in a sandboxed environment
allow_network: false # Disable network access by default
log_level: info # Logging verbosity
Important: Notice the security section. OpenClaw ships with sandbox mode enabled by default β this is good. Don't disable it unless you know exactly what you're doing.
05Step 3: Configure Your Environment
Before running your agent, you need to set up your environment variables. Copy the example file and fill in your details:
# Copy the environment template
cp .env.example .env
# Open it in your editor
nano .env # or code .env, vim .env, etc.
Here's what each variable does:
# .env file
OPENCLAW_API_KEY=your_api_key_here # Get this from your OpenClaw dashboard
OPENCLAW_MODEL=gpt-4o # Or any supported model
OPENCLAW_LOG_DIR=./logs # Where to store logs
OPENCLAW_SANDBOX=true # Keep this enabled!
Where do I get an API key?
- Create an account at the OpenClaw dashboard
- Navigate to Settings β API Keys
- Click "Generate New Key"
- Copy it immediately β you won't see it again
- Paste it in your
.envfile
Security reminder: Never commit your .env file to Git. The .gitignore generated by openclaw init already excludes it, but double-check. A leaked API key can cost you money and compromise your data.
06Step 4: Run Your First Agent
This is the moment you've been waiting for. Let's start your first agent:
# Start the default agent in interactive mode
openclaw run
# You should see:
# π’ OpenClaw v3.2.0 started
# π Agent: assistant (default)
# π Sandbox: enabled
#
# Type your message and press Enter.
# Type /help for commands, /quit to exit.
Try a few things:
# Ask it something simple
> What's the weather API endpoint for OpenWeatherMap?
# Ask it to write code
> Write a Python function that reads a CSV file and returns the top 5 rows
# Ask it to use a tool
> Search my project files for any TODO comments
You'll notice the agent asks for confirmation before executing tools that access your filesystem or network. This is the sandbox in action β protecting you from unintended side effects.
Useful CLI commands while the agent is running:
/help β Show all available commands
/tools β List available tools
/history β Show conversation history
/clear β Clear the conversation
/export β Export conversation to a file
/quit β Exit the agent07Step 5: Create a Custom Agent
The default agent is fine for learning, but OpenClaw's real power is in custom agents. Let's create one:
# Create a new agent definition
openclaw agent create code-reviewer
This creates agents/code-reviewer.yaml. Open it and customize:
# agents/code-reviewer.yaml
name: code-reviewer
description: Reviews code for bugs, security issues, and best practices
system_prompt: |
You are an expert code reviewer. When given code, you:
1. Check for bugs and logic errors
2. Identify security vulnerabilities
3. Suggest performance improvements
4. Verify best practices are followed
Always explain your reasoning and provide fixed code examples.
tools:
- file_read # Can read project files
- file_search # Can search across files
- web_search # Can look up documentation
constraints:
- no_file_write # Cannot modify files (read-only reviewer)
- no_execute # Cannot run commands
Now run it:
# Run your custom agent
openclaw run --agent code-reviewer
# Point it at a file
> Review the code in src/auth.js for security issues
Notice the constraints section β we've restricted this agent to read-only mode. It can review code but can't modify or execute anything. This is the principle of least privilege, and it's essential for building agents you can trust.
08Step 6: Connect Tools and Integrations
Tools are what make OpenClaw agents useful beyond just chatting. Here's how to add them:
# List available built-in tools
openclaw tools list
# Install a community tool
openclaw tools install @openclaw/tool-github
# Install a tool from a Git repo
openclaw tools install https://github.com/user/custom-tool.git
Popular tools to start with:
- @openclaw/tool-github β Create issues, open PRs, review code
- @openclaw/tool-slack β Send messages, read channels
- @openclaw/tool-postgres β Query databases safely (read-only by default)
- @openclaw/tool-web β Browse and extract data from websites
- @openclaw/tool-shell β Execute shell commands (use with caution!)
Each tool requires explicit permission in your agent's YAML configuration. OpenClaw follows a deny-by-default model β agents can only use tools you explicitly allow.
# Enable a tool for your agent in its YAML file:
tools:
- github:
permissions:
- read_issues
- create_comments # Can comment, but NOT close issues
- postgres:
connection: $DATABASE_URL
permissions:
- read_only # Can query, but NOT write
This granular permission system is what makes OpenClaw safer than most alternatives. Never give an agent more permissions than it needs.
09Quick Security Checklist Before You Go Further
Before you dive deeper, run through this quick security checklist. If you can check every box, you're in great shape:
- β .env file is in your .gitignore
- β Sandbox mode is enabled in openclaw.config.yaml
- β API key has been stored securely (not hardcoded in any file)
- β Agent permissions follow the principle of least privilege
- β Network access is disabled unless explicitly needed
- β 2FA is enabled on your OpenClaw dashboard account
- β Logs directory is not publicly accessible
Missing any of these? Fix them now. It takes 5 minutes and prevents 90% of common security issues.
This checklist covers the basics, but there's much more to learn about securing your OpenClaw setup β especially if you're deploying agents in production, handling sensitive data, or building tools that access external services.
Want the complete security playbook? The LearnClaw Security Guide covers 30+ chapters of security hardening, compliance checklists (GDPR & CCPA), and real-world scenarios with step-by-step solutions.
10Next Steps: Where to Go From Here
Congratulations β you now have a working OpenClaw setup! Here's what to explore next:
- Build more agents β try creating agents for different tasks (writing, research, code review, data analysis)
- Explore the plugin ecosystem β the OpenClaw community has published hundreds of tools and integrations
- Set up CI/CD β use OpenClaw agents in your development pipeline for automated code review and testing
- Join the community β the OpenClaw Discord and forums are excellent resources for getting help and sharing ideas
- Harden your security β this guide covers the basics, but production deployments need more advanced security measures
The single most important thing you can do right now? Secure your setup properly. Most OpenClaw incidents happen because users skip the security basics. Don't be that person.
Check out our other articles on the VibeLab blog for more OpenClaw tips, security guides, and tutorials. And if you want a comprehensive, step-by-step security playbook, the LearnClaw Security Guide has everything you need.
Ready to Master OpenClaw Security?
This article gets you started β but security is where most users get stuck. The LearnClaw Security Guide covers every setting, every risk, and every hardening step with 120+ pages, screenshots, and checklists.
Buy the guide β $29120+ pages Β· Instant PDF download Β· 30-day guarantee