AI-Powered Assignment Grading and Multi-Format Report Generation - n8n Workflow

Automate assignment grading using GPT-4-Turbo. This powerful n8n workflow extracts text, applies a grading rubric, and generates detailed HTML and CSV reports.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Educators and University Professors needing consistent, fast grading.
Corporate Trainers who need to evaluate assessment submissions.
Users looking for advanced examples of structured AI output within an n8n workflow.
System Administrators seeking robust n8n templates for document processing and reporting.

Overview

This comprehensive n8n workflow solves the tedious problem of manual assignment grading by leveraging the power of large language models. Designed for educators and trainers, this solution ensures the consistent application of rubrics using the cutting-edge gpt-4-turbo model.

When an assignment is submitted via the custom n8n trigger webhook, the system processes the file, compares the text content against a specified answer script, calculates scores, and provides structured feedback. The resulting data is then compiled into easily exportable multi-format reports (HTML for rich viewing and CSV for data analysis). This advanced n8n workflow significantly reduces administrative overhead and provides standardized, quantifiable results, making it one of the most useful n8n templates for academic environments.

How it Works

The process begins with the Webhook n8n trigger, which initiates the n8n workflow upon receiving a new submission (file upload) at the /grade-assignment path. First, the Extract Text from Test Paper n8n node converts the raw file data into plain text. This text is then combined with student identification details and a predefined Answer Script (rubric) in subsequent Set n8n node steps.

The core logic resides in the AI Agent - Grade Assignment n8n node, which utilizes the OpenAI Chat Model (running gpt-4-turbo) and a Structured Output Parser. This robust configuration forces the AI to provide a highly accurate, structured JSON grade report, adhering strictly to the desired schema defined in the prompt.

Finally, the Generate Results Table n8n node scripts the creation of both HTML and CSV versions of the grade report. The workflow concludes by preparing the formatted response using the Respond to Webhook n8n node, delivering the structured results, summary, and HTML report back to the initiating system.

Installation Guide


  1. Import the n8n workflow: Copy the provided JSON and import it directly into your n8n instance.

  2. Configure OpenAI Credentials: Locate the OpenAI Chat Model n8n node and set up or select your existing OpenAI API credential. Ensure the API key has access to gpt-4-turbo.

  3. Configure Webhook: Activate the Webhook - Upload Test Paper n8n trigger. Note the production or test URL and path (/grade-assignment). This URL must be used by the system submitting the assignments.

  4. Customize Rubric: Update the Load Answer Script n8n node with your specific course material and grading key.

  5. Test: Run the n8n workflow manually or via an external POST request containing raw file data and optional metadata (like studentName).

Node Details


  • Webhook - Upload Test Paper (n8n trigger): The starting n8n node, listening on the path /grade-assignment. It is configured to handle the raw body input, which is essential for receiving assignment files.

  • Extract Text from Test Paper: An essential n8n node dedicated to converting the raw assignment file into usable text data for the subsequent LLM processing.

  • Prepare Assignment Data & Load Answer Script (Set n8n node): These Set n8n nodes prepare the necessary inputs, combining student metadata with the extracted text and defining the hardcoded answer key and grading rubric.

  • AI Agent - Grade Assignment: The central n8n node utilizing Langchain functionality. It uses a detailed system prompt defining the grading rules and enforces a mandatory JSON output structure for accurate parsing.

  • OpenAI Chat Model: Configures the underlying LLM for the AI Agent, specifically using the high-performing gpt-4-turbo model for complex reasoning and accurate evaluation within the n8n workflow.

  • Structured Output Parser: A critical Langchain n8n node that validates and extracts the AI's structured JSON response, ensuring data integrity for the subsequent reporting steps in the n8n workflow.

  • Generate Results Table (Code n8n node): A custom JavaScript n8n node that processes the AI's validated JSON output to dynamically construct rich HTML tables and flat CSV data strings, preparing these artifacts for multi-format delivery.

Related n8n Workflows

Free

Nodes: 10 Nodes
Updated: December 26 2025
View all
Created by
Cheng Siong Chin
Cheng Siong Chin

Prof. Cheng Siong CHIN serves as Chair Professor in Intelligent Systems Modelling and Simulation in Newcastle University, Singapore. His academic credentials include an M.Sc. in Advanced Control and Systems Engineering from The University of Manchester and a Ph.D. in Robotics from Nanyang Technological University.

Featured*