Home
cd ../playbooks
EducationIntermediate

DeepTutor: Agent-Native AI Tutoring

Set up DeepTutor — a self-hosted AI tutoring platform with RAG knowledge bases, multi-agent problem solving, quiz generation, deep research, and persistent TutorBot agents you can run from CLI or browser.

15 minutes
By communitySource
#tutoring#RAG#knowledge-base#quiz-generation#deep-research#TutorBot#self-hosted#CLI

Uploading a textbook to ChatGPT gives you a Q&A bot. DeepTutor gives you a persistent tutor with its own memory, personality, and knowledge base — one that generates quizzes, runs multi-agent research, animates math, and shows up on your schedule even when you don't.

Who it's for: students, self-learners, researchers, educators, anyone studying technical material with PDFs and papers

Example

"Set up a physics tutor with my textbook" → RAG knowledge base from ch1-ch12 PDFs, Socratic TutorBot that probes with questions, quiz generation on thermodynamics, deep research on attention mechanisms — all from the CLI

CLAUDE.md Template

New here? 3-minute setup guide → | Already set up? Copy the template below.

# DeepTutor CLI Skill

> Teach your AI agent to configure, manage, and use DeepTutor — an intelligent learning platform — entirely through the command line.

## When to Use

Use this skill when the user wants to:
- Set up or configure DeepTutor
- Chat with DeepTutor or run a capability (deep solve, quiz generation, deep research, math animation)
- Create, manage, or search knowledge bases
- Manage TutorBot instances
- View or manage learning memory, sessions, or notebooks
- Start the DeepTutor API server

## Prerequisites

- Python 3.11+
- DeepTutor installed: `pip install -e .` (core) or `pip install -e ".[server]"` (with web)
- Run `python scripts/start_tour.py` for first-time interactive setup (configures LLM, embedding, search providers and writes `.env`)

## Commands

### Chat & Capabilities

```bash
# Interactive REPL
deeptutor chat
deeptutor chat --capability deep_solve --kb my-kb --tool rag --tool web_search

# One-shot capability execution
deeptutor run chat "Explain Fourier transform"
deeptutor run deep_solve "Solve x^2 = 4" --tool rag --kb textbook
deeptutor run deep_question "Linear algebra" --config num_questions=5
deeptutor run deep_research "Attention mechanisms" --kb papers
deeptutor run math_animator "Visualize a Fourier series"

# Options for `run`:
#   --session <id>         Resume existing session
#   --tool/-t <name>       Enable tool (repeatable): rag, web_search, code_execution, reason, brainstorm, paper_search
#   --kb <name>            Knowledge base (repeatable)
#   --notebook-ref <ref>   Notebook reference (repeatable)
#   --history-ref <id>     Referenced session id (repeatable)
#   --language/-l <code>   Response language (default: en)
#   --config <key=value>   Capability config (repeatable)
#   --config-json <json>   Capability config as JSON
#   --format/-f <fmt>      Output format: rich | json
```

### Knowledge Bases

```bash
deeptutor kb list                              # List all knowledge bases
deeptutor kb info <name>                       # Show knowledge base details
deeptutor kb create <name> --doc file.pdf      # Create from documents (--doc repeatable)
deeptutor kb add <name> --doc more.pdf         # Add documents incrementally
deeptutor kb search <name> "query text"        # Search a knowledge base
deeptutor kb set-default <name>                # Set as default KB
deeptutor kb delete <name> [--force]           # Delete a knowledge base
```

### TutorBot

```bash
deeptutor bot list                             # List all TutorBot instances
deeptutor bot create <id> --name "My Tutor"    # Create and start a new bot
deeptutor bot start <id>                       # Start a bot
deeptutor bot stop <id>                        # Stop a bot
```

### Memory

```bash
deeptutor memory show [summary|profile|all]    # View learning memory
deeptutor memory clear [summary|profile|all]   # Clear memory (--force to skip confirm)
```

### Sessions

```bash
deeptutor session list [--limit 20]            # List sessions
deeptutor session show <id>                    # View session messages
deeptutor session open <id>                    # Resume session in REPL
deeptutor session rename <id> --title "..."    # Rename a session
deeptutor session delete <id>                  # Delete a session
```

### Notebooks

```bash
deeptutor notebook list                        # List notebooks
deeptutor notebook create <name>               # Create a notebook
deeptutor notebook show <id>                   # View notebook records
deeptutor notebook add-md <id> <file.md>       # Import markdown as record
deeptutor notebook replace-md <id> <rec> <f>   # Replace a markdown record
deeptutor notebook remove-record <id> <rec>    # Remove a record
```

### System

```bash
deeptutor config show                          # Print current configuration
deeptutor plugin list                          # List registered tools and capabilities
deeptutor plugin info <name>                   # Show tool/capability details
deeptutor provider login <provider>            # OAuth login (openai-codex, github-copilot)
deeptutor serve [--port 8001] [--reload]       # Start API server
```

## REPL Slash Commands

Inside `deeptutor chat`, use these:

