368 lines
9.0 KiB
Markdown
368 lines
9.0 KiB
Markdown
<div align="center">
|
|
<img src="nanobot_logo.png" alt="nanobot" width="500">
|
|
<h1>nanobot: Ultra-Lightweight Personal AI Assistant</h1>
|
|
<p>
|
|
<a href="https://pypi.org/project/nanobot-ai/"><img src="https://img.shields.io/pypi/v/nanobot-ai" alt="PyPI"></a>
|
|
<a href="https://pepy.tech/project/nanobot-ai"><img src="https://static.pepy.tech/badge/nanobot-ai" alt="Downloads"></a>
|
|
<img src="https://img.shields.io/badge/python-≥3.11-blue" alt="Python">
|
|
<img src="https://img.shields.io/badge/license-MIT-green" alt="License">
|
|
<a href="./COMMUNICATION.md"><img src="https://img.shields.io/badge/Feishu-Group-E9DBFC?style=flat&logo=feishu&logoColor=white" alt="Feishu"></a>
|
|
<a href="./COMMUNICATION.md"><img src="https://img.shields.io/badge/WeChat-Group-C5EAB4?style=flat&logo=wechat&logoColor=white" alt="WeChat"></a>
|
|
</p>
|
|
</div>
|
|
|
|
🐈 **nanobot** is an **ultra-lightweight** personal AI assistant inspired by [Clawdbot](https://github.com/openclaw/openclaw)
|
|
|
|
⚡️ Delivers core agent functionality in just **~4,000** lines of code — **99% smaller** than Clawdbot's 430k+ lines.
|
|
|
|
## 📢 News
|
|
|
|
- **2025-02-01** 🎉 nanobot launched! Welcome to try 🐈 nanobot!
|
|
|
|
## Key Features of nanobot:
|
|
|
|
🪶 **Ultra-Lightweight**: Just ~4,000 lines of code — 99% smaller than Clawdbot - core functionality.
|
|
|
|
🔬 **Research-Ready**: Clean, readable code that's easy to understand, modify, and extend for research.
|
|
|
|
⚡️ **Lightning Fast**: Minimal footprint means faster startup, lower resource usage, and quicker iterations.
|
|
|
|
💎 **Easy-to-Use**: One-click to depoly and you're ready to go.
|
|
|
|
## 🏗️ Architecture
|
|
|
|
<p align="center">
|
|
<img src="nanobot_arch.png" alt="nanobot architecture" width="800">
|
|
</p>
|
|
|
|
## ✨ Features
|
|
|
|
<table align="center">
|
|
<tr align="center">
|
|
<th><p align="center">📈 24/7 Real-Time Market Analysis</p></th>
|
|
<th><p align="center">🚀 Full-Stack Software Engineer</p></th>
|
|
<th><p align="center">📅 Smart Daily Routine Manager</p></th>
|
|
<th><p align="center">📚 Personal Knowledge Assistant</p></th>
|
|
</tr>
|
|
<tr>
|
|
<td align="center"><p align="center"><img src="case/search.gif" width="180" height="400"></p></td>
|
|
<td align="center"><p align="center"><img src="case/code.gif" width="180" height="400"></p></td>
|
|
<td align="center"><p align="center"><img src="case/scedule.gif" width="180" height="400"></p></td>
|
|
<td align="center"><p align="center"><img src="case/memory.gif" width="180" height="400"></p></td>
|
|
</tr>
|
|
<tr>
|
|
<td align="center">Discovery • Insights • Trends</td>
|
|
<td align="center">Develop • Deploy • Scale</td>
|
|
<td align="center">Schedule • Automate • Organize</td>
|
|
<td align="center">Learn • Memory • Reasoning</td>
|
|
</tr>
|
|
</table>
|
|
|
|
## 📦 Install
|
|
|
|
**Install from PyPi**
|
|
|
|
```bash
|
|
pip install nanobot-ai
|
|
```
|
|
|
|
**Install from source** (recommended for development)
|
|
|
|
```bash
|
|
git clone https://github.com/HKUDS/nanobot.git
|
|
cd nanobot
|
|
pip install -e .
|
|
```
|
|
|
|
**Install with uv**
|
|
|
|
```bash
|
|
uv venv
|
|
source .venv/bin/activate
|
|
uv pip install nanobot-ai
|
|
```
|
|
|
|
## 🚀 Quick Start
|
|
|
|
> [!TIP]
|
|
> Set your API key in `~/.nanobot/config.json`.
|
|
> Get API keys: [OpenRouter](https://openrouter.ai/keys) (LLM) · [Brave Search](https://brave.com/search/api/) (optional, for web search)
|
|
> You can also change the model to `minimax/minimax-m2` for lower cost.
|
|
|
|
**1. Initialize**
|
|
|
|
```bash
|
|
nanobot onboard
|
|
```
|
|
|
|
**2. Configure** (`~/.nanobot/config.json`)
|
|
|
|
```json
|
|
{
|
|
"providers": {
|
|
"openrouter": {
|
|
"apiKey": "sk-or-v1-xxx"
|
|
}
|
|
},
|
|
"agents": {
|
|
"defaults": {
|
|
"model": "anthropic/claude-opus-4-5"
|
|
}
|
|
},
|
|
"webSearch": {
|
|
"apiKey": "BSA-xxx"
|
|
}
|
|
}
|
|
```
|
|
|
|
|
|
**3. Chat**
|
|
|
|
```bash
|
|
nanobot agent -m "What is 2+2?"
|
|
```
|
|
|
|
That's it! You have a working AI assistant in 2 minutes.
|
|
|
|
## 🖥️ Local Models (vLLM)
|
|
|
|
Run nanobot with your own local models using vLLM or any OpenAI-compatible server.
|
|
|
|
**1. Start your vLLM server**
|
|
|
|
```bash
|
|
vllm serve meta-llama/Llama-3.1-8B-Instruct --port 8000
|
|
```
|
|
|
|
**2. Configure** (`~/.nanobot/config.json`)
|
|
|
|
```json
|
|
{
|
|
"providers": {
|
|
"vllm": {
|
|
"apiKey": "dummy",
|
|
"apiBase": "http://localhost:8000/v1"
|
|
}
|
|
},
|
|
"agents": {
|
|
"defaults": {
|
|
"model": "meta-llama/Llama-3.1-8B-Instruct"
|
|
}
|
|
}
|
|
}
|
|
```
|
|
|
|
**3. Chat**
|
|
|
|
```bash
|
|
nanobot agent -m "Hello from my local LLM!"
|
|
```
|
|
|
|
> [!TIP]
|
|
> The `apiKey` can be any non-empty string for local servers that don't require authentication.
|
|
|
|
## 💬 Chat Apps
|
|
|
|
Talk to your nanobot through Telegram or WhatsApp — anytime, anywhere.
|
|
|
|
| Channel | Setup |
|
|
|---------|-------|
|
|
| **Telegram** | Easy (just a token) |
|
|
| **WhatsApp** | Medium (scan QR) |
|
|
|
|
<details>
|
|
<summary><b>Telegram</b> (Recommended)</summary>
|
|
|
|
**1. Create a bot**
|
|
- Open Telegram, search `@BotFather`
|
|
- Send `/newbot`, follow prompts
|
|
- Copy the token
|
|
|
|
**2. Configure**
|
|
|
|
```json
|
|
{
|
|
"channels": {
|
|
"telegram": {
|
|
"enabled": true,
|
|
"token": "YOUR_BOT_TOKEN",
|
|
"allowFrom": ["YOUR_USER_ID"]
|
|
}
|
|
}
|
|
}
|
|
```
|
|
|
|
> Get your user ID from `@userinfobot` on Telegram.
|
|
|
|
**3. Run**
|
|
|
|
```bash
|
|
nanobot gateway
|
|
```
|
|
|
|
</details>
|
|
|
|
<details>
|
|
<summary><b>WhatsApp</b></summary>
|
|
|
|
Requires **Node.js ≥18**.
|
|
|
|
**1. Link device**
|
|
|
|
```bash
|
|
nanobot channels login
|
|
# Scan QR with WhatsApp → Settings → Linked Devices
|
|
```
|
|
|
|
**2. Configure**
|
|
|
|
```json
|
|
{
|
|
"channels": {
|
|
"whatsapp": {
|
|
"enabled": true,
|
|
"allowFrom": ["+1234567890"]
|
|
}
|
|
}
|
|
}
|
|
```
|
|
|
|
**3. Run** (two terminals)
|
|
|
|
```bash
|
|
# Terminal 1
|
|
nanobot channels login
|
|
|
|
# Terminal 2
|
|
nanobot gateway
|
|
```
|
|
|
|
</details>
|
|
|
|
## ⚙️ Configuration
|
|
|
|
<details>
|
|
<summary><b>Full config example</b></summary>
|
|
|
|
```json
|
|
{
|
|
"agents": {
|
|
"defaults": {
|
|
"model": "anthropic/claude-opus-4-5"
|
|
}
|
|
},
|
|
"providers": {
|
|
"openrouter": {
|
|
"apiKey": "sk-or-v1-xxx"
|
|
}
|
|
},
|
|
"channels": {
|
|
"telegram": {
|
|
"enabled": true,
|
|
"token": "123456:ABC...",
|
|
"allowFrom": ["123456789"]
|
|
},
|
|
"whatsapp": {
|
|
"enabled": false
|
|
}
|
|
},
|
|
"tools": {
|
|
"web": {
|
|
"search": {
|
|
"apiKey": "BSA..."
|
|
}
|
|
}
|
|
}
|
|
}
|
|
```
|
|
|
|
</details>
|
|
|
|
## CLI Reference
|
|
|
|
| Command | Description |
|
|
|---------|-------------|
|
|
| `nanobot onboard` | Initialize config & workspace |
|
|
| `nanobot agent -m "..."` | Chat with the agent |
|
|
| `nanobot agent` | Interactive chat mode |
|
|
| `nanobot gateway` | Start the gateway |
|
|
| `nanobot status` | Show status |
|
|
| `nanobot channels login` | Link WhatsApp (scan QR) |
|
|
| `nanobot channels status` | Show channel status |
|
|
|
|
<details>
|
|
<summary><b>Scheduled Tasks (Cron)</b></summary>
|
|
|
|
```bash
|
|
# Add a job
|
|
nanobot cron add --name "daily" --message "Good morning!" --cron "0 9 * * *"
|
|
nanobot cron add --name "hourly" --message "Check status" --every 3600
|
|
|
|
# List jobs
|
|
nanobot cron list
|
|
|
|
# Remove a job
|
|
nanobot cron remove <job_id>
|
|
```
|
|
|
|
</details>
|
|
|
|
## 📁 Project Structure
|
|
|
|
```
|
|
nanobot/
|
|
├── agent/ # 🧠 Core agent logic
|
|
│ ├── loop.py # Agent loop (LLM ↔ tool execution)
|
|
│ ├── context.py # Prompt builder
|
|
│ ├── memory.py # Persistent memory
|
|
│ ├── skills.py # Skills loader
|
|
│ ├── subagent.py # Background task execution
|
|
│ └── tools/ # Built-in tools (incl. spawn)
|
|
├── skills/ # 🎯 Bundled skills (github, weather, tmux...)
|
|
├── channels/ # 📱 WhatsApp integration
|
|
├── bus/ # 🚌 Message routing
|
|
├── cron/ # ⏰ Scheduled tasks
|
|
├── heartbeat/ # 💓 Proactive wake-up
|
|
├── providers/ # 🤖 LLM providers (OpenRouter, etc.)
|
|
├── session/ # 💬 Conversation sessions
|
|
├── config/ # ⚙️ Configuration
|
|
└── cli/ # 🖥️ Commands
|
|
```
|
|
|
|
## 🤝 Contribute & Roadmap
|
|
|
|
PRs welcome! The codebase is intentionally small and readable. 🤗
|
|
|
|
**Roadmap** — Pick an item and [open a PR](https://github.com/HKUDS/nanobot/pulls)!
|
|
|
|
- [ ] **Multi-modal** — See and hear (images, voice, video)
|
|
- [ ] **Long-term memory** — Never forget important context
|
|
- [ ] **Better reasoning** — Multi-step planning and reflection
|
|
- [ ] **More integrations** — Discord, Slack, email, calendar
|
|
- [ ] **Self-improvement** — Learn from feedback and mistakes
|
|
|
|
### Contributors
|
|
|
|
<a href="https://github.com/HKUDS/nanobot/graphs/contributors">
|
|
<img src="https://contrib.rocks/image?repo=HKUDS/nanobot" />
|
|
</a>
|
|
|
|
---
|
|
|
|
## ⭐ Star History
|
|
|
|
<div align="center">
|
|
<a href="https://star-history.com/#HKUDS/nanobot&Date">
|
|
<picture>
|
|
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=HKUDS/nanobot&type=Date&theme=dark" />
|
|
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=HKUDS/nanobot&type=Date" />
|
|
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=HKUDS/nanobot&type=Date" style="border-radius: 15px; box-shadow: 0 0 30px rgba(0, 217, 255, 0.3);" />
|
|
</picture>
|
|
</a>
|
|
</div>
|
|
|
|
<p align="center">
|
|
<em> Thanks for visiting ✨ nanobot!</em><br><br>
|
|
<img src="https://visitor-badge.laobi.icu/badge?page_id=HKUDS.nanobot&style=for-the-badge&color=00d4ff" alt="Views">
|
|
</p>
|