A multi-agent tutoring system built with FastAPI and Google's Gemini API, following Agent Development Kit (ADK) principles. The system uses a coordinator pattern where a main Tutor Agent routes student questions to specialized sub-agents.
-
Tutor Agent (Coordinator)
- Routes queries to appropriate specialist agents
- Uses keyword matching and Gemini API for intent classification
- Handles general educational queries
-
Math Agent (Maths Specialist)
- Handles mathematics-related questions
- Uses Calculator Tool for arithmetic operations
- Provides step-by-step solutions and explanations
-
Physics Agent (Physics Specialist)
- Handles physics-related questions
- Uses Physics Constants Tool, Unit Converter Tool, and Physics Formula Tool
- Provides comprehensive physics explanations with unit conversions and formulas
-
Chemistry Agent (Chemistry Specialist)
- Handles chemistry-related questions
- Uses Periodic Table Tool for element information lookup
- Provides detailed chemical element data and explanations
- Calculator Tool: Performs basic arithmetic operations safely
- Physics Constants Tool: Provides access to fundamental physics constants
- Unit Converter Tool: Converts between different units of measurement
- Physics Formula Tool: Provides physics formulas and calculations
- Periodic Table Tool: Comprehensive periodic table data with element properties
- Clone the repository:
git clone https://github.com/Mayankrai449/MultiAgentTutor.git
cd MultiAgentTutor
- Install dependencies:
pip install -r requirements.txt
- Set up environment variables:
cp .env.example .env
# Edit .env and add your GEMINI_API_KEY
- Get your Gemini API key:
- Go to Google AI Studio
- Create a new API key
- Add it to your
.env
file
uvicorn main:app --reload
The server will start on http://localhost:8000
Submit a question to the AI tutor system.
Request:
{
"question": "What is 25 + 17?"
}
Response:
{
"answer": "25 + 17 equals 42. This is a basic addition problem...",
"agent_used": "Math Agent",
"tools_used": ["Calculator Tool"]
}
Check if the service is running.
Math Questions:
- "What is 25 + 17?"
- "Solve the equation 2x + 5 = 11"
- "Calculate 15 * 8"
Physics Questions:
- "What is Newton's second law?"
- "What is the speed of light?"
- "Convert 100 mph to km/h"
- "What is the formula for kinetic energy?"
Chemistry Questions:
- "Tell me about hydrogen"
- "What is the atomic mass of carbon?"
- "What elements are in group 18?"
- "Describe the electron configuration of oxygen"
General Questions:
- "How do I study effectively?"
- "What is the scientific method?"
- Coordinator Pattern: Main agent routes queries to specialists
- Specialization: Each agent focuses on specific domains (Math, Physics, Chemistry)
- Modularity: Easy to add new agents and tools
- Keyword-based classification for fast routing
- Gemini API fallback for complex classification
- Support for general educational queries
- Calculator Tool: Safe mathematical expression evaluation
- Physics Constants Tool: Comprehensive physics constants database
- Unit Converter Tool: Convert between different measurement units
- Physics Formula Tool: Access to common physics formulas and calculations
- Periodic Table Tool: Complete periodic table with detailed element information including:
- Atomic number and mass
- Electron configuration
- Element properties (group, period, state, category)
- Descriptive information
- Detailed answers with step-by-step explanations
- Information about which agent handled the query
- List of tools used in generating the response
uvicorn main:app --reload --host 0.0.0.0 --port 8000
GEMINI_API_KEY
: Your Gemini API key (required)
The system uses gemini-2.0-flash-001
by default. You can modify this in the agent files if needed.