Welcome to Smart Math Tutor, a project that demonstrates the power of collaborative AI agents working together to solve and verify mathematical problems.
This repo showcases how two AI agents β a Problem Solver and a Verifier β interact in a round-robin format using mathematical tools like SymPy and a calculator to accurately solve equations, derivatives, and arithmetic problems.
Imagine an intelligent math tutor who not only solves your problems but also double-checks every step to ensure accuracy β that's what this system replicates.
- One agent solves math problems using symbolic computation.
- Another agent verifies the solution through evaluation and validation.
- Both work collaboratively until a correct and validated answer is reached.
A Python-based AI system where:
-
Problem Solver Agent:
- Uses the
solve_math_problemfunction. - Leverages SymPy to solve equations, perform differentiation, or evaluate arithmetic.
- Uses the
-
Verifier Agent:
- Uses the
verify_solutionfunction. - Substitutes results into the original problem or recomputes to confirm correctness.
- Uses the
-
SymPy Tool:
- Symbolic math library for solving and manipulating math expressions.
- Examples:
- Equation solving:
x^2 - 4 = 0 - Differentiation:
differentiate x^2 - Arithmetic:
2 + 2
- Equation solving:
-
Calculator Tool:
- Used by the verifier to substitute values and re-evaluate the expressions.
- The two agents operate in a round-robin chat.
- Problem Solver provides a solution.
- Verifier checks and either confirms or asks for correction.
- The loop continues until a valid solution is reached and the process ends with
"TERMINATE".
- Check if the solution is correct using symbolic substitution.
- Ensure output is formatted in LaTeX for readability.
- Confirm both agents reach agreement before termination.
Install the necessary dependencies before running:
pip install autogen-agentchat sympy google-generativeai