| Command | Effect |
|:---|:---|
| `/quit` | Exit REPL |
| `/session` | Show current session id |
| `/new` | Start a new session |
| `/tool on\|off <name>` | Toggle a tool |
| `/cap <name>` | Switch capability |
| `/kb <name>\|none` | Set or clear knowledge base |
| `/history add <id>` / `/history clear` | Manage history references |
| `/notebook add <ref>` / `/notebook clear` | Manage notebook references |
| `/refs` | Show active references |
| `/config show\|set\|clear` | Manage capability config |

## Typical Workflows

**First-time setup:**
```bash
cd DeepTutor
pip install -e ".[server]"
python scripts/start_tour.py    # Interactive guided setup
```

**Daily learning:**
```bash
deeptutor chat --kb textbook --tool rag --tool web_search
```

**Build a knowledge base from documents:**
```bash
deeptutor kb create physics --doc ch1.pdf --doc ch2.pdf
deeptutor run chat "Explain Newton's third law" --kb physics --tool rag
```

**Generate quiz questions:**
```bash
deeptutor run deep_question "Thermodynamics" --kb physics --config num_questions=5
```
README.md

What This Does

DeepTutor is a self-hosted AI tutoring platform from HKU's Data Intelligence Lab. You upload your documents (PDFs, Markdown, text), build RAG-ready knowledge bases, and interact through five unified modes:

  • Chat — tool-augmented conversation with RAG, web search, code execution, reasoning, and paper search
  • Deep Solve — multi-agent problem solving with plan/investigate/solve/verify steps and source citations
  • Quiz Generation — grounded assessments generated from your knowledge base
  • Deep Research — parallel research agents across RAG, web, and academic papers producing cited reports
  • Math Animator — visual math animations powered by Manim

Everything runs from a CLI or a Next.js web UI. The CLAUDE.md template gives Claude Code the full CLI skill so it can configure, manage, and use DeepTutor autonomously.


Quick Start

Step 1: Install DeepTutor

git clone https://github.com/HKUDS/DeepTutor.git
cd DeepTutor
conda create -n deeptutor python=3.11 && conda activate deeptutor
pip install -e ".[server]"

Step 2: Run the setup tour

python scripts/start_tour.py

This walks you through LLM, embedding, and search provider configuration interactively. Supports OpenAI, Anthropic, Gemini, DeepSeek, Ollama, and 25+ other providers.

Step 3: Download the CLAUDE.md skill

Click Download above to grab the CLI skill, then drop it into your DeepTutor project root as CLAUDE.md. Claude Code can now operate DeepTutor autonomously.

Step 4: Build a knowledge base and start learning

deeptutor kb create physics --doc ch1.pdf --doc ch2.pdf
deeptutor chat --kb physics --tool rag --tool web_search

Or launch the web UI at http://localhost:3782.

Key Capabilities

TutorBot — Persistent Autonomous Tutors

Not chatbots — autonomous agents with their own memory, personality, and workspace. Each evolves with you.

deeptutor bot create math-tutor --persona "Socratic math teacher who uses probing questions"
deeptutor bot create writing-coach --persona "Patient, detail-oriented writing mentor"

TutorBots support proactive heartbeat (scheduled check-ins), skill learning (add new abilities via skill files), and multi-channel presence (Telegram, Discord, Slack, email).

Knowledge Hub

Upload PDFs, Markdown, and text files. Documents actively power every conversation, quiz, and research session — not passive storage.

deeptutor kb create my-kb --doc textbook.pdf
deeptutor kb add my-kb --docs-dir ./papers/
deeptutor kb search my-kb "gradient descent"

Persistent Memory

DeepTutor builds a learner profile: what you've studied, how you learn, your goals. Shared across all features and TutorBots, refined with every interaction.

Typical Workflows

Generate quizzes from your materials:

deeptutor run deep_question "Thermodynamics" --kb physics --config num_questions=5

Multi-agent problem solving:

deeptutor run deep_solve "Prove that the square root of 2 is irrational" --tool reason

Deep research with citations:

deeptutor run deep_research "Attention mechanisms in transformers" --kb papers

Visualize math concepts:

deeptutor run math_animator "Visualize a Fourier series"

Deployment Options

  • Localpython scripts/start_tour.py (recommended for first-time)
  • Dockerdocker compose -f docker-compose.ghcr.yml up -d (no local Python/Node needed)
  • CLI-onlypip install -e ".[cli]" (no web frontend)

Supported Providers

30+ LLM providers (OpenAI, Anthropic, Gemini, DeepSeek, Ollama, vLLM, LM Studio, and more), 7 embedding providers, and 6 web search providers including self-hosted SearXNG and DuckDuckGo (no API key needed).

Tips

  • Start with the setup tour — it handles .env configuration interactively, with live connection testing
  • Use --format json for pipeline integration — structured output for AI agents and automation
  • Set a default KB with deeptutor kb set-default so you don't need --kb on every command
  • REPL slash commands let you switch capabilities, tools, and knowledge bases mid-conversation without restarting

$Related Playbooks