Generative AI · EducationWorking prototype

Agentic AI Tutor with Citation-Aware RAG

2Answer modes
3Question grades
Top 5Vector matches

Problem, approach and evidence.

01

Problem

General-purpose AI tutors can answer without adapting explanation depth, verifying relevance or grounding detailed responses in course material.

02

Approach

A Flask tutoring workflow that grades questions, routes between brief and deep LangChain tools, adds Azure AI Search reference metadata, verifies relevance and generates quizzes from recent question history.

03

Evidence

The active application documents adaptive routing, top-five vector search, citation formatting and fallbacks, a conceptual verifier, two-attempt quizzes and JSON event logging.

Project overview.

Architecture diagram of the agentic AI tutor

Many AI tutors respond at one fixed level of detail, even when a learner shifts from a basic question to a conceptual follow-up. This Flask prototype treats response selection as an orchestration problem. An Azure OpenAI grader labels each question Strong, Normal or CounterCue, then routes Normal questions to a brief-answer tool and Strong or contextual follow-ups to a deep-answer tool. A greeting check prevents casual messages from entering the heavier path, so the interface can adapt its response mode without asking the learner to select one manually.

For deep questions, the application creates an Azure OpenAI embedding and issues a top-five vector query against Azure AI Search. Matches above the configured threshold contribute document names, page numbers and links to a tightly formatted citation prompt; if search is unavailable, fails or finds nothing, the system falls back to a detailed model-only response. A separate verifier evaluates whether the generated answer aligns conceptually with the question. This makes the prototype citation-aware, while keeping the fallback behaviour visible rather than presenting every answer as retrieved evidence.

The tutoring loop also turns question history into practice. Once the history contains three Strong questions, the system asks the model to generate a short quiz from the latest three, evaluates up to two attempts and returns either feedback or the expected answer with an explanation. Grades, selected tools, response duration, verifier output, quiz state and timestamps are written to chat_log.json. Together, those elements demonstrate adaptive routing, retrieval references, answer checking and lightweight learner memory in one working prototype, without claiming measured gains in learning outcomes.

Implementation highlights.

  1. 01

    LLM grader routes Strong, Normal and CounterCue questions.

  2. 02

    Separate LangChain tools produce brief and deep responses.

  3. 03

    Azure OpenAI embeddings connect to Azure AI Search vector matching.

  4. 04

    Post-generation verification checks conceptual relevance.

  5. 05

    Quiz generation, two-attempt evaluation and JSON event logging complete the learning loop.