📖 Hướng dẫn sử dụng BizClaw
Tài liệu đầy đủ từ cài đặt đến vận hành — AI Agent Platform mã nguồn mở cho doanh nghiệp.
1. Giới thiệu
BizClaw là nền tảng AI Agent viết 100% bằng Rust, tự host hoàn toàn — dữ liệu không rời khỏi máy bạn. Hỗ trợ 15 AI providers, 9 kênh giao tiếp, 15 công cụ, MCP mở rộng vô hạn.
| Metric | Value |
|---|---|
| Language | 100% Rust |
| Crates | 14 |
| Tests | 115 passing |
| Providers | 15 + custom endpoint |
| Channels | 9 types |
| Tools | 15 native + MCP |
| Agent Templates | 51 business agents |
| Dashboard | 12 pages, bilingual VI/EN |
| Binary Size | bizclaw ~13MB, platform ~7.9MB |
| Security Score | Gateway 92/100, Platform 88/100 |
2. Yêu cầu hệ thống
| Thành phần | Tối thiểu | Khuyến nghị |
|---|---|---|
| RAM | 512MB | 2GB+ |
| Disk | 100MB | 2GB+ (có model LLM) |
| OS | Linux x64 / ARM64 | Ubuntu 22.04+ |
| Rust | 1.75+ | Stable mới nhất |
| Thiết bị | Raspberry Pi 3B+ | VPS 1GB RAM |
3. Cài đặt
3.1 One-Click Install (Khuyến nghị)
curl -sSL https://bizclaw.vn/install.sh | sudo bash
Script tự động: cài Rust, clone repo, build release, tạo systemd service, khởi chạy.
3.2 Docker Compose
git clone https://github.com/nguyenduchoai/bizclaw-cloud.git cd bizclaw docker-compose up -d
3.3 Build from Source
# Cài Rust (nếu chưa có) curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh source $HOME/.cargo/env # Clone & build git clone https://github.com/nguyenduchoai/bizclaw-cloud.git cd bizclaw cargo build --release # Chạy Gateway (standalone) ./target/release/bizclaw serve --port 3000 # Hoặc chạy Platform (multi-tenant) ./target/release/bizclaw-platform --port 3001
4. Chạy lần đầu
Sau khi cài đặt, truy cập Dashboard:
# Platform mode http://your-ip:3001 # Default Admin credentials Email: admin@your-domain.com Password: (set via BIZCLAW_ADMIN_PASSWORD env var or auto-generated on first run)
Các bước tiếp theo:
- Vào Providers → nhập API Key (OpenAI, Gemini, Ollama...)
- Vào Agents → tạo agent hoặc cài từ Gallery (51 mẫu)
- Vào Chat → bắt đầu trò chuyện real-time
- (Tùy chọn) Vào Channels → kết nối Telegram, Zalo, Discord...
5. Web Dashboard
Dashboard 12 trang, song ngữ VI/EN, WebSocket real-time:
| Trang | Mô tả |
|---|---|
| 📊 Dashboard | Tổng quan hệ thống, server status, uptime |
| 💬 Chat | Trò chuyện real-time, chọn agent, WebSocket |
| 🤖 AI Agents | Tạo/sửa/xoá agent, chọn provider & model riêng |
| 🔌 Providers | Nhập API key, test kết nối, chọn model |
| 📱 Channels | Cấu hình Telegram, Discord, Zalo, Webhook, Email |
| 🛠️ Tools | 15 built-in tools, bật/tắt theo nhu cầu |
| 🔗 MCP Servers | Thêm/xoá/bật/tắt MCP servers |
| 📚 Knowledge | Upload tài liệu, search RAG |
| 🧠 Brain | Cấu hình Brain Engine, scan model GGUF |
| ⏰ Scheduler | Tạo task chạy tự động theo lịch |
| 📄 Settings | Provider mặc định, model, system prompt |
| 🎨 Gallery | 51 mẫu agent nghiệp vụ, cài 1 click |
6. AI Providers
BizClaw hỗ trợ 15 providers. Mỗi agent chọn provider riêng → tiết kiệm 60-80% chi phí:
| Provider | Giá trị | Ghi chú |
|---|---|---|
| OpenAI | openai | GPT-4o, GPT-4o-mini |
| Anthropic | anthropic | Claude Sonnet, Haiku |
| Google Gemini | gemini | Gemini Pro, Flash |
| DeepSeek | deepseek | Giá rẻ, chất lượng cao |
| Groq | groq | Tốc độ cao (Llama 3) |
| Ollama | ollama | LLM local, miễn phí |
| Brain Engine | brain | GGUF offline, không cần internet |
| OpenRouter | openrouter | Gateway cho nhiều model |
| Together | together | Open-source models |
| MiniMax | minimax | Model Trung Quốc |
| xAI (Grok) | xai | Grok models |
| Mistral | mistral | Mistral, Mixtral |
| llama.cpp | llamacpp | Direct GGUF |
| CLIProxy | cliproxy | CLI forwarding |
| vLLM | vllm | High-throughput server |
7. Agents & Gallery
51 mẫu agent, 13 danh mục. Cài 1 click:
HR (5) · Sales (5) · Finance (5) · Operations (5) · Legal (4) · Customer Service (3) · Marketing (5) · E-commerce (3) · Management (5) · Admin (3) · IT (3) · Business (3) · Training (2)
8. Group Chat
Tạo nhóm nhiều agent, mỗi agent dùng provider khác nhau. Gửi 1 câu hỏi → tất cả phản hồi:
# Ví dụ: Pitch nhà đầu tư
Bạn: "Chuẩn bị pitch cho Series A"
├── 🧑💼 Chiến lược (Claude) → TAM/SAM/SOM, moat
├── 📊 Tài chính (DeepSeek) → Unit economics
├── 📣 Marketing (Gemini) → Brand story
└── ⚖️ Pháp lý (Groq) → Term sheet
9. Kết nối Channels
Telegram
[channel.telegram] enabled = true bot_token = "123456789:ABCdef..." allowed_chat_ids = [12345678]
Discord
[channel.discord] enabled = true bot_token = "your-discord-bot-token" allowed_channel_ids = [1234567890]
Zalo (Cá nhân + OA)
[channel.zalo]
enabled = true
mode = "personal" # personal | official
[channel.zalo.personal]
cookie_path = "~/.bizclaw/zalo/cookie.json"
imei = "your-device-imei"
Webhook
Nhận HTTP POST từ bất kỳ hệ thống nào → AI xử lý → trả response.
Email (IMAP/SMTP)
Tự động đọc email qua IMAP polling, trả lời qua SMTP.
10. Knowledge RAG
Upload tài liệu → hệ thống chunk, index FTS5 → agent tự search khi chat.
11. Scheduler
Tạo task hẹn giờ. Agent tự chạy background theo lịch.
12. Cấu hình (config.toml)
File cấu hình chính tại ~/.bizclaw/config.toml:
# AI Provider mặc định api_key = "sk-your-key" default_provider = "openai" default_model = "gpt-4o-mini" [identity] name = "BizClaw" system_prompt = "Bạn là trợ lý AI thông minh." [brain] enabled = true model_path = "~/.bizclaw/models/tinyllama.gguf" threads = 4 [gateway] port = 3000 host = "127.0.0.1" [autonomy] level = "supervised" allowed_commands = ["git", "npm", "cargo"] [secrets] encrypt = true
13. Identity (Nhân cách AI)
[identity] name = "Linh" persona = "Nhân viên tư vấn bất động sản" system_prompt = """ Bạn là Linh, nhân viên tư vấn BĐS công ty ABC. Luôn trả lời lịch sự, chuyên nghiệp, bằng tiếng Việt. """
14. Brain Engine (LLM Offline)
# Tải model GGUF mkdir -p ~/.bizclaw/models wget -O ~/.bizclaw/models/tinyllama.gguf \ https://huggingface.co/TheBloke/TinyLlama-1.1B-Chat-v1.0-GGUF/resolve/main/tinyllama-1.1b-chat-v1.0.Q4_K_M.gguf # Hoặc dùng Ollama (đơn giản hơn) curl -fsSL https://ollama.ai/install.sh | sh ollama pull llama3.2 ollama pull qwen3
15. MCP Servers
[[mcp_servers]] name = "github" command = "npx" args = ["-y", "@modelcontextprotocol/server-github"] [mcp_servers.env] GITHUB_TOKEN = "ghp_xxx"
| Server | Mô tả |
|---|---|
| Filesystem | Đọc/ghi file |
| GitHub | Issues, PRs, repos |
| Memory | Bộ nhớ lâu dài |
| Brave Search | Tìm kiếm web |
| Postgres | Truy vấn database |
| Puppeteer | Browser automation |
16. Bảo mật
| Tính năng | Chi tiết |
|---|---|
| 🔐 Mã hoá | AES-256 cho API keys, HMAC-SHA256 |
| 🔑 Xác thực | JWT + bcrypt password hashing |
| 🛡️ Rate Limiting | 5 lần/email/5 phút |
| 🧱 Sandbox | Command allowlist, workspace isolation |
| 🔒 Headers | HSTS, CSP, X-Frame-Options |
| 📋 Audit Log | Ghi nhận mọi thao tác admin |
17. Multi-Tenant Platform
| Mode | Binary | Use Case |
|---|---|---|
| Standalone | bizclaw | 1 bot, cá nhân, test |
| Platform | bizclaw-platform | Nhiều bots, agency, production |
./target/release/bizclaw-platform --port 3001
18. Docker
docker-compose up -d
# Dashboard: http://localhost:3001
19. Raspberry Pi
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
git clone https://github.com/nguyenduchoai/bizclaw-cloud.git
cd bizclaw && cargo build --release # ~5-10 phút trên Pi 4
./target/release/bizclaw serve
20. Systemd Service
[Unit] Description=BizClaw AI Agent After=network.target [Service] Type=simple User=root ExecStart=/usr/local/bin/bizclaw-platform --port 3001 Restart=always Environment=RUST_LOG=info Environment=JWT_SECRET=your-secret [Install] WantedBy=multi-user.target
sudo systemctl enable bizclaw-platform sudo systemctl start bizclaw-platform
21. Nginx Reverse Proxy
server {
server_name apps.bizclaw.vn;
location / {
proxy_pass http://127.0.0.1:3001;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}
}
22. API Reference
Gateway API
| Method | Path | Description |
|---|---|---|
| GET | /api/v1/info | System info |
| GET | /api/v1/providers | List providers |
| GET | /api/v1/agents | List agents |
| POST | /api/v1/agents | Create agent |
| POST | /api/v1/agents/{name}/chat | Chat with agent |
| WS | /ws | WebSocket chat |
| POST | /api/v1/knowledge/search | Search knowledge |
Platform Admin API
| Method | Path | Description |
|---|---|---|
| GET | /api/admin/tenants | List tenants |
| POST | /api/admin/tenants | Create tenant |
| POST | /api/admin/tenants/:id/start | Start tenant |
| POST | /api/admin/tenants/:id/stop | Stop tenant |
| GET | /api/admin/tenants/:id/configs | Get configs |
| POST | /api/admin/tenants/:id/configs | Set configs |
23. Biến môi trường
| Biến | Mô tả | Mặc định |
|---|---|---|
BIZCLAW_CONFIG | Đường dẫn config | ~/.bizclaw/config.toml |
JWT_SECRET | JWT secret (⚠️ BẮT BUỘC) | Random 256-bit |
RUST_LOG | Log level | info |
BIZCLAW_CORS_ORIGINS | CORS origins | * |
BIZCLAW_BIND_ALL | Bind 0.0.0.0 | 0 |
24. Crate Map
| Crate | Mô tả |
|---|---|
bizclaw-core | Traits, types, config, errors |
bizclaw-brain | GGUF inference + SIMD |
bizclaw-providers | 15 LLM providers |
bizclaw-channels | 9 channel types |
bizclaw-memory | SQLite + FTS5, Brain workspace |
bizclaw-tools | 15 native tools + MCP bridge |
bizclaw-mcp | MCP client (JSON-RPC 2.0) |
bizclaw-security | AES-256, Sandbox |
bizclaw-agent | Agent orchestrator |
bizclaw-gateway | HTTP + WS + Dashboard |
bizclaw-knowledge | Knowledge RAG |
bizclaw-scheduler | Scheduled tasks |
bizclaw-runtime | Process adapters |
bizclaw-platform | Multi-tenant admin |
25. FAQ
❓ Có cần internet không?
Không. Brain Engine + Ollama hoạt động hoàn toàn offline.
❓ License?
MIT — Miễn phí vĩnh viễn.
❓ Cập nhật?
cd bizclaw && git pull && cargo build --release sudo systemctl restart bizclaw-platform
26. Xử lý lỗi
Lỗi build trên ARM
sudo apt-get update sudo apt-get install -y build-essential pkg-config libssl-dev
Cross-compile lỗi
⚠️ Phải build trực tiếp trên VPS, không cross-compile từ macOS.
VPS cargo not found
source ~/.cargo/env
Text file busy
sudo systemctl stop bizclaw-platform
# Rồi copy binary mới