How to Run OpenClaw AI Agents on Raspberry Pi
Turn a $60 Raspberry Pi into an always-on AI agent that monitors your systems, automates tasks, and responds via Telegram. Draws less power than a light bulb. Runs 24/7 without your laptop open.
Why Raspberry Pi for AI Agents?
The Raspberry Pi team recently published a guide on running OpenClaw agents on the Pi 5, and Adafruit picked it up the same day. The reason is simple: a Raspberry Pi is the cheapest way to run an always-on AI agent.
Your laptop sleeps. Cloud VMs cost $5-20/month. A Raspberry Pi 5 sits on your desk, draws 5 watts, costs pennies per month in electricity, and runs OpenClaw with zero maintenance. It is always on, always listening, always working.
As the Raspberry Pi team put it: “Running OpenClaw on a standalone device like a Raspberry Pi gives you isolation, control, and peace of mind, all while benefiting from a system that’s always on, energy efficient, and quietly doing in the background.”
What You Need
Raspberry Pi 5 (8 GB) — The 4 GB model works too, but 8 GB gives headroom for multiple agents.
microSD card (32 GB+) — Or an NVMe SSD via the Pi 5 HAT for better performance.
Power supply (27W USB-C) — The official Raspberry Pi 5 power supply is recommended.
Ethernet or Wi-Fi — For API calls to your model provider and Telegram/Slack access.
API key (Anthropic, OpenAI, or Google) — For cloud inference. Or use Ollama for local models (limited on Pi).
Step 1: Flash Raspberry Pi OS and Boot
Download the Raspberry Pi Imager, flash Raspberry Pi OS (64-bit Lite) to your microSD card, and enable SSH during the imaging process so you can connect headlessly.
# Flash the SD card using Raspberry Pi Imager
# 1. Download: https://www.raspberrypi.com/software/
# 2. Choose "Raspberry Pi OS (64-bit) Lite"
# 3. Enable SSH + set username/password in settings
# 4. Flash and insert the card
# Boot and SSH into your Pi
ssh pi@raspberrypi.local
# Update the system
sudo apt update && sudo apt upgrade -yThe Lite version (no desktop) is recommended for running agents. It uses less memory and boots faster, leaving more resources for OpenClaw.
Step 2: Install Node.js 22
OpenClaw requires Node.js 22 or later. The default Raspberry Pi OS repositories ship an older version, so install from the NodeSource repository.
# Install Node.js 22 from NodeSource
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
sudo apt-get install -y nodejs
# Verify installation
node --version # Should show v22.x.x
npm --version # Should show 10.x.x
# Install OpenClaw globally
sudo npm install -g openclawStep 3: Generate Your Agent Config
Every OpenClaw agent needs a SOUL.md file that defines its role, rules, and capabilities. You can write one from scratch or use the CrewClaw Generator to build one in seconds.
Pick a role, select integrations, customize the tone, and download the complete SOUL.md package. Then transfer it to your Pi.
# On your Pi, create the agent workspace
mkdir -p ~/agents/monitor
cd ~/agents/monitor
# Option A: Transfer SOUL.md from your computer
# (after generating it with CrewClaw)
scp SOUL.md pi@raspberrypi.local:~/agents/monitor/
# Option B: Create a minimal one directly
cat > SOUL.md << 'EOF'
# System Monitor Agent
## Identity
You are a system monitoring agent running on a Raspberry Pi.
You watch server health, disk usage, and uptime metrics.
## Rules
- Check system stats when asked
- Alert if disk usage exceeds 80%
- Alert if any monitored service goes down
- Report in concise bullet points
## Skills
- system-health: Check CPU, memory, disk, and network stats
- uptime-monitor: Track and report service availability
## Tone
Direct. No filler. Numbers first.
EOFTip: The CrewClaw Generator has pre-built templates for DevOps, Metrics, Support, and 17 other roles. Each template includes skills, rules, and integrations tuned for that use case. Try it free →
Step 4: Initialize OpenClaw and Add Your Agent
# Initialize OpenClaw
openclaw init
# Configure your model provider
openclaw models auth paste-token --provider anthropic
# Paste your API key when prompted
# Register your agent
openclaw agents add monitor --workspace ~/agents/monitor --non-interactive
# Test it with a message
openclaw agent --agent monitor --message "What is the current system status?"
# Start the gateway for web/Telegram access
openclaw gateway startThe gateway runs on port 18789 by default. You can access it locally at http://raspberrypi.local:18789 from any device on your network.
Step 5: Run on Boot with systemd
The whole point of running on a Pi is always-on availability. Create a systemd service so OpenClaw starts automatically on boot and restarts if it crashes.
# Create a systemd service file
sudo tee /etc/systemd/system/openclaw.service << 'EOF'
[Unit]
Description=OpenClaw AI Agent Gateway
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=pi
WorkingDirectory=/home/pi
ExecStart=/usr/bin/openclaw gateway start
Restart=always
RestartSec=10
Environment=NODE_ENV=production
[Install]
WantedBy=multi-user.target
EOF
# Enable and start the service
sudo systemctl enable openclaw
sudo systemctl start openclaw
# Check status
sudo systemctl status openclawYour OpenClaw agent now survives reboots, power cycles, and crashes. Check logs anytime with journalctl -u openclaw -f.
Step 6: Connect Telegram for Mobile Access
The most practical way to interact with your Pi-based agent is through Telegram. You get push notifications, mobile access, and no need to SSH into the Pi.
# 1. Create a Telegram bot via @BotFather
# 2. Copy the bot token
# 3. Configure OpenClaw Telegram integration
openclaw integrations add telegram --token YOUR_BOT_TOKEN
# 4. Restart the gateway
sudo systemctl restart openclaw
# Now message your bot on Telegram — it routes to your agentWith Telegram connected, you can message your agent from your phone, get alerts when something goes wrong, and manage tasks from anywhere.
What to Run on Your Pi
A Raspberry Pi with OpenClaw is ideal for agents that need to be always on but do not require heavy computation.
Home Lab Monitor
Track uptime, disk space, and Docker container health across your home network.
Expense Tracker
Parse receipts and bank alerts forwarded via email. Categorize and log to a spreadsheet.
News Digest
Scan RSS feeds and Hacker News every morning. Send a 5-bullet summary to Telegram.
Smart Home Bridge
Connect Home Assistant events to natural language commands via OpenClaw.
Git Watcher
Monitor repos for new issues and PRs. Summarize changes and notify via Telegram.
Meeting Prep
Pull calendar events each morning and prepare briefing notes from relevant docs.
Performance Tips for Pi Deployments
Use an NVMe SSD. The Pi 5 supports NVMe via the official HAT. SD cards are slow for I/O-heavy agent operations. An NVMe SSD makes the gateway start in 2 seconds instead of 8.
Use cloud models, not local. The Pi 5’s ARM CPU is not fast enough for local LLM inference at production quality. Use Anthropic Claude or OpenAI for the AI work and let the Pi handle orchestration.
Keep agents lightweight. Avoid loading massive context windows. Design your SOUL.md with concise rules and focused skills. Smaller context means faster responses and lower API costs.
Monitor with HEARTBEAT.md. OpenClaw’s heartbeat feature lets agents run scheduled tasks. Set a 5-minute heartbeat for monitoring agents or a daily heartbeat for digest agents.
Running Local Models on Pi (Ollama)
If you want fully offline, zero-API-cost agents, you can run Ollama on the Pi 5. Performance is limited but usable for simple tasks.
# Install Ollama on Pi (ARM64 supported)
curl -fsSL https://ollama.com/install.sh | sh
# Pull a small model that fits in 8 GB RAM
ollama pull gemma:2b # 1.4 GB, fast on Pi 5
ollama pull phi3:mini # 2.3 GB, better quality
# Configure OpenClaw to use Ollama
openclaw models auth paste-token --provider ollama
# Press Enter when prompted (no key needed)| Model | Size | Speed on Pi 5 | Best For |
|---|---|---|---|
| Gemma 2B | 1.4 GB | ~8 tok/s | Classification, short responses |
| Phi-3 Mini | 2.3 GB | ~5 tok/s | General tasks, reasoning |
| Mistral 7B | 4.1 GB | ~2 tok/s | Slow but capable (8 GB Pi only) |
For anything beyond simple classification or short responses, cloud APIs are the better choice on Pi hardware. Reserve local models for offline or privacy-critical use cases.
Frequently Asked Questions
Can the Raspberry Pi 5 run large language models locally?
The Pi 5 with 8 GB RAM can run small models like Gemma 2B or Phi-3 Mini through Ollama, but performance is limited compared to a desktop GPU. For most production use cases, the Pi works best as a thin client that sends requests to cloud APIs (Anthropic, OpenAI) while running the OpenClaw gateway and agent logic locally. This gives you always-on availability with cloud-grade AI quality.
How much does it cost to run an OpenClaw agent on Raspberry Pi?
The Raspberry Pi 5 draws about 5-8 watts under typical agent load. That translates to roughly $3-5 per month in electricity for a device running 24/7. The Pi 5 board itself costs around $60-80. API costs depend on your provider and usage — a lightly used agent (50-100 messages per day) typically costs $1-5 per month with Anthropic Claude. Total cost: under $10/month for an always-on AI agent.
Which Raspberry Pi model should I use for OpenClaw?
The Raspberry Pi 5 with 8 GB RAM is the recommended choice. It has enough power to run the OpenClaw gateway, Node.js, and handle multiple concurrent agent sessions. The Pi 4 (4 GB or 8 GB) also works but is noticeably slower. The Pi Zero 2W can run PicoClaw for lightweight single-agent setups but is not suitable for the full OpenClaw gateway.
Can I run multiple OpenClaw agents on a single Raspberry Pi?
Yes. The OpenClaw gateway supports multiple agents on a single device. A Pi 5 with 8 GB RAM can comfortably run 3-5 agents simultaneously when using cloud APIs for inference. Each agent has its own SOUL.md configuration and workspace. If you are running local models through Ollama, you are limited to one active model at a time due to memory constraints.
Is it safe to expose my Raspberry Pi OpenClaw agent to the internet?
Do not expose the OpenClaw gateway port directly to the internet. Instead, use a reverse proxy like Caddy or Nginx with HTTPS, or connect through Telegram or Slack integrations which handle authentication for you. For remote access, Tailscale or WireGuard VPN is the safest approach — it gives you access to your Pi from anywhere without opening ports to the public internet.
What happens if my Raspberry Pi loses power or reboots?
With the systemd service configuration shown in this guide, OpenClaw automatically restarts after a reboot or crash. Agent sessions are persisted to disk, so conversations resume where they left off. For critical deployments, consider adding a UPS HAT (uninterruptible power supply) to your Pi to handle brief power outages gracefully.
Generate Your Pi Agent Config in Seconds
Pick a role, customize the config, download the SOUL.md package, and deploy to your Raspberry Pi. The generator is free to use.