Project Info
Inspiration
Joe, one of our members, used to teach in public schools in Brazil, where he grew up. He witnessed first-hand the biggest struggle students there face: exam prep for the national examination. Every year, over 7 million students prepare for the high-stakes Brazilian ENEM exam each year. But public school students face a massive resource gap: the lack of access to the expensive private tutors and quality prep materials. But it's not just about ENEM. The truth is, big platforms like Khan Academy or Udemy don't have classes for smaller exams from more marginalized corners of the world. So what if we can generate an AI tutor for ANY exam in the world?
What it does
Eigen Coach is a personal, AI-powered tutor that manages a student's entire exam prep journey. It Plans: A student signs up, and the Initializer agent creates a personalized, time-aware study schedule based on their exam date. The agent learns about the exam and update knowledge base using the material student submits. It Quizzes: The Questioner agent selects a targeted question from our MySQL database based on the day's topics and the student's current skill level. It Tutors: The Chatter agent engages the student in a Socratic conversation. It's designed to never give the direct answer, but instead guides the student to discover the solution themselves, just like a real tutor would. It Tracks: The Finalizer agent analyzes the entire conversation, scores the student's performance on a 0-100 scale, and automatically updates their skill profile in the database. This creates a closed loop where the tutor gets smarter about the student's needs after every single session.
How we built it
We built Eigen Coach on a robust, asynchronous Python backend using FastAPI. The core of our project is a Clean 4-Agent System that manages the entire student lifecycle without a complex central orchestrator. We use Claude-Sdk as the foundation of our multi-agent model. All dataβfrom the question bank to student memory and skill levelsβis stored in a unified MySQL database. The agents interact with the database safely and efficiently through a single MCP server that exposes all necessary tools (e.g., get_question_by_topic, update_skill_level). We used Pydantic to ensure all our models are type-safe and Docker to containerize our MySQL instance for easy setup and development.
Challenges we ran into
Prompting the Socratic Tutor: Our biggest challenge was engineering the Chatter agent's prompts. It's incredibly difficult to make an LLM guide a student to an answer (the Socratic method) instead of just providing it. This required dozens of iterations to ensure it was helpful without becoming a cheat-sheet. Stateful Conversations: Managing the chat state for the Chatter agent was complex. We had to ensure each conversation was cleanly scoped to a single question and that the agent had the correct session context (the question, the answer, and the session_id) for every turn. Agent Coordination: Designing the 4-agent system to work "cleanly" without a central orchestrator was tough. We had to be very disciplined about giving each agent a single responsibility and using the MySQL database as the central source of truth.
Accomplishments we're proud of
The Socratic Chatter Agent: We are incredibly proud of the Socratic tutoring. It's the core of our "why"βit doesn't just give answers, it truly teaches. Seeing it successfully guide a user from "I don't know" to the correct answer is the magic of this project. The "Closed-Loop" Learning System: The most powerful feature is our full-circle adaptive loop. The Finalizer agent evaluates a student's chat, and its output (a new skill score) is immediately used by the Questioner agent to select the next question. The system adapts in real-time to the student's growth. The Unified Database Architecture: Committing to a single MySQL database for everything (questions, student data, memory, skills) was a great decision. It makes the entire system robust, scalable, and easy to query.
What we learned
The Nuance of AI in Education: We learned that the true power of AI in education isn't just information retrieval, but guided discovery. Building a Socratic tutor is far more challenging, and ultimately more valuable, than building a simple Q&A bot. The Database as the "Brain": We learned to use a unified database as the central "brain" and state-holder for a multi-agent system. It's far more robust and scalable than passing complex JSON objects between API calls. Agent-Based Design: We gained deep experience in designing "clean" agents with single responsibilities. This separation of concerns (e.g., Questioner only picks questions, Finalizer only grades) makes the whole system more resilient.
What's next
Implement a Reinforcement Learning Recommender: We will evolve the Questioner agent from a rule-based selector into a true AI strategist. By implementing a Deep Q-Network (DQN), the agent will learn the optimal policy for which question to ask next to maximize a student's long-term learning.
Eigen Coach Backend
AI-powered tutor for exam prep. Built for Brazilian public schools where students lack resources for private tutors and standardized test preparation materials.
π― Core Features
- Time-Aware Study Planning: Generates personalized study schedules based on exam dates and student availability
- Question Bank: MySQL-backed question database with topic tagging and difficulty scoring
- Student Memory: Tracks learning progress, skill levels, and personalized notes per student
- Adaptive Tutoring: Socratic method chatbot that guides students without giving away answers
- Performance Tracking: Evaluates conversations and updates skill levels automatically
ποΈ Architecture
Clean 4-Agent System (No Orchestrator)
-
Initializer (
agents/initializer.py)- Sets up student sessions and calendar entries
- Creates default study plans
-
Questioner (
agents/questioner.py)- Selects appropriate questions based on date, topics, and skill levels
- Uses unified database MCP for question retrieval
-
Chatter (
agents/chatter.py)- Streaming Socratic tutoring conversations
- Automatically saves student learning notes via MCP
- Never gives direct answers - guides discovery
-
Finalizer (
agents/finalizer.py)- Analyzes conversation history
- Evaluates student performance (0-100 scale)
- Updates skill levels in database
Unified Database Layer
All data now stored in MySQL with a single unified MCP server:
database/ folder contains:
db.py- MySQL connection pool managerdb_helpers.py- CRUD operations (students, memory, calendar, skills)db_mcp.py- Unified MCP server with 6 tools:- Question Bank:
get_question_by_topic(),get_unique_topics() - Student Data:
get_skill_level_pairs(),get_topics_by_date(),add_memory_entry(),update_skill_level()
- Question Bank:
init.py- Database initialization
Database Tables:
questions- Question bank with topic tags and difficultystudents- Student metadata (name, exam)student_memory- Learning notes and observationscalendar_entries- Study session plansskill_levels- Topic proficiency scores (0-100)
π‘ API Endpoints
All endpoints available at http://localhost:8000
GET /health
Health check
POST /initializer
Initialize a student session
{
"student_data": {
"student_name": "Maria",
"exam_name": "ENEM 2025",
"memory": []
},
"date": "2025-01-15"
}
POST /questioner
Get a question for the student
{
"student_data": { ... },
"date": "2025-01-15"
}
POST /chatter
Send message to tutoring chatbot
{
"student_data": { ... },
"user_message": "I think the answer is...",
"conversation_history": []
}
POST /finalizer
Evaluate session and update skill levels
{
"student_data": { ... },
"conversation_history": [
{"role": "user", "content": "..."},
{"role": "assistant", "content": "..."}
]
}
π Quick Start
1. Install Dependencies
pip install -r requirements.txt
2. Start MySQL
# Using Docker
docker run -d --name calhacks-mysql \
-e MYSQL_ROOT_PASSWORD=joe_is_very_cool \
-p 8003:3306 \
mysql:8
3. Run the Server
# Database initializes automatically on startup
python -m uvicorn main:app --reload
Server will display:
============================================================
Eigen Coach Backend Starting
============================================================
[Startup] Initializing database connection pool...
[Startup] β Database initialized and ready
[Startup] β API endpoints available
============================================================
Server Ready!
============================================================
ποΈ Project Structure
backend/
βββ agents/ # 4 clean agents
β βββ chatter.py # Tutoring chat
β βββ finalizer.py # Performance evaluation
β βββ initializer.py # Session setup
β βββ questioner.py # Question selection
βββ database/ # Unified database layer
β βββ db.py # MySQL connection pool
β βββ db_helpers.py # CRUD operations
β βββ db_mcp.py # Unified MCP server
β βββ init.py # Initialization
βββ migrations/
β βββ 001_create_memory_tables.sql
βββ api.py # FastAPI endpoints
βββ main.py # Entry point
βββ requirements.txt
π§ Configuration
MySQL Connection
Edit database/db.py:
host='localhost'
port=8003
user='root'
password='joe_is_very_cool'
database='calhacks'
MCP Server
Configuration in .mcp.json:
{
"mcpServers": {
"database": {
"command": "python3",
"args": ["-m", "database.db_mcp"]
}
}
}
π Database Schema
Students
id,student_name,exam_name,created_at,updated_at
Questions
id,question_prompt,answer,explanationtopic_tag1,topic_tag2,topic_tag3difficulty,has_been_asked
Student Memory
id,student_id,memory_entry,created_at
Calendar Entries
id,student_id,date,topics(JSON),n_questions
Skill Levels
id,student_id,topic,skill_level(0-100)
π Student Skill Scoring
- 0-25: Novice - Minimal understanding
- 26-50: Beginner - Basic understanding
- 51-75: Intermediate - Solid understanding
- 76-100: Advanced - Strong mastery
π Development Notes
- β MySQL for all data (questions + student data)
- β Single unified MCP server for all database operations
- β Connection pooling for performance
- β Automatic migrations on startup
- β Clean agent architecture (no orchestrator)
- β Type-safe with Pydantic models
- β Async/await throughout
π€ Contributing
Built for CalHacks hackathon. Focus on helping Brazilian public school students access quality exam preparation tools.
Analysis
View
Metric
- 31
- 13
Figures cover GitHub contributors during the hackathon window. A co-authored commit counts in full for each author, so per-member totals add up to more than the whole-team figures.
Technology
- FastAPIIn code
- PythonIn code
- SQLIn code
- ReactClaimed
3 of 4 appear in the indexed code. 1 claimed on Devpost could not be matched to code, which may simply mean the tool leaves no trace in the repository.
AI coding agents
No AI coding agent signals were found in this repository.
Detected from committed agent config files and commit authorship. Absence of a signal is not proof an agent was unused.
Codebase size
Source size
87 KB
Source files
27
Counts recognized source files only; vendored directories, binaries and lockfiles are excluded, so this is smaller than the repository on disk.
Repository
sawansri/calhacks-eigen-coach-backend
37 files Β· 98 KB Β· @ b446e7d
Structure
Application logic
18 files Β· 49%Domain rules, services and shared utilities.
Data & schema
13 files Β· 35%Schema definitions, migrations and data access.
Supporting
Layers are inferred from where files sit in the tree, not from reading the code. A project that names its directories unconventionally will read oddly here β open the file browser to check anything the diagram implies.
Languages
- Python83%
- Markdown7%
- Shell6%
- SQL3%
- YAML1%
Share of indexed source by file size. Binary and vendored files are excluded.
Dependencies
requirements.txt
pypi Β· 9- claude-agent-sdk
- fastapi
- httpx
- mcp
- mysql-connector-python
- pydantic
- python-multipart
- tinydb
- uvicorn
Declared in the repositoryβs manifests at the indexed commit. A declared package is not proof it is used, and runtime dependencies are listed first.
This projectβs features have not been analysed yet.
Export this project's context (description, README, evidence, key source files) to chat with an AI agent elsewhere.