Skip to content

CourseContentAgent

A specialized AI-powered sub-workflow that serves as a reusable course content assistant for educational platforms. This workflow processes content requests from parent workflows and returns structured educational materials, lesson lists, or specific section content in JSON format.

Purpose

No business context provided yet — add a context.md to enrich this documentation.

This workflow functions as a centralized content generation service that can be called by other workflows to handle course-related queries. It's designed to maintain consistency in educational content delivery while providing flexibility for different types of content requests.

How It Works

  1. Receive Request: The workflow is triggered when called by another workflow, receiving a query parameter that specifies what content is needed
  2. AI Processing: The query is processed by an OpenAI-powered agent that has been specifically trained on course content for "Lesson 6: Leading a Team"
  3. Content Generation: Based on the query type, the agent either:
    • Returns a list of available lessons with section counts
    • Generates structured JSON content for specific lesson sections
  4. Return Response: The processed content is returned to the calling workflow in the requested format

Workflow Diagram

graph TD
    A[When Executed by Another Workflow] --> B[Sub agent]
    C[OpenAI Chat Model] --> B
    B --> D[Return to Parent Workflow]

Trigger

  • Type: Execute Workflow Trigger
  • Input: Query parameter containing the content request
  • Activation: Called by other workflows, cannot be triggered directly

Nodes Used

Node Type Purpose
Execute Workflow Trigger Receives calls from parent workflows with query parameters
LangChain Agent AI-powered content processor that handles course content requests
OpenAI Chat Model Provides the language model capabilities for content generation

External Services & Credentials Required

  • OpenAI API: Required for the chat model functionality
    • Credential name: "Waringa"
    • Model: gpt-4o-mini
    • Temperature: 0 (for consistent, deterministic responses)

Environment Variables

No environment variables are used in this workflow.

Data Flow

Input: - Query: String parameter specifying the content request (e.g., "Get Section Content for Lesson 'Leading a Team', Section 2")

Output: - For lesson lists: Plain text listing available lessons with section counts - For specific content: Structured JSON with section details including: - sectionNumber: The section identifier - sectionTitle: The section title (e.g., EDU_6_1_10_Lesson_1) - sectionContent: The complete section content with formatting preserved

Error Handling

No explicit error handling paths are implemented in this workflow. Error handling would be managed by: - The calling parent workflow - n8n's default error handling mechanisms - OpenAI API error responses

Known Limitations

  • Currently contains content only for "Lesson 6: Leading a Team"
  • Cannot be tested directly due to its sub-workflow nature
  • Requires parent workflows for execution
  • Content is hardcoded in the system message rather than being dynamically loaded

This is a sub-workflow designed to be called by course delivery workflows. Specific parent workflows are not identified in the current configuration.

Setup Instructions

  1. Import Workflow: Import the workflow JSON into your n8n instance

  2. Configure OpenAI Credentials:

    • Create an OpenAI API credential in n8n
    • Ensure it has access to the gpt-4o-mini model
    • Update the credential reference in the "OpenAI Chat Model" node
  3. Verify Configuration:

    • Ensure the Execute Workflow Trigger is properly configured
    • Check that the LangChain Agent has the correct system message
    • Verify the OpenAI Chat Model is connected to the agent
  4. Test Integration:

    • Create a parent workflow that calls this sub-workflow
    • Test with sample queries like "list lessons" or "Get Section Content for Lesson 'Leading a Team', Section 1"
    • Verify JSON output format for content requests
  5. Customize Content (Optional):

    • Update the system message in the LangChain Agent to include additional lessons
    • Modify output format requirements as needed
    • Adjust the OpenAI model temperature if different response consistency is desired

Note: This workflow cannot be executed directly and must be called from another workflow using the "Execute Workflow" node.