Inspiration
Mathematics is a critical gateway subject, yet millions of students struggle with it daily, experiencing intense stress and anxiety before crucial national exams (such as Poland's 8th-grade exam and the Matura). Professional private tutoring has become astronomically expensive, costing upwards of 150 PLN ($38 USD) per hour, which is inaccessible for many families.
Additionally, tens of thousands of Ukrainian refugee children enrolled in Polish schools face a double challenge: they understand the mathematical concepts, but struggle with local Polish terminology and exam phrasing. We built ProstaMatma to bridge this gap—providing a bilingual, infinitely patient, and highly accessible AI math tutor to democratize high-quality education and support integration.
What it Does
ProstaMatma is a live, gamified web application tailored to the K-12 school curriculum. Instead of acting as a simple, static chatbot, it serves as an Autonomous Multilingual AI Math Agent that actively guides students:
- Curriculum-Aligned Practice: Students solve math exercises generated dynamically from database templates, ensuring 100% curriculum compliance.
- Grounded AI Error Explanations: When a student submits an incorrect answer, our custom Gemini AI Agent analyzes the mistake and provides friendly, step-by-step guidance.
- Bilingual Educational Bridge: The interface can be instantly toggled between Polish, Ukrainian, and English. The AI dynamically translates math concepts, helping bilingual students learn terminology.
- Gemini Vision Scratchpad Assistant: Students can take a photo of their handwritten scratchpad calculations on paper. The AI analyzes their handwriting, follows their steps, detects where their calculation slipped, and explains the mistake directly on their own work—without giving away the final answer.
- Gamified Progress Tracking: Students earn XP, build daily streaks, and watch their mastery progress bars grow.
How We Built It
ProstaMatma is built on a modern, decoupled cloud architecture:
- Frontend: Built with Next.js (App Router), React, and TypeScript.
- Backend: Powered by a lightweight, asynchronous FastAPI (Python) server deployed on Railway, integrated with PostgreSQL.
- AI Core & Infrastructure: Integrated with Google Cloud and the unified
google-genaiSDK, powered bygemini-3.5-flashfor both text-based reasoning and multimodal image analysis.
To enforce strict academic and pedagogical standards, we implemented two key agentic patterns on our backend:
- The Reflection/Self-Correction Pattern: To prevent the model from leaking correct answers, the Agent evaluates its generated draft in an internal feedback loop, scrubbing any direct numerical leaks (e.g., hiding the correct answer ( 0,5 ) while keeping the explanation logic).
- The Adaptive Tutoring Pattern: The Agent reads the student's attempt history from PostgreSQL. It dynamically adapts its hints—offering a gentle clue on the first mistake, and walking through a simpler mathematical example (e.g., demonstrating ( 9 - 4 = 5 ) to help solve ( 1,9 - 1,4 )) on consecutive errors.
Challenges We Ran Into
Large language models notoriously struggle with raw mathematics. We solved this by separating calculations from pedagogy: our Python backend evaluates the correct answer and passes it as strict context parameters, so Gemini only handles the explanation logic.
We also encountered "Prompt Paralysis" during multimodal vision tasks. Because we strictly forbade the model from revealing the correct answer, the model would halt or output a single word (like "Twój") if the correct answer (like \( 6 \)) was part of the user's handwritten question (e.g., \( 6 \)-gon). We resolved this by fine-tuning the negative constraints. Lastly, we managed Cyrillic tokenization inefficiencies by transitioning to the latest unified google-genai SDK and optimizing the token budgets.
Accomplishments That We're Proud Of
We are incredibly proud of building a fully responsive, multilingual production application that is already live. Transitioning the platform to Google Cloud and the Gemini API has allowed us to offer a completely free tier and significantly lower the subscription cost to just 19 PLN ($5 USD) per month. Most of all, we are proud of the Gemini Vision Scratchpad Assistant—the ability to visually analyze a child's handwritten paper work in real-time and provide tailored feedback is a major educational milestone.
What We Learned
We learned how to design strict prompt boundaries for multi-modal agents to ensure safety and educational integrity. We also learned how to coordinate Next.js Server Components with client-side interactive widgets to deliver a seamless, native mobile-camera experience.
What's Next for ProstaMatma
We plan to expand our Python generator templates to include a wider range of interactive CKE and Matura exam questions. We also plan to use Vertex AI Agent Builder to index official CKE grading guidelines, ensuring our AI-generated hints are 100% aligned with official national scoring criteria.
Built With
- agentic-ai
- ai
- education
- fastapi
- gemini-3.5-flash
- git
- google-cloud
- google-genai
- machine-learning
- multimodal-ai
- next.js
- postgresql
- python
- react
- rest-api
- sqlalchemy
- typescript
Log in or sign up for Devpost to join the conversation.