02-347-7730  |  Saeree ERP - Complete ERP Solution for Thai Businesses Contact Us

Install OpenClaw & First AI Agent

  • Home
  • Blog
  • Install OpenClaw & First AI Agent
Install OpenClaw Build First AI Agent Step by Step WhatsApp Telegram
  • 3
  • April

OpenClaw Deep Dive Series EP.1 — From EP.0 where we introduced what OpenClaw is and why it has over 219,000 GitHub Stars in just a few months, it's now time to get hands-on! In EP.1 we will install OpenClaw on your machine, build your first AI Agent, connect it to a Chat Platform like WhatsApp or Telegram, and test real commands — all done within 30 minutes. No prior AI experience required.

In short — 6 steps to build your first AI Agent with OpenClaw:

  • Prepare Prerequisites — Node.js v20+, Git, API Key (Claude/GPT)
  • Clone + Install OpenClaw — git clone then npm install
  • Set up API Key — Choose the LLM that will serve as the Agent's "brain"
  • Connect a Chat Platform — WhatsApp (QR scan) / Telegram (Bot Token)
  • Create your first Agent — Define the System Prompt + Allowed Tools
  • Test real commands — Summarize emails, search news, create files, set reminders

What You Need Before Getting Started (Prerequisites)

OpenClaw is an open-source AI Agent built with Node.js, so your machine needs these basic tools first:

Item Minimum Version Why It's Needed Download
Node.js v20 or higher Runtime for running OpenClaw nodejs.org
Git v2.x Download Source Code from GitHub git-scm.com
API Key (LLM) - The "brain" of the Agent — use Claude, GPT, or Gemini Anthropic / OpenAI / Google
Chat Platform - Communication channel with the Agent (WhatsApp, Telegram, etc.) Choose whichever you already use

About API costs: Claude API costs approximately ~$3 per 1 million tokens, GPT-4o approximately ~$2.50 per 1 million tokens — for personal use, costs are typically under $1/month. But if you don't want to pay for an API at all, you can use Ollama to run AI on your own machine for 100% free (see details at the end of this article).

Step 1 — Install OpenClaw

Start by downloading the Source Code from GitHub and installing the Dependencies:

# Clone OpenClaw from GitHub
git clone https://github.com/openclaw/openclaw.git

# Navigate to the folder
cd openclaw

# Install Dependencies
npm install

# Verify successful installation
npm run version

Next, set up the API Key by copying the example file and editing it:

# Copy the example Config file
cp .env.example .env

# Edit the .env file and add your API Key
nano .env

Key variables in the .env file:

Variable Description Example
ANTHROPIC_API_KEY API Key for Claude (Anthropic) sk-ant-api03-xxxx...
OPENAI_API_KEY API Key for GPT (OpenAI) sk-xxxx...
OLLAMA_URL URL of your Ollama Server (if using Local AI) http://localhost:11434
DEFAULT_MODEL Default model to use claude-sonnet-4-20250514

You only need one API Key — if you have ANTHROPIC_API_KEY, you don't need OPENAI_API_KEY (choose one or the other, or add both and switch between them).

Step 2 — Connect a Chat Platform

OpenClaw supports multiple Chat Platforms, each with a different connection method:

Platform Difficulty How to Connect Advantages
WhatsApp Easiest Scan QR Code from your phone Works instantly, no Bot creation needed
Telegram Easy Create a Bot via @BotFather and add the Token Bot is separate from your personal account, more secure
Discord Medium Create a Bot in Developer Portal + add Token Great for teams, has separate Channels by topic
Slack Medium Create a Slack App + set Permissions Ideal for organizations already using Slack

Connect WhatsApp (Recommended — Easiest)

# Run OpenClaw in WhatsApp connection mode
npm run connect:whatsapp

# A QR Code will appear on the Terminal screen
# Open WhatsApp on your phone -> Settings -> Linked Devices -> Link a Device
# Scan the QR Code -> Connected successfully!

Connect Telegram

# 1. Open Telegram and search for @BotFather
# 2. Type /newbot and set a name for the Bot
# 3. You'll receive a Token like 123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11

# 4. Add the Token to your .env file
TELEGRAM_BOT_TOKEN=123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11

# 5. Run OpenClaw
npm run connect:telegram

Step 3 — Create Your First Agent

An Agent in OpenClaw is defined by a Config File that specifies the "personality" (System Prompt) and "capabilities" (Allowed Tools) of the Agent:

# agents/my-first-agent.yaml

name: "Saeree"
description: "General-purpose AI Assistant"

system_prompt: |
  Your name is "Saeree" and you are an AI Assistant for general tasks.
  Respond politely, concisely, and clearly.
  If you are unsure, ask before taking action.

model: "claude-sonnet-4-20250514"

