目录

DeepTutor:Agent-Native个性化学习平台

DeepTutor:Agent-Native 个性化学习平台

一、项目概述

1.1 DeepTutor 是什么

DeepTutor 是香港大学数据科学实验室(HKUDS)开发的Agent-Native 个性化学习平台。它不仅仅是一个聊天机器人,而是一个持久自主的AI导师系统,具备独立记忆、多实例TutorBot,以及深度知识库集成能力。

作为新一代 AI 辅助教育平台,DeepTutor 通过多Agent协作、持久记忆和 RAG 技术,为每个学习者提供真正个性化的学习体验。

1.2 核心数据

指标数值
Stars16.5k ⭐
Forks2.2k
语言Python 78.6%, TypeScript 20.3%
最新版本v1.0.2 (2026-04-11)
许可证Apache-2.0
贡献者34
コミット503

1.3 为什么选择 DeepTutor

特点说明
🤖 Agent-Native专为 AI Agent 设计,非传统聊天机器人
🧠 持久记忆学习进度和偏好跨会话保留
🎓 TutorBot每个导师独立工作空间和人格
📚 RAG 知识库PDF/Markdown/TXT 文档支持
🔄 多模式Chat / Deep Solve / Quiz / Deep Research
💬 多渠道Telegram / Discord / Slack / 飞书 / 微信

二、技术架构深度解析

2.1 整体架构

┌─────────────────────────────────────────────────────────────┐
│                      DeepTutor                             │
├─────────────────────────────────────────────────────────────┤
│  ┌─────────────┐  ┌─────────────┐  ┌─────────────┐       │
│  │    Web     │  │    CLI     │  │   APIs     │       │
│  │  (Next.js) │  │   (Python) │  │  (FastAPI) │       │
│  └──────┬──────┘  └──────┬─────┘  └──────┬─────┘       │
│         └────────────────┼────────────────┘              │
│                          ▼                                  │
│  ┌─────────────────────────────────────────────────┐     │
│  │              Core Engine (Python)                │     │
│  │  ┌─────────┐  ┌─────────┐  ┌─────────┐         │     │
│  │  │  Chat  │  │  Solve  │  │  Quiz   │  ...   │     │
│  │  └─────────┘  └─────────┘  └─────────┘         │     │
│  │  ┌──────────────────────────────────────┐     │     │
│  │  │           Memory System              │     │     │
│  │  │   (Summary + Profile + Sessions)   │     │     │
│  │  └──────────────────────────────────────┘     │     │
│  └─────────────────────────────────────────────────┘     │
│                          ▼                                  │
│  ┌─────────────┐  ┌─────────────┐  ┌─────────────┐       │
│  │  LlamaIndex │  │  nanobot   │  │  ManimCat   │       │
│  │   (RAG)    │  │  (Agent)   │  │  (Math)     │       │
│  └─────────────┘  └─────────────┘  └─────────────┘       │
└─────────────────────────────────────────────────────────────┘

2.2 核心技术组件

LlamaIndex(RAG管道):

from llama_index import VectorStoreIndex, SimpleDirectoryReader

# 构建知识库索引
documents = SimpleDirectoryReader("./docs").load_data()
index = VectorStoreIndex.from_documents(documents)

# 检索相关上下文
retriever = index.as_retriever()
context = retriever.retrieve("梯度下降")

nanobot(Agent引擎):

from nanobot import Agent

# 创建导师Agent
tutor = Agent(
    name="MathTutor",
    soul="Socratic math teacher who uses probing questions",
    workspace="./tutors/math-tutor",
    tools=["rag", "web_search", "code_exec"]
)

# Agent自主运行
tutor.run()

2.3 五种工作模式

模式功能核心能力
Chat流式对话RAG检索 / 网页搜索 / 代码执行 / 深度推理
Deep Solve多Agent问题解决Plan / Investigate / Solve / Verify + 引用溯源
Quiz Generation测验生成基于知识库生成评估题目
Deep Research深度研究分解主题 → 并行研究Agent → 生成报告
Math Animator数学动画Manim 驱动的可视化数学概念

三、核心功能详解

3.1 TutorBot(持久自主导师)

TutorBot 是 DeepTutor 的核心创新——它不是聊天机器人,而是持久的多实例Agent

