GitHub:HKUDS/nanobot · ⭐ 43K+ · Python · MIT协议
NanoBot由香港大学数据科学实验室(HKUDS)开发,核心理念"小而美"——让AI Agent回归轻量和个性化。2026年2月首次提交,6月突破4.3万星。架构特点:小核心+大生态,支持30+LLM适配器,本地优先隐私安全,一个人能跑,一群人能用。
# pip安装
pip install nanobot-agent
# 或源码安装
git clone https://github.com/HKUDS/nanobot.git
cd nanobot
pip install -e .
# 初始化
nanobot init --model ollama/qwen3:8b
nanobot run
| 特性 | 说明 |
|---|---|
| 小核心 | 核心仅几千行代码,轻量启动,资源占用极低 |
| 大生态 | 30+LLM适配器、插件市场、MCP协议支持 |
| 本地优先 | 数据不出本地,隐私安全有保障 |
| 多模型 | OpenAI/Claude/Ollama/vLLM/DeepSeek等全支持 |
| 记忆系统 | SQLite本地记忆,支持长期对话上下文 |
| 工具调用 | 文件搜索、代码执行、网页搜索、API调用 |
# nanobot.yaml
model: ollama/qwen3:8b
tools:
- file_search
- code_executor
- web_search
memory:
type: sqlite
path: ~/.nanobot/memory.db
plugins:
- name: github
config:
token: ${GITHUB_TOKEN}
# 自定义工具
custom_tools:
- name: send_email
description: "发送邮件"
handler: ./tools/email.py
parameters:
to: {type: string, required: true}
subject: {type: string}
body: {type: string}
from nanobot import NanoBot
bot = NanoBot(
model="ollama/qwen3:8b",
tools=["file_search", "web_search"],
memory="sqlite:///~/.nanobot/memory.db"
)
# 对话
response = bot.chat("帮我分析这个项目的代码结构")
print(response)
# 多轮对话(自动维护上下文)
response2 = bot.chat("那核心模块有哪些问题?")
print(response2)
# 执行工具
result = bot.execute("搜索2026年AI Agent最新进展")
print(result)
NanoBot的"小"不是功能少,而是核心精简——所有高级能力通过插件扩展,按需加载不占资源。适合个人开发者在笔记本上跑一个私人AI助手。和 AionUi多Agent协作 相比,NanoBot更注重单Agent的轻量和个性化。
GitHub:HKUDS/nanobot · ⭐ 43K+ · Python · MIT协议
OpenHuman桌面AI助手教程