allowed_tools:
  - file_system     # Read/write files
  - shell           # Run Shell Commands
  - browser         # Open web pages, search for information
  - email           # Read/send emails
  - calendar        # Manage calendar

max_tokens: 4096
temperature: 0.7

The System Prompt is the "personality" of the Agent — it defines how the Agent speaks, what language it uses, and what restrictions it has. The Allowed Tools control what the Agent can do — if you don't enable shell, the Agent cannot run commands. This helps limit the scope of operations for safety.

Start the Agent:

# Run the Agent you created
npm start -- --agent agents/my-first-agent.yaml

# Or if you already connected WhatsApp
npm start -- --agent agents/my-first-agent.yaml --platform whatsapp

Step 4 — Test Real Commands

Once the Agent is running, try sending these messages through the Chat Platform you connected:

Command Sent What the Agent Does Kernel Module Used
"Summarize today's emails" Agent reads the Inbox and provides a brief summary by topic Email Module
"Search for AI news today" Agent opens a Browser, searches for news, and summarizes the top 5 items Browser Module
"Create a file report.txt summarizing this month's sales" Agent creates a new file with generated content File System Module
"Remind me about the 3 PM meeting" Agent sets a Reminder in the calendar and sends a notification when it's time Calendar Module
"Check disk space on this machine" Agent runs df -h and summarizes the results in an easy-to-read format Shell Module

Warning — The Agent has full access to your machine!

  • Be cautious with delete commands — If File System + Shell Module are enabled and you say "delete all files in /tmp", the Agent will actually do it
  • Don't run the Agent as root — Create a dedicated user with limited permissions (following the Least Privilege principle)
  • Start with few Allowed Tools — Enable only the Modules you need, add more later
  • Test on a Dev machine first — Never start on a Production machine

Kernel Modules — Extending Agent Capabilities

The Kernel Module is the heart of OpenClaw — a Plugin system that adds capabilities to the Agent without modifying the core code. Built-in Modules include:

Module Capabilities Example Use Case
File System Read/write/delete/move files "Create a report summarizing the data as a CSV file"
Shell Run Command Line / Scripts "Check which process is using the most CPU"
Browser Open web pages, search, read content "Search for GPU RTX 5090 prices in Thailand"
Email Read/send/reply to emails "Draft a reply email to the client about the quotation"
Calendar View/create/edit appointments "Schedule a meeting with the IT team on Friday at 2 PM"
Smart Home Control IoT devices "Turn on the meeting room lights, set AC to 25 degrees"
API Call external REST APIs "Fetch today's exchange rates"

How to enable/disable Modules in the Config file:

# agents/my-first-agent.yaml

# Enable only the Modules you need
allowed_tools:
  - file_system     # enabled
  - browser         # enabled
  - email           # enabled
  # - shell         # disabled — don't allow running commands
  # - smart_home    # disabled — not needed
  # - calendar      # disabled — not needed yet

# Or enable all (not recommended for Production)
# allowed_tools: all

Read more about Kernel Module — How to Install and Use

Use Ollama Instead of Cloud API (100% Free)

If you don't want to pay for a Claude or GPT API Key, you can use Ollama to run AI Models on your own machine instead. Your data never leaves your network:

# 1. Install Ollama (if you haven't already)
# See installation guide: ollama-install.html
curl -fsSL https://ollama.com/install.sh | sh

# 2. Download a Model (qwen2.5 or llama3 recommended)
ollama pull qwen2.5

# 3. Edit OpenClaw's .env file
OLLAMA_URL=http://localhost:11434
DEFAULT_MODEL=qwen2.5

# 4. Run the Agent as usual
npm start -- --agent agents/my-first-agent.yaml

Note: Performance depends on your machine's GPU — an NVIDIA RTX 3060 or higher will run smoothly, but without a GPU it will be much slower than Cloud API. Recommended models are qwen2.5 (lightweight, fast, good multilingual support) or llama3 (smarter, but requires more RAM). Read more at How to Install Ollama and Ollama API

Saeree ERP + AI Agent:

Saeree ERP is developing an AI Assistant that will allow users to interact with the ERP system using natural language. Interested in an ERP system ready to integrate AI in the future? Consult our team for free, no charge

OpenClaw Deep Dive Series — Read More

"OpenClaw transforms AI from a Chatbot that only answers questions into an Agent that can actually take action on your behalf — and you can get started in just 30 minutes."

- Saeree ERP Team

References

Interested in ERP for Your Organization?

Consult with Grand Linux Solution experts — free of charge

Request Free Demo

Call 02-347-7730 | sale@grandlinux.com

Saeree ERP Author

About the Author

Paitoon Butri

Network & Server Security Specialist, Grand Linux Solution Co., Ltd.