$ show HKUDS/DeepTutor
DeepTutor is a full-stack AI-powered learning companion that provides chat, problem-solving, research, visualization, and structured learning capabilities. The system features a modular architecture with a Python/FastAPI backend, Next.js/React frontend, and a CLI interface. It implements an agent-based system where capabilities like deep solve, deep question, and deep research are implemented as loop capabilities with access to tools such as web search, code execution, and knowledge base retrieval. The platform includes a three-layer memory system for contextual awareness, supports multiple RAG backends (LlamaIndex, PageIndex, GraphRAG, LightRAG, IMA), and enables integration with external knowledge bases (Obsidian, MarginNote 4) and partner agents (Claude Code, Codex). The application employs a plugin architecture for extensibility, allowing new capabilities, tools, and subagents to be added via entry points. Configuration is managed through JSON/YAML files with runtime overrides, and services are decoupled via provider abstractions for LLMs, embeddings, search, and media generation. Real-time communication is facilitated by WebSockets and an internal event bus (StreamBus). The system supports multi-user deployments with role-based access control, isolated workspaces, and grant-based resource sharing for skills, knowledge bases, and partners. Deployment options include local installation, Docker containers, and CLI-only mode. The codebase demonstrates strong engineering practices with extensive unit testing, clear separation of concerns, and reusable patterns such as the capability protocol, tool composition, and atomic file operations. While the system's feature richness introduces complexity, its modular design allows for selective adoption of components.
The LLM identified 4 files worth highlighting for reuse:
Defines the BaseLLMProvider abstract class that standardizes the interface for LLM providers. Enables plug-and-play integration of new LLM services (OpenAI, Anthropic, local models) through a unified API for completion, embedding, and token tracking. Demonstrates clean separation of concerns and is easily extractable for use in other projects requiring LLM abstraction.
Implements a lightweight, in-memory event bus with support for synchronous and asynchronous event publishing and subscription. Provides history replay capabilities and decouples components within the agentic system. Self-contained with minimal dependencies, making it highly reusable in any Python application needing event-based communication.
Contains the consolidation mode implementations (update, audit, dedup, merge) as separate classes following the strategy pattern. Each mode encapsulates specific logic for processing memory traces into consolidated knowledge. The modular design allows adding new consolidation strategies without modifying core memory services, demonstrating excellent extensibility and separation of concerns.
Discovers and loads plugins from setuptools entry points across multiple groups (capabilities, tools, subagents). Handles plugin initialization, dependency resolution, and error isolation. The pattern is generic enough to be reused in other Python applications requiring dynamic plugin systems with minimal adaptation.