Skip to main content
Educational & Speaking

Moodle x n8n - AI Exam Grading

AI grading of open-ended exam answers inside Moodle, criterion by criterion, grounded in the course's own lectures. 30+ papers graded with written feedback in the January 2026 exams; the teacher keeps the final say.

Workflow Screenshots

Moodle x n8n - AI Exam Grading - Screenshot 1

About This Project

For a PhD research project at the Technical University of Sofia, I built a Moodle plugin and an AI grading pipeline that scores open-ended answers criterion by criterion, using the course's own lecture materials as context. In the January 2026 exams it graded 30+ papers in about a minute, with written feedback on each criterion, and the teacher kept the final say. The researcher's published study reports strong agreement with independent human grading.

The problem: Can open-ended exam answers be scored automatically against a rubric, with a written justification for every criterion, grounded in what was actually taught, while the teacher still decides the final grade?

What was built:

  • A custom Moodle plugin (local_assesswebhook) that sends every submitted assignment or quiz attempt to n8n
  • An index of the course materials in Supabase pgvector: lectures (PDF, DOCX, PPTX) split into segments of about 1,000 characters with 200 overlap; 340 segments from 28 files across 4 courses
  • An n8n grading workflow that takes the assignment and the answer, finds the 20 closest lecture segments from the same course, scores each rubric criterion with GPT-4.1-mini and writes the justification, and checks the UML diagram task with GPT-4.1 vision
  • The grade lands in the Moodle rubric, where the teacher reviews it and releases it
  • Hourly course sync and automatic indexing of new files

The exam (21-22 January 2026):

  • One Bulgarian and one English group, an exam with 5 tasks and a 20-criterion rubric
  • 30+ papers graded with written feedback on each criterion
  • The researcher's publication at TU Sofia reports a strong level of agreement between automated and expert scoring, with relatively low average deviation

Stack: Moodle 4.5 (PHP plugin), n8n, OpenAI GPT-4.1-mini and GPT-4.1 vision, Supabase pgvector, Docker, Hetzner.

Technologies Used

n8nn8nMoodleMoodleOpenAIOpenAISupabaseSupabaseDockerDocker

Interested in a Similar Solution?

Let's discuss how I can help automate your business processes.