OpenClaw AI Tutorials
Hands-on step-by-step guides — from building your first OpenClaw agent to complex multi-step automation workflows. Each tutorial includes complete, runnable code.
How to Use These Tutorials
Each tutorial provides complete, copy-paste-ready code that you can run immediately after the installation and configuration steps. Tutorials are grouped by difficulty level:
- Beginner — no prior agent experience needed; assumes only basic Python knowledge. Average completion time: 15–30 minutes.
- Intermediate — requires familiarity with the basics from the beginner set; introduces multi-tool agents and external API integrations. Average time: 45–90 minutes.
- Advanced — assumes proficiency with intermediate concepts; covers multi-agent orchestration and production patterns. Average time: 2–4 hours.
New to OpenClaw? Start with Your First Agent — it walks you through every step from provider setup to running your first task in under 15 minutes.
Beginner
Your First Agent
Install OpenClaw, configure a provider, and run your first 10-line AI agent in minutes.
Start here →File Organizer Agent
Build an agent that watches a folder and auto-organizes files by type and date.
Read →Email Agent
Create an agent that reads, summarizes, categorizes, and drafts email replies.
Read →Intermediate
Web Scraper Agent
Crawl websites, extract structured data, and save to CSV or database automatically.
Read →Code Review Bot
Integrate with GitHub PRs to auto-review code for bugs, style, and security issues.
Read →Research Agent
Search the web, summarize sources, and produce structured research reports.
Read →API Integration Agent
Connect to REST APIs, handle auth, pagination, and transform responses.
Read →Advanced
Multi-Step Workflow
Chain tools and sub-agents into a complex data pipeline with error recovery.
Read →DevOps Automation Agent
Monitor CI/CD pipelines, triage failures, create Jira tickets, and notify Slack.
Read →Featured Tutorial: Your First Research Agent
This example from the Research Agent tutorial shows how to build a fully functional agent that searches the web and writes a structured report — in under 30 lines of Python:
import openclaw
# Create a research agent with web search capability
agent = openclaw.Agent(
provider="openai",
model="gpt-4o-mini",
tools=["web_search", "fetch_url"],
max_iterations=15,
system_prompt="""
You are a research assistant. When given a topic:
1. Search for the 3 most recent and relevant sources.
2. Read each source using fetch_url.
3. Write a 500-word summary with key findings.
4. List all sources with URLs.
Format: Markdown with H2 sections.
"""
)
# Run the agent
result = agent.run("What are the latest developments in AI regulation in the EU?")
print(result.output)
# Save the report
with open("eu-ai-regulation-report.md", "w") as f:
f.write(result.output)
print(f"Done in {result.elapsed_seconds:.1f}s using {result.tokens_used['total']} tokens")Featured Code: GitHub PR Code Review Bot
From the Code Review Bot tutorial — trigger an OpenClaw agent from a GitHub Actions webhook to automatically review every pull request:
from flask import Flask, request
import openclaw, hmac, hashlib, os
app = Flask(__name__)
client = openclaw.Client()
@app.post("/webhook/github")
def github_pr_webhook():
# Verify GitHub HMAC signature
sig = request.headers.get("X-Hub-Signature-256", "")
secret = os.environ["GITHUB_WEBHOOK_SECRET"].encode()
expected = "sha256=" + hmac.new(secret, request.data, hashlib.sha256).hexdigest()
if not hmac.compare_digest(expected, sig):
return "Forbidden", 403
event = request.json
if event.get("action") not in ("opened", "synchronize"):
return "OK", 200
pr = event["pull_request"]
diff_url = pr["diff_url"]
pr_number = pr["number"]
# Trigger OpenClaw code review agent
run = client.agents.run(
"agnt_code_reviewer",
input=f"Review the pull request diff at {diff_url}. "
f"List bugs, security issues, and style improvements.",
)
result = run.wait()
# Post review comment back to GitHub
post_pr_comment(pr["html_url"], pr_number, result.output)
return "OK", 200Suggested Learning Path
- 🚀 Start: Getting Started — install OpenClaw and verify setup
- 🎯 First win: Your First Agent — run an agent in minutes
- 📚 Learn fundamentals: Agent Loops and Prompt Engineering
- 🔧 Add tools: File Organizer and Web Scraper
- 🧠 Add memory: Memory Systems guide
- 🤝 Scale up: Multi-Step Workflow and Multi-Agent
- 🚀 Deploy: Deployment Guide