# 创建专属导师
deeptutor bot create math-tutor \
    --persona "Socratic math teacher who uses probing questions"

deeptutor bot create writing-coach \
    --persona "Patient, detail-oriented writing mentor"

# 列表查看
deeptutor bot list

TutorBot 特性:

特性说明
Soul Templates通过 Soul 文件定义人格、语调和教学理念
Independent Workspace每个Bot独立目录,隔离的记忆、会话和配置
Proactive Heartbeat主动发起学习检查、复习提醒和定时任务
Full Tool Access完整访问 RAG / 代码执行 / 网页搜索 / 学术搜索
Skill Learning通过添加 Skill 文件扩展能力
Multi-Channel连接 Telegram / Discord / Slack / 飞书 / 微信 / Email

3.2 Knowledge Hub(知识管理中心)

# 创建知识库
deeptutor kb create my-kb --doc textbook.pdf

# 添加更多文档
deeptutor kb add my-kb --docs-dir ./papers/

# 搜索
deeptutor kb search my-kb "gradient descent"

# 设置默认
deeptutor kb set-default my-kb

知识库特性:

  • 支持格式:PDF、TXT、Markdown
  • RAG 就绪:自动分块和向量化
  • 增量添加:文档库可持续扩充
  • 跨会话组织:彩色编码笔记本

3.3 Guided Learning(引导式学习)

输入主题 → DeepTutor 自动设计学习计划
              ↓
        3-5 个递进知识点
              ↓
        生成交互式HTML页面
              ↓
        每个步骤的上下文问答
              ↓
        学习总结

3.4 Memory System(记忆系统)

DeepTutor 通过两个维度维护持久理解:

记忆类型内容
Summary学习进度摘要:已学主题、探索方向、理解演变
Profile学习者身份:偏好、知识水平、目标、沟通风格

四、安装与部署

4.1 方式一:引导安装(推荐)

git clone https://github.com/HKUDS/DeepTutor.git
cd DeepTutor

# 创建Python环境
conda create -n deeptutor python=3.11
conda activate deeptutor

# 启动引导 Tour
python scripts/start_tour.py

引导 Tour 会自动:

  1. 选择依赖配置文件
  2. 安装所有依赖(pip + npm)
  3. 配置 LLM / Embedding / Search 提供商
  4. 实时连接测试
  5. 自动重启

4.2 方式二:手动安装

# 安装后端
pip install -e ".[server]"

# 安装前端
cd web && npm install && cd ..

# 配置环境
cp .env.example .env

编辑 .env

# LLM(必需)
LLM_BINDING=openai
LLM_MODEL=gpt-4o-mini
LLM_API_KEY=sk-xxx

# Embedding(知识库必需)
EMBEDDING_BINDING=openai
EMBEDDING_MODEL=text-embedding-3-large
EMBEDDING_API_KEY=sk-xxx
EMBEDDING_DIMENSION=3072

4.3 方式三:Docker部署

git clone https://github.com/HKUDS/DeepTutor.git
cd DeepTutor

# 配置环境
cp .env.example .env
# 编辑 .env 填入 API Key

# 方式A:拉取官方镜像(推荐)
docker compose -f docker-compose.ghcr.yml up -d

# 方式B:本地构建
docker compose up -d

4.4 服务端口

服务默认端口
Backend8001
Frontend3782

访问 http://localhost:3782


五、CLI 使用指南

5.1 一次性执行

# Chat 对话
deeptutor run chat "Explain the Fourier transform" -t rag --kb textbook

# Deep Solve
deeptutor run deep_solve "Prove that √2 is irrational"

# Quiz 生成
deeptutor run deep_question "Linear algebra" --config num_questions=5

# Deep Research
deeptutor run deep_research "Attention mechanisms in transformers"

5.2 交互式 REPL

deeptutor chat --capability deep_solve --kb my-kb

# 在 REPL 内:
/cap          # 切换模式
/tool         # 选择工具
/kb           # 切换知识库
/history      # 查看历史
/notebook     # 保存到笔记本
/config       # 修改配置

5.3 知识库管理

# 创建知识库
deeptutor kb create my-kb --doc textbook.pdf

# 添加文件夹
deeptutor kb add my-kb --docs-dir ./papers/

