Augment AI Chatbot Prompts with GraphRAG Knowledge Base - n8n Workflow

Use this expert n8n workflow to enhance AI chatbot responses by integrating GraphRAG via InfraNodus, transforming user queries into structured knowledge base lookups. Leverage custom n8n templates.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

AI developers seeking advanced Retrieval-Augmented Generation (RAG) implementations.
Organizations looking to integrate structured knowledge graphs (like InfraNodus) into their conversational AI systems.
n8n automation specialists building sophisticated language agents and custom n8n workflow solutions.
Users looking for high-quality, reasoned AI chatbot answers that go beyond standard LLM fact retrieval.

Overview

This powerful n8n workflow demonstrates how to create a highly reasoned AI chatbot agent by leveraging external knowledge graphs and a two-step GraphRAG process. Unlike simple RAG, this approach uses a dedicated reasoning ontology graph to first reformulate and augment the user's original query, ensuring it is conceptually aligned with the knowledge domain. The resulting augmented query is then used to retrieve a nuanced, high-quality answer from a separate knowledge base using InfraNodus’ GraphRAG capabilities.

Building this sophisticated agent is simplified by using this proven n8n template. Every n8n node in this n8n workflow is strategically configured to maximize the effectiveness of the AI interaction, providing far superior results than a standard chatbot integration.

How it Works

This automation is initiated by an n8n trigger and executes a three-stage logic flow:


  1. Trigger and Input: The n8n workflow begins when the When chat message received n8n trigger (a LangChain ChatTrigger) receives a message from a user. This starts the automation process, passing the user's raw input ($json.chatInput) to the next step.


  1. Query Augmentation (Reasoning Expert): The input is sent to the Prompt Augmented with Reasoning Ontology n8n node (an HTTP Request to InfraNodus). This request uses a designated 'reasoning' graph (like the 'eightos_system' ontology) with the reprompt request mode. The goal is to utilize the knowledge graph's structure to reformulate the user's query, transforming it based on established ontological logic. This pre-processing step creates a highly optimized prompt.


  1. Knowledge Base Retrieval (GraphRAG): The output (the augmented query) is then passed to the Ask the Knowledge Base n8n node. This second HTTP Request, still hitting the InfraNodus API, uses the response request mode. It queries the knowledge base, retrieving an answer using GraphRAG logic. Crucially, the system prompt here instructs the LLM to use the retrieved context as a reasoning logic rather than content for extraction, resulting in a more analytical and reasoned final response from this n8n workflow.

Installation Guide

To deploy this n8n workflow and start using advanced GraphRAG capabilities, follow these steps:


  1. Import the n8n Template: Copy the provided JSON data and paste it directly into your n8n instance via the 'Import from JSON' function.

  2. Set up InfraNodus Credentials: The workflow requires credentials for InfraNodus. Navigate to the Credentials section in n8n.

Create a new 'HTTP Bearer Auth' credential.
Name the credential (e.g., 'InfraNodus Expert').
Obtain your InfraNodus API key from the InfraNodus website and paste it into the Bearer Token field.
Ensure both HTTP Request n8n node credentials are linked to this new credential.

  1. Configure the Chat Trigger: The initial When chat message received n8n trigger must be deployed (set the workflow to 'Active') so that the public webhook URL is generated or the internal chat mechanism is enabled.

  2. Customize Graph Names: Review the Prompt Augmented with Reasoning Ontology and Ask the Knowledge Base n8n node configurations. Change the body.name parameter to match the specific InfraNodus knowledge graph names you wish to use for reasoning and knowledge retrieval.

Node Details

When chat message received (Chat Trigger n8n trigger):
Function: Serves as the starting point (n8n trigger) of the automation, listening for incoming user chat messages. This immediately kicks off the n8n workflow process.
Key Configuration: Configured as a public webhook to receive chat input.

Prompt Augmented with Reasoning Ontology (HTTP Request n8n node):
Function: Acts as the 'Reasoning Expert'. It sends the user query to InfraNodus, instructing it to use a pre-defined ontology graph (eightos_system) to reformulate the prompt based on structured logic.
Key Configuration: Uses the InfraNodus API URL, POST method, HTTP Bearer Auth, and sets requestMode to reprompt. The prompt input is {{ $json.chatInput }}.

Ask the Knowledge Base (HTTP Request n8n node):
Function: Executes the final GraphRAG step. It takes the newly augmented query and retrieves a reasoned response from the knowledge base. This is the culmination of the n8n workflow's logic.
* Key Configuration: Uses the InfraNodus API URL, POST method, HTTP Bearer Auth, and sets requestMode to response. The prompt input is dynamically set to the output of the reasoning step: {{ $json.aiAdvice[0].text }}. It includes a specific system prompt emphasizing using context for reasoning, not content extraction.

Related n8n Workflows

Free

Nodes: 3 Nodes
Updated: December 26 2025
View all
Created by

I'm Dmitry, the founder of InfraNodus — an AI text network analysis tool. I'm passionate about networks and data visualization and its ability to reveal what everyone else is missing and to highlight different perspectives. I'm sharing the n8n templates that make use of this unique capability of InfraNodus for multiple scenarios.

Featured*