Inspiration

Learning a new topic often means jumping between Wikipedia, YouTube, and flashcard apps, hoping you didn't miss something important. We wanted to build a single AI-powered study companion that does everything: research the topic, write a structured guide, test your understanding, and adapt when you get something wrong — all autonomously.

What It Does

The AI Study Agent is an end-to-end autonomous learning system:

  1. Plan — Breaks any topic into ordered subtopics
  2. Research — Searches the web for each subtopic using Google's Gemini model with built-in search grounding
  3. Synthesize — Produces a cohesive study guide with introduction, sections, and summary
  4. Quiz — Generates adaptive multiple-choice questions with explanations
  5. Adapt — When you miss questions, it creates a focused re-study section and a new quiz targeting your weak areas
  6. Flashcards — Generates 10 flip cards from the guide for spaced repetition
  7. Mind Map — Visual SVG bubble chart of topic structure
  8. Cheat Sheet — Condensed one-page summary
  9. AI Chat — Ask follow-up questions about the guide
    1. Export — Download guide as Markdown or PDF ##How We Built It
    2. Frontend: Streamlit with custom CSS (glassmorphism cards, animated gradient background, dark/light theme toggle)
    3. AI: Google Gemini (gemini-3.1-flash-lite) via the google-genai SDK, with system instructions to control agent behavior
    4. PDF: fpdf2 with Helvetica-only rendering (ASCII-stripped for compatibility)
    5. PDF Upload: pypdf for extracting text from uploaded documents
    6. State: Streamlit session state for multi-step agent pipeline
    7. Persistence: JSON-based study history with quiz score analytics Key architecture decisions:
    8. Each agent phase is a separate function (plan, research, synthesize, generate_quiz, adapt) with a shared Trace object for reasoning transparency
    9. Client caching recycles the Gemini client unless the API key changes
    10. Quota exceeded errors surface a clear message with a link to generate a new API key ##Challenges We Faced
    11. Streamlit tab state management — The cheat sheet tab would reset when generating because st.rerun() caused the entire app to re-render. Fixed by removing st.rerun() and using session state flags.
    12. PDF export errors — fpdf2 doesn't support Unicode well; had to strip to ASCII and use try/except per line.
    13. Mind map JavaScript TypeError — SVG text elements with long topic names broke the layout. Fixed with html.escape() and character truncation.
    14. Flashcard flip animation — CSS backface-visibility and perspective required careful cross-browser handling.
    15. Quota management — Free-tier Gemini API keys run out quickly; we cache the client and show specific error messages. ##What's Next
    16. Speech-to-text for asking questions verbally
    17. Anki export for flashcard decks
    18. Multi-language support
    19. Collaborative study rooms

Built With

  • fpdf2
  • google-gemini
  • google-genai-sdk
  • html/css
  • pypdf
  • python
  • streamlit
  • svg
Share this project:

Updates