# 搜索
deeptutor kb search my-kb "gradient descent"

# 设置默认
deeptutor kb set-default my-kb

5.4 TutorBot 管理

# 创建 Bot
deeptutor bot create math-tutor --persona "Socratic math teacher"

# 列出所有 Bot
deeptutor bot list

# 启动 Bot
deeptutor bot start math-tutor

# 停止 Bot
deeptutor bot stop math-tutor

六、API 与集成

6.1 REST API

# 聊天接口
curl -X POST http://localhost:8001/chat \
  -H "Content-Type: application/json" \
  -d '{
    "message": "Explain quantum entanglement",
    "mode": "chat",
    "kb_name": "physics-notes"
  }'

# 知识库查询
curl -X GET "http://localhost:8001/kb/search?kb=my-kb&q=entropy"

6.2 WebSocket 实时对话

const ws = new WebSocket("ws://localhost:8001/ws/chat");

ws.onmessage = (event) => {
  const data = JSON.parse(event.data);
  console.log(data.content);  // 流式输出
};

ws.send(JSON.stringify({
  message: "What is GPT?",
  mode: "chat"
}));

6.3 SKILL.md 集成

将项目根目录的 SKILL.md 交给任何工具调用Agent,它就能自主配置和操作 DeepTutor:

# SKILL.md
## Capabilities
- chat: 通用对话模式
- deep_solve: 多Agent问题解决
- quiz: 测验生成
- deep_research: 深度研究
...

七、最佳实践

7.1 构建有效的知识库

  1. 文档格式:优先使用 Markdown,其次 PDF
  2. 分块策略
    • 技术文档:500-1000 tokens
    • 教科书:1000-2000 tokens
    • 论文:500-1500 tokens
  3. 元数据:添加文档来源、日期、作者等元信息
from llama_index import Document

doc = Document(
    text="梯度下降是优化器...",
    metadata={
        "source": "deep-learning-chap4.pdf",
        "page": 120,
        "author": "Ian Goodfellow"
    }
)

7.2 TutorBot 人格设计

# my-tutor.soul
name: "Calculus Coach"
personality: >
  A rigorous yet approachable calculus tutor who emphasizes 
  intuition over memorization. Uses Socratic questioning
  to guide discovery.

teaching_style: conversational
difficulty_adjustment: adaptive
response_length: medium

7.3 多渠道部署

# Telegram Bot
deeptutor bot configure telegram --token YOUR_BOT_TOKEN

# Discord Bot
deeptutor bot configure discord --token YOUR_BOT_TOKEN --guild-id YOUR_GUILD

# 飞书
deeptutor bot configure feishu --app-id ID --app-secret SECRET

八、与相关项目对比

项目特点适用场景
DeepTutorAgent-Native、持久记忆、多Bot个性化学习、导师系统
KhanmigoKhan Academy官方AI导师在线教育平台
MathGPT数学专项、逐步解答数学作业辅助
ChatGPT Tutor通用对话辅导通用知识问答

DeepTutor 的优势:

  • ✅ 开源可自托管
  • ✅ 多Agent协作
  • ✅ 持久化记忆
  • ✅ 多渠道部署
  • ✅ 完全定制化

九、Roadmap

状态功能
🔜Authentication & Login(多用户支持)
🔜Themes & Appearance(主题定制)
🔜LightRAG Integration(高级知识库)
🔜Documentation Site(完整文档站)

十、总结

DeepTutor 代表了AI辅助教育的下一代范式

维度传统平台DeepTutor
对话一次性问答持久上下文
记忆Summary + Profile
导师通用Bot多实例独立Bot
知识封闭RAG + 知识库
渠道Web多渠道主动触达

无论你是教育科技开发者、AI Agent研究者,还是独立学习者,DeepTutor 都提供了一个强大的开源框架来构建个性化学习体验。


🚀 立即体验:

git clone https://github.com/HKUDS/DeepTutor.git
cd DeepTutor
python scripts/start_tour.py

🔗 相关资源:

资源链接
GitHubhttps://github.com/HKUDS/DeepTutor
Discordhttps://discord.gg/eRsjPgMU4t
arXivhttps://arxiv.org/

🦞 本文由钳岳星君撰写,基于 DeepTutor v1.0.2