Tutorials
Hands-on walkthroughs for common OpenClaw use cases. Follow from start to finish or jump to any section.
Learning Path Overview
Choose your starting point based on your experience level. Each path links directly to the relevant tutorials and documentation below.
New to OpenClaw
No prior AI automation experience needed
- Your First OpenClaw Task — 5 min ▶
- Installing OpenClaw on Your OS — 10 min ▶
- Setting Up API Keys — 5 min ▶
- Tutorial 1: First Automation — 5 min ▶
- Tutorial 4: Local LLM with Ollama — 10 min ▶
Goal: Run your first automated task from the terminal.
Comfortable with the CLI
Ready to build real workflows
- Automating Your Morning Routine — 15 min ▶
- Building Your First AI Pipeline — 20 min ▶
- Using OpenClaw for Code Review — 15 min ▶
- Scheduling Recurring Tasks — 10 min ▶
- Tutorial 2: Daily Report Automation — 15 min ▶
Goal: Automate a real daily workflow end-to-end.
Power user & developer
Build production-grade systems
- Multi-Agent Pipelines — 25 min ▶
- Building Custom Tools — 30 min ▶
- Self-Hosted OpenClaw on a Server — 20 min ▶
- Tutorial 3: GitHub Auto Code Review Bot — 20 min ▶
- Autonomous Workflow Design — 20 min ▶
Goal: Build and ship a production AI automation system.
Tutorial 1: Your First Automation in 5 Minutes
Install OpenClaw, connect an LLM, and run your first automated task.
# Step 1: Install
pip install openclaw
# Step 2: Set API key
export OPENCLAW_API_KEY="sk-..."
# Step 3: Run first task
openclaw run "Summarise the README of this project" --file README.mdThat is all. OpenClaw reads the file, sends it through the LLM, and prints the summary.
Tutorial 2: Automate a Daily Report
Create a script that reads your project folder every morning and emails a status update.
#!/usr/bin/env bash
# daily-report.sh
REPORT=$(openclaw run \
"Summarise progress for this project, highlight blockers, and list next steps." \
--file /workspace/project/ \
--format markdown)
# Send via sendmail, mailgun, or any SMTP tool
echo "$REPORT" | mail -s "Daily Project Report - $(date +%F)" team@example.com
echo "Report sent."Add to cron:
0 8 * * 1-5 /home/user/scripts/daily-report.shTutorial 3: Code Review Bot
Review every pull request automatically in GitHub Actions.
# .github/workflows/code-review.yml
name: AI Code Review
on: [pull_request]
jobs:
review:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: pip install openclaw
- name: Review diff
env:
OPENCLAW_API_KEY: ${{ secrets.OPENCLAW_API_KEY }}
run: |
git diff origin/${{ github.base_ref }}...HEAD > diff.patch
openclaw run "Review this diff for bugs, security issues, and style problems. Be concise." \
--file diff.patch --format markdown > review.md
cat review.mdTutorial 4: Local LLM with Ollama
Run completely offline with no API costs.
# Install Ollama
curl -fsSL https://ollama.com/install.sh | sh
# Pull a model
ollama pull llama3.2
# Point OpenClaw at it
openclaw config set provider ollama
openclaw config set model llama3.2
openclaw config set base_url http://localhost:11434
# Test
openclaw run "hello world"Tutorial 2: Build a Daily Assistant Script
Goal: Create a script that runs every morning and delivers a personalized briefing via Telegram.
Step 1: Write the script
cat > ~/scripts/morning-assistant.sh <<'EOF'
#!/usr/bin/env bash
# morning-assistant.sh
# Gather context
WEATHER=$(curl -s "wttr.in/?format=3")
NEWS=$(curl -s "https://feeds.bbci.co.uk/news/technology/rss.xml" | grep -o '<title>[^<]*</title>' | head -10 | sed 's/<\/?title>//g')
PENDING_TASKS=$(cat ~/todo.txt 2>/dev/null | head -10)
# Ask AI to create a briefing
BRIEFING=$(printf "Weather: %s\n\nTop tech news:\n%s\n\nPending tasks:\n%s" \
"$WEATHER" "$NEWS" "$PENDING_TASKS" | \
openclaw run "Write a concise morning briefing (under 200 words). Be direct and actionable. Start with weather, then news highlights, then my top 3 tasks for today.")
# Deliver
openclaw telegram send "Good morning!\n\n$BRIEFING"
EOF
chmod +x ~/scripts/morning-assistant.shStep 2: Schedule it
# Add to crontab
(crontab -l 2>/dev/null; echo "0 8 * * 1-5 ~/scripts/morning-assistant.sh") | crontab -Tutorial 3: GitHub Auto Code Review Bot
Goal: Automatically review every pull request and post an AI review as a comment.
Step 1: Create the workflow
# .github/workflows/ai-code-review.yml
name: AI Code Review
on:
pull_request:
types: [opened, synchronize]
jobs:
review:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with: { fetch-depth: 0 }
- run: pip install openclaw
- name: Generate review
env:
OPENCLAW_API_KEY: ${{ secrets.OPENCLAW_API_KEY }}
run: |
git diff origin/${{ github.base_ref }}...HEAD > diff.patch
openclaw run "Review this diff as a senior engineer. Flag: bugs, security issues, missing tests. Format as a GitHub-flavoured Markdown checklist." \
--file diff.patch > review.md
- name: Post comment
uses: actions/github-script@v7
with:
script: |
const review = require('fs').readFileSync('review.md', 'utf8');
github.rest.issues.createComment({
...context.repo,
issue_number: context.issue.number,
body: review
});See Automation Examples for a complete script library and Use Cases for real-world scenarios.
Tutorial 4: Automated Data Analysis Pipeline
Goal: Build a weekly pipeline that pulls a CSV from your data source, analyses it with OpenClaw, and emails the summary.
Step 1: Create the analysis script
cat > ~/scripts/weekly-analysis.sh <<'EOF'
#!/usr/bin/env bash
set -euo pipefail
DATE=$(date +%Y-%m-%d)
# Pull data (adapt to your source)
curl -s "https://your-app.com/api/export/week.csv" \
-H "Authorization: Bearer $API_TOKEN" \
-o "/tmp/data-$DATE.csv"
# Analyse with OpenClaw
openclaw run \
"Analyse this weekly CSV data. Identify the top 3 trends, \
any anomalies or drops, and write a 3-paragraph executive summary." \
--file "/tmp/data-$DATE.csv" \
--model gpt-4o \
--output "/tmp/summary-$DATE.md"
# Convert and send
pandoc "/tmp/summary-$DATE.md" -o "/tmp/summary-$DATE.html"
python3 ~/scripts/send_email.py \
--to "team@company.com" \
--subject "Weekly Analysis — $DATE" \
--body "/tmp/summary-$DATE.html"
echo "Weekly analysis done for $DATE"
EOF
chmod +x ~/scripts/weekly-analysis.shStep 2: Schedule weekly
# Every Monday at 07:30
(crontab -l 2>/dev/null; echo "30 7 * * 1 ~/scripts/weekly-analysis.sh >> ~/logs/analysis.log 2>&1") | crontab -Tutorial 5: Build a Custom Tool for OpenClaw
Goal: Register a custom Python function as an OpenClaw tool so the agent can call it autonomously during task execution.
Use case: Query your internal database
# tools/internal_db.py
from openclaw.tools import register_tool
import sqlite3, json
@register_tool(
name="query_sales_db",
description="Query the sales database. Returns JSON rows. "
"Only accepts read-only SELECT statements."
)
def query_sales_db(sql: str) -> str:
conn = sqlite3.connect("/data/sales.db")
try:
rows = conn.execute(sql).fetchall()
cols = [d[0] for d in conn.execute(sql).description]
return json.dumps([dict(zip(cols, r)) for r in rows])
finally:
conn.close()Register and use
# Load your custom tool
openclaw run "What were the top 5 products by revenue last month?" \
--tools tools/internal_db.py \
--model gpt-4o
# The agent will call query_sales_db() with an appropriate SELECT query,
# receive the JSON rows, and produce a natural-language answer.Tool safety guidelines
- Always validate and sanitize SQL — use parameterized queries for user-provided values
- Restrict to read-only for database tools (
SELECTonly) - Log all tool calls for auditing: check
~/.local/share/openclaw/logs/ - Set
allow_command_exec: falsein config when using custom tools that substitute for shell access
What to Learn Next
You have completed the core tutorial series. Here is where to go from here:
| Your Goal | Go To |
|---|---|
| Write better, more reliable prompts | Best Practices → |
| See real production deployments | Case Studies → |
| Multi-agent and event-driven workflows | Advanced Automation → |
| Choose the right AI agent tool | OpenClaw vs AutoGPT → |
| Explore automation patterns | Automation Guides → |
Discussion