University courses often rely on fragmented learning resources—slides, PDFs, and scattered code files—making it difficult for students to search for specific concepts, revise effectively, or generate structured learning materials that align with their curriculum.
ZenLearn is an AI-powered supplementary learning platform designed to unify disjointed course materials into an intelligent, interactive knowledge base. It leverages a sophisticated Hybrid RAG (Retrieval-Augmented Generation) engine to enable semantic search and uses a multi-agent Content Generation Pipeline to autonomously create validated theory notes, coding labs, and educational videos from uploaded lecture materials.
Unlike standard vector search, ZenLearn implements a production-grade Hybrid RAG system to ensure high-precision retrieval across diverse academic formats.
- Multi-Stage Retrieval: Combines Dense Retrieval (Semantic Search via Gemini Embeddings) with Sparse Retrieval (Keyword Matching via BM25) to capture both conceptual relevance and exact terminology.
- Cross-Encoder Reranking: Utilizes the Cohere Rerank API to re-score retrieved documents, significantly improving context quality before LLM ingestion.
- Format-Specific Chunking:
- PDFs: Semantic paragraph splitting with overlap conservation.
- Slides (PPTX): Structure-aware extraction preserving slide boundaries and speaker notes.
- Code: AST-based chunking to respect function and class scope.
The platform employs a multi-agent workflow to generate academic content, ensuring structural integrity and factual correctness.
- Planner Agent: Analyzes the syllabus to create a hierarchical content outline.
- Drafting Agents:
- Theory Writer: Synthesizes explanatory text grounded in retrieved course materials.
- Code Writer: Generates programming lab exercises and solution code.
- Validation Layer (Sandbox):
- Syntax Check: AST parsing validates generated code correctness.
- Execution Sandbox: Runs generated code against unit tests in an isolated environment to ensure functional viability.
ZenLearn automates the creation of educational videos using a "Code-to-Video" pipeline:
- Scripting: LLM generates narration scripts synchronized with visual cues.
- Visuals: Orchestrates Manim (Mathematical Animation Engine) for algorithmic visualizations and Pillow for static slides.
- Audio: Edge-TTS provides neural voice synthesis.
- Composition: FFmpeg assembles all assets into a final MP4 lecture.
The Notes Agent utilizes Gemini Vision Pro to digitize handwritten class notes. It goes beyond simple OCR by:
- Identifying logical blocks (formulas, diagrams, text).
- Merging content from multiple page images into a single coherent document.
- Converting mathematical expressions into cleanly formatted LaTeX.
The system is built on a microservices-inspired architecture managed by a central FastAPI backend.
graph TB
subgraph API["FastAPI Backend"]
direction TB
A[API Endpoints]
end
subgraph Services["Core Services"]
S1[Gemini 1.5 Pro]
S2[Embeddings]
S3["Vector Store"]
S4[Image Gen]
end
subgraph RAG["RAG Engine"]
R1[Chunker Strategy]
R2[Hybrid Retrieval]
R3[Reranker]
R4[Context Assembler]
end
subgraph Content["Content Gen Engine"]
C1[Theory Agent]
C2[Lab Agent]
C3[Validation Sandbox]
C4[Video Pipeline]
end
A --> Services
A --> RAG
A --> Content
RAG --> Services
Content --> Services
Content --> RAG
flowchart LR
subgraph Input
T[Topic]
C[RAG Context]
end
subgraph Agents
T --> SW[Script Writer]
C --> SW
SW --> |Script| SP[Scene Planner]
end
subgraph Generators
SP --> |Static| SR[Slide Renderer]
SP --> |Animated| MG[Manim Generator]
SP --> |Audio| TTS[TTS Engine]
end
subgraph Composition
SR --> VC[Video Composer]
MG --> VC
TTS --> VC
VC --> MP4[Final Video]
end
| Module | Directory | Responsibilities |
|---|---|---|
| CMS Agent | agents/cms_agent/ |
Course CRUD, Material Upload, RAG Indexing Triggers. |
| RAG Engine | agents/rag_engine/ |
Document Chunking, Embedding, Vector Search, Reranking. |
| Content Engine | agents/content_gen_engine/ |
Syllabus Planning, Theory/Lab Generation, Code Validation. |
| Chat Agent | agents/chat-agent/ |
Context-aware generic chat, Tool Use (Search, Explain). |
| Notes Agent | agents/notes_agent/ |
Vision-based handwriting digitization to LaTeX. |
| Community Agent | agents/community_agent/ |
Q&A Forum, AI Auto-Reply Bot for unanswered queries. |
| Video Engine | content_gen_engine/video_gen/ |
Manim script generation and video rendering. |
- Framework: FastAPI (Python)
- LLM Orchestration: LangChain, Google GenAI SDK (Gemini 1.5 Pro)
- Vector Database: ChromaDB (Local), PGVector (Production)
- Search: Hybrid (BM25 + Chroma), Cohere Rerank
- Database: PostgreSQL (Supabase), SQLAlchemy (Async), Pydantic
- Video: Manim CE, FFmpeg, Edge-TTS
- Framework: Next.js 14 (App Router)
- Language: TypeScript
- Styling: Tailwind CSS, Shadcn UI
- State/Data: React Query, Zustand
- Python 3.10+
- Node.js 18+
- PostgreSQL Database (Supabase recommended)
- FFmpeg (for video generation)
- Navigate to the agents directory:
cd agents - Create and activate a virtual environment:
python -m venv .venv .\.venv\Scripts\Activate # Windows # source .venv/bin/activate # Linux/Mac
- Install dependencies:
pip install -r requirements.txt
- Configure environment variables:
- Copy
.env.exampleto.env - Add API Keys:
GOOGLE_API_KEY(Gemini),COHERE_API_KEY(Rerank),SUPABASE_URL,DB_URL.
- Copy
- Run the server:
uvicorn main:app --reload
- Navigate to the client directory:
cd client - Install dependencies:
npm install
- Configure environment variables in
.env.local. - Run the development server:
npm run dev





