🐦 PicoClaw — Lightweight AI Agent
AI Agent siêu nhẹ viết bằng Go — chạy trên Raspberry Pi, IoT devices, edge computing với tài nguyên tối thiểu.
Go
IoT
Edge Computing
Lightweight
Sau bài này bạn sẽ
- Hiểu tại sao cần AI agent nhẹ cho edge/IoT
- Biết PicoClaw khác gì OpenClaw
- Cài đặt PicoClaw trên Raspberry Pi hoặc VPS
- Cross-compile binary cho ARM devices
- Chạy agent đầu tiên với tài nguyên < 50MB RAM
Dành cho
IoT developers, embedded engineers, hobbyists với Raspberry Pi
Yêu cầu trước
Go 1.21+, Linux cơ bản, hiểu OpenClaw concepts
⏱️ Thời gian
~15 phút
📑 Mục lục
1. Tại sao cần AI agent nhẹ?
OpenClaw chạy trên Node.js, cần ~200MB RAM và server đàng hoàng. Nhưng nhiều trường hợp bạn muốn AI agent chạy trên:
- Raspberry Pi — chỉ có 512MB-1GB RAM
- IoT gateway — thiết bị nhỏ gọn, ít tài nguyên
- Edge servers — xử lý tại chỗ, không gửi data ra cloud
- VPS giá rẻ — $2.5/tháng chỉ có 256MB RAM
PicoClaw là phiên bản siêu nhẹ của OpenClaw, viết bằng Go — compile thành binary duy nhất, chạy ngay không cần runtime, chỉ tốn ~30-50MB RAM.
Ví dụ thực tế: Raspberry Pi 4 (4GB) có thể chạy đồng thời 10+ PicoClaw agents, mỗi agent giám sát một sensor khác nhau và gửi cảnh báo qua Telegram.
2. Tại sao Go?
Go (Golang) được chọn vì:
| Đặc điểm | Go | Node.js (OpenClaw) | Python |
|---|---|---|---|
| Binary size | ~10MB | ~100MB+runtime | ~50MB+runtime |
| RAM usage | 30-50MB | 150-300MB | 200-400MB |
| Startup time | < 100ms | 2-5s | 3-8s |
| Cross-compile | 1 lệnh | ❌ Cần runtime | ❌ Cần runtime |
| Concurrency | Goroutines | ⚠️ Event loop | ⚠️ GIL |
3. PicoClaw vs OpenClaw vs ZeroClaw
| Tiêu chí | PicoClaw | OpenClaw | ZeroClaw |
|---|---|---|---|
| Ngôn ngữ | Go | TypeScript | Rust |
| RAM tối thiểu | 30MB | 200MB | 15MB |
| Target | IoT, Edge | Server | High-perf server |
| Skills | Core only | Full ecosystem | Plugin system |
| Dễ học | Khó | ||
| Khi nào dùng | Thiết bị nhỏ | Đa năng | Scale lớn |
4. Cài đặt PicoClaw
Cách 1: Download binary (không cần Go)
terminal
# Linux AMD64
curl -LO https://github.com/openclaw/picoclaw/releases/latest/download/picoclaw-linux-amd64
chmod +x picoclaw-linux-amd64
mv picoclaw-linux-amd64 /usr/local/bin/picoclaw
# Raspberry Pi (ARM64)
curl -LO https://github.com/openclaw/picoclaw/releases/latest/download/picoclaw-linux-arm64
chmod +x picoclaw-linux-arm64
mv picoclaw-linux-arm64 /usr/local/bin/picoclaw
Cách 2: Build từ source
terminal
# Cần Go 1.21+
go version
git clone https://github.com/openclaw/picoclaw.git
cd picoclaw
go build -o picoclaw ./cmd/picoclaw
Cross-compile cho ARM
terminal
# Compile trên laptop, chạy trên Raspberry Pi
GOOS=linux GOARCH=arm64 go build -o picoclaw-arm64 ./cmd/picoclaw
# Copy sang Pi
scp picoclaw-arm64 [email protected]:~/picoclaw
Cấu hình
config.yaml
agent:
name: "PicoAssistant"
model: "gpt-4o-mini" # dùng model nhẹ
llm:
provider: "openai"
api_key: "${OPENAI_API_KEY}"
telegram:
bot_token: "${TELEGRAM_BOT_TOKEN}"
allowed_users: [123456789]
resources:
max_memory_mb: 50
max_history: 20 # giới hạn conversation history
terminal
./picoclaw --config config.yaml
📤 Kết quả mong đợi
PicoClaw v0.8.2 starting... Memory limit: 50MB | Binary: 12MB LLM: OpenAI gpt-4o-mini ✓ Telegram: connected ✓ Skills: [web_search, system_info] Ready. RSS: 34MB → Gửi tin nhắn cho bot trên Telegram để test
5. Chạy trên Raspberry Pi
Setup systemd service (chạy 24/7)
/etc/systemd/system/picoclaw.service
[Unit]
Description=PicoClaw AI Agent
After=network.target
[Service]
Type=simple
User=pi
WorkingDirectory=/home/pi/picoclaw
ExecStart=/home/pi/picoclaw/picoclaw --config config.yaml
Restart=always
RestartSec=5
Environment=OPENAI_API_KEY=sk-xxx
Environment=TELEGRAM_BOT_TOKEN=xxx
[Install]
WantedBy=multi-user.target
terminal
sudo systemctl enable picoclaw
sudo systemctl start picoclaw
sudo systemctl status picoclaw
6. Use Cases thực tế
| Use Case | Hardware | Mô tả |
|---|---|---|
| Home monitor | Pi Zero 2 | Giám sát nhiệt độ, độ ẩm → cảnh báo Telegram |
| Security cam | Pi 4 | Nhận ảnh camera → AI phân tích → alert |
| Server agent | VPS $2.5 | Monitor CPU/RAM → tự restart services |
| POS assistant | Tablet | Trợ lý bán hàng nhỏ gọn |
7. Giới hạn & Bước tiếp theo
⚠️ Giới hạn
- Ít skills built-in hơn OpenClaw (chỉ core skills)
- Không có web UI dashboard
- Plugin ecosystem nhỏ hơn nhiều
- Chưa hỗ trợ voice/video processing
🔜 Đọc tiếp
- ZeroClaw — nếu cần hiệu năng tối đa bằng Rust
- OpenClaw — full-featured agent cho server
- Skills Development — tạo skill cho PicoClaw