This project implements a multi-agent architecture where specialized AI agents collaborate to provide comprehensive learning assistance. Each agent has a specific role and expertise.
┌─────────────────────────────────────────────────────────────┐
│ Streamlit Web App │
│ (app.py) │
└────────────────────┬────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ Agent Handler │
│ (agent_handler.py) │
│ • Orchestrates agent workflows │
│ • Manages state and context │
│ • Coordinates multi-agent collaboration │
└────────────────────┬────────────────────────────────────────┘
│
┌────────────┼────────────┬────────────┐
▼ ▼ ▼ ▼
┌──────────────┐ ┌──────────┐ ┌──────────┐ ┌──────────────┐
│ Student │ │ Roadmap │ │ Quiz │ │ Tutor │
│ Analyzer │ │ Creator │ │Generator │ │ Agent │
│ Agent │ │ Agent │ │ Agent │ │ │
└──────────────┘ └──────────┘ └──────────┘ └──────────────┘
│ │ │ │
└────────────┴────────────┴────────────┘
│
▼
┌────────────────────────────┐
│ Study Agents │
│ (study_agents.py) │
│ • Agent definitions │
│ • Persona management │
│ • Model configuration │
└────────────────────────────┘
│
┌────────────┼────────────┐
▼ ▼ ▼
┌──────────────┐ ┌──────────┐ ┌───────────────┐
│ Config │ │ Prompts │ │ RAG Helper │
│ Manager │ │ YAML │ │ │
│ (config.py) │ │ │ │(rag_helper.py)│
└──────────────┘ └──────────┘ └───────────────┘
│
▼
┌──────────────┐
│ ChromaDB │
│ Vector Store │
└──────────────┘
Purpose: Assess learning needs and create student profile
Capabilities:
- Analyzes current knowledge level
- Identifies learning gaps
- Determines prerequisites
- Recommends learning approaches
- Evaluates time constraints
Input: Student information (topic, level, goals, time, style) Output: Comprehensive student analysis report
Temperature: 0.6 (balanced creativity and consistency)
Purpose: Design personalized learning paths
Capabilities:
- Creates structured learning phases
- Sequences topics logically
- Estimates time requirements
- Sets milestones and checkpoints
- Adapts to learning styles
Input: Student analysis, goals, constraints Output: Detailed learning roadmap with phases
Temperature: 0.7 (creative planning)
Purpose: Create adaptive assessments
Capabilities:
- Generates multiple question types
- Adapts difficulty levels
- Provides detailed explanations
- Tests conceptual and practical knowledge
- Focuses on specific areas
Input: Topic, difficulty, focus areas, question count Output: Complete quiz with answers and explanations
Temperature: 0.5 (consistent question quality)
Purpose: Explain concepts and answer questions
Capabilities:
- Breaks down complex concepts
- Uses analogies and examples
- Adapts to learning styles
- Provides step-by-step guidance
- Encourages critical thinking
Input: Student question, context, knowledge level Output: Clear, personalized explanation
Temperature: 0.7 (engaging explanations)
Purpose: Search and recommend learning materials
Capabilities:
- Searches web for resources
- Evaluates quality and relevance
- Matches to learning styles
- Finds diverse resource types
- Prioritizes free resources
Tools: DuckDuckGo search Input: Topic, goals, level, learning style Output: Curated resource list
Temperature: 0.6 (balanced search)
Purpose: Answer questions using uploaded documents
Capabilities:
- Retrieves relevant document context
- Grounds answers in source material
- Cites specific sections
- Acknowledges information gaps
- Provides accurate, contextual answers
Tools: Vector database (ChromaDB) Input: Question, document context Output: Answer with source citations
Temperature: 0.6 (accurate retrieval)
User Input → Student Analyzer → Roadmap Creator → Resource Finder → Dashboard
Steps:
- User provides learning goals and constraints
- Student Analyzer assesses needs and gaps
- Roadmap Creator designs learning path using analysis
- Resource Finder searches for materials
- Results displayed in dashboard
Time: ~30-60 seconds
User Request → Quiz Generator → Display Quiz
Steps:
- User specifies difficulty, focus, and count
- Quiz Generator creates questions with explanations
- Quiz displayed with download option
Time: ~10-20 seconds
User Question → Tutor Agent → Explanation
Steps:
- User asks question with optional context
- Tutor Agent formulates personalized explanation
- Response displayed with examples
Time: ~5-15 seconds
User Upload → Document Processing → Vector Storage
User Question → Similarity Search → Context Retrieval → RAG Tutor → Answer
Steps:
- User uploads PDF/text documents
- Documents split into chunks and embedded
- Chunks stored in ChromaDB vector database
- User asks question
- Similarity search finds relevant chunks
- RAG Tutor generates answer using context
- Answer displayed with citations
Time: Upload ~2-5 seconds per doc, Query ~10-20 seconds
Role: Orchestration layer
Responsibilities:
- Initializes agents with proper configuration
- Manages agent execution order
- Handles state between agent calls
- Formats prompts with context
- Integrates RAG functionality
- Manages Streamlit status updates
Key Methods:
analyze_student(): Runs student analysis workflowcreate_roadmap(): Runs roadmap creation workflowgenerate_quiz(): Runs quiz generation workflowget_tutoring(): Single tutor interactionquery_documents(): RAG-powered document Q&A
Role: Agent factory
Responsibilities:
- Defines agent configurations
- Loads personas from YAML
- Configures models (OpenAI/Groq)
- Sets appropriate temperatures
- Manages learning style adaptations
Key Methods:
student_analyzer_agent(): Creates analyzerroadmap_creator_agent(): Creates roadmap designerquiz_generator_agent(): Creates quiz makertutor_agent(): Creates tutorresource_finder_agent(): Creates resource searcherrag_tutor_agent(): Creates RAG-enabled tutor
Role: Document processing and retrieval
Responsibilities:
- Loads and processes documents
- Splits text into chunks
- Creates embeddings
- Manages vector database
- Performs similarity search
Key Methods:
load_pdf(): Process PDF filesload_text(): Process text filesquery(): Retrieve relevant chunksclear_database(): Reset vector store
Technology Stack:
- LangChain: Document processing
- ChromaDB: Vector storage
- OpenAI Embeddings: Text embeddings
- RecursiveCharacterTextSplitter: Chunking
Role: Configuration access
Responsibilities:
- Loads YAML configuration
- Provides persona definitions
- Manages prompt templates
- Supplies learning style info
- Formats prompts with variables
Singleton Pattern: Ensures single config instance
Role: Configuration and prompts
Contains:
- Personas: Agent system prompts and capabilities
- Prompts: Task-specific prompt templates
- Learning Styles: Style descriptions and recommendations
- Subject Categories: Topic lists and durations
- Knowledge Levels: Level definitions and approaches
- Phidata: Multi-agent orchestration
- Streamlit: Web interface
- Python 3.10+: Runtime
- OpenAI GPT-4: High-quality LLM (paid)
- Groq Llama: Fast, free LLM
- LangChain: Document processing
- ChromaDB: Vector database
- OpenAI Embeddings: Text embeddings
- DuckDuckGo: Web search
- PyPDF: PDF processing
- YAML: Configuration
- python-dotenv: Environment management
Each component has a single, well-defined responsibility:
- Agents: AI capabilities
- Handler: Orchestration
- RAG Helper: Document processing
- Config: Configuration management
- App: User interface
Components are loosely coupled and can be:
- Modified independently
- Tested in isolation
- Reused in different contexts
- Extended with new features
Behavior controlled through:
- YAML configuration files
- Environment variables
- Runtime parameters
- User preferences
Architecture supports:
- Adding new agents
- New learning styles
- Additional subject categories
- More document types
- Different LLM providers
Design prioritizes:
- Clear user workflows
- Immediate feedback
- Progress visibility
- Error handling
- Helpful guidance
- Student Analysis: 10-15 seconds
- Roadmap Creation: 15-20 seconds
- Resource Finding: 10-15 seconds (with web search)
- Quiz Generation: 10-15 seconds
- Tutoring: 5-10 seconds
- RAG Query: 10-15 seconds
- Model Selection: Groq for speed, GPT-4 for quality
- Temperature Tuning: Lower for consistency, higher for creativity
- Prompt Engineering: Clear, specific instructions
- Caching: Streamlit session state for results
- Chunking: Optimal chunk size for RAG (1000 chars)
- Stored in
.envfile (not in code) - Never committed to version control
- Loaded via python-dotenv
- Session-based (not persisted)
- Vector DB local to user
- No external data transmission (except API calls)
- Temporary storage only
- Cleaned up after processing
- Size limits recommended
- New Agents: Add to
study_agents.py - New Prompts: Add to
prompts.yaml - New Learning Styles: Add to YAML config
- New Subject Categories: Add to YAML config
- New LLM Providers: Add to
_get_model()
- Progress Tracking: Add database layer
- User Accounts: Add authentication
- Collaborative Features: Add real-time sync
- Mobile App: Create React Native version
- Analytics Dashboard: Add metrics collection
- Spaced Repetition: Implement scheduling algorithm
- Voice Interaction: Add speech recognition/synthesis
- Live Tutoring: Add real-time video/chat
- Platform Integration: Connect to Coursera, Udemy, etc.
- Adaptive Learning: ML-based difficulty adjustment
This architecture enables a powerful, flexible, and extensible learning platform that adapts to each student's unique needs!