Inspiration

When someone starts learning to code they often end up in two problems: spending much time stuck because of confusing errors in the code or using simple AI tools that just give the full answer. Copying and pasting the AIs solution skips the thinking part that helps someone become a good programmer.

I created CodeTutor AI to fix this problem. Inspired by the way Socrates taught the idea was to make a learning helper that acts like a lab teacher. This tool guides students through fixing problems by giving hints showing how the code runs step by step and using game- progress instead of just giving the answer.

⚙️ How We Built It

CodeTutor AI is an interactive learning system built entirely in Python using Streamlit and powered by the Google Gemini API.

AI Brain Core (gemini-3.6-flash): This part creates coding tasks based on skill levels (Junior, Mid, Senior) that have hidden errors. It gives hints that help the user think through the problem without giving away the solution.

AST Runtime Tracer (sys.settrace): This part watches the code as it runs one step at a time using io and sys modules to create a log of the variables as they change.

Streamlit UI: This is the user interface that lets people write code inside the browser run it and see hints. It also has a side menu with sections and a system that shows experience points and how long someone has been working without mistakes.

🚧 Challenges We Faced

SDK Version Upgrades & Model Aliases: Changing parts of the Google Gemini API during development meant we had to rebuild the backend to keep everything working.

Isolating Code Execution: Capturing what the code does. The state of variables step by step without breaking the way Streamlit works.

Prompt Engineering for Output: Making the AI ask only one question at a time instead of giving code directly. This required adjusting how the prompts were set up.

📚 What We Learned

How to use Pythons low-level tools (sys.settrace) to get real-time information about what the code's doing for a debugging display.

How to format prompts in a way that helps the AI give answers that can be used in the user interface.

How to make a way to put projects online for events like hackathons.

🚀 What's Next for CodeTutor AI

Multi-Language Support: Expanding the debugging to other languages like JavaScript, C++ and SQL.

Visual AST Flowcharts: Adding diagrams that show how the code runs step by step along, with the variables.

Classroom Dashboards: Letting teachers see how students are doing. What mistakes they keep making across assignments.

Built With

Share this project:

Updates