Dynamic AI Agent Router for Tech Radar Knowledge Base - n8n Workflow

An advanced n8n workflow using an LLM router to direct user queries to either a RAG vector database (Pinecone) or a structured SQL database (MySQL) for precise tech radar advice.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

• Organizations managing a corporate Tech Radar or knowledge base.
• Technical teams needing dynamic data retrieval from both structured and unstructured sources.
• Automation specialists looking for advanced, multi-agent n8n templates.
• Developers building custom, AI-powered internal advice APIs.

Overview

Maintaining a corporate Tech Radar requires managing different data types—structured data for precise filtering (e.g., 'Is X used by Company Y?') and unstructured descriptions for context (e.g., 'Explain the benefits of Z'). This specialized n8n workflow solves the problem of querying these disparate sources efficiently.

It features a three-part architecture: first, automated synchronization syncs Google Sheets data into both a MySQL database and a Pinecone vector store; second, a custom webhook acts as an API endpoint; and third, a powerful LLM-based router decides in real-time whether a user's question requires a detailed RAG search or a precise SQL query. This dynamic routing, orchestrated entirely within this n8n workflow, ensures users always receive the fastest and most accurate response, making it one of the most intelligent n8n templates available.

How it Works

The overall n8n workflow operates in two main phases: Data Setup and Chat Execution.

Phase 1: Data Setup (Ingestion and Sync)


  1. Structured Data Ingestion: A Cron n8n trigger executes monthly. It first clears the existing 'techradar' table in MySQL, reads the latest data from the Google Sheets n8n node, and then inserts the fresh, structured data back into MySQL.

  2. RAG Data Preparation: The Google Sheets n8n node reads the data, and a subsequent Code n8n node transforms the rows into RAG-friendly paragraph blocks. This content updates a dedicated Google Doc via the Google Docs n8n node.

  3. Vector Indexing: A Google Drive n8n trigger activates whenever the Google Doc is updated. The document is downloaded, split using the Recursive Character Text Splitter, embedded using Google Gemini (via the Embeddings n8n node), and inserted into the Pinecone Vector Store. This keeps the vector knowledge base current.

Phase 2: Chat Execution (Routing)


  1. Webhook Activation: The process starts with the API Request - Webhook n8n trigger when a user sends a query to the defined endpoint.

  2. Agent Routing: The LLM - Determine - Agent Input Router n8n node, powered by a high-speed LLM (Groq Deepseek), analyzes the user's question and outputs either 'RAG' (for descriptive or conceptual queries) or 'SQL' (for queries requiring filtering or aggregation of structured data).

  3. Flow Control: The 'Determine if is 'RAG'' n8n node acts as the flow gate. The data is routed accordingly to the dedicated sub-workflow (Execute Workflow - RAG Agent or Execute Workflow - Sql Agent).

  4. Output Guardrail: The results from either sub-workflow are fed into the AI Agent - Output Guardrail n8n node. This agent, using the user's original query and a defined set of system instructions (including memory from the User Conversation History n8n node), sanitizes, validates, and formats the final expert advice.

  5. Final Response: The API Response n8n node sends the final, polished output back to the user via the webhook.

Installation Guide

To deploy this comprehensive n8n workflow, follow these setup steps:


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

  2. Credential Setup: Configure credentials for the following services (referencing the Sticky Note for details):

Google Sheets OAuth2 API
Google Drive OAuth2 API
Google Gemini (PaLM) API (for embeddings and some LLM roles)
Groq API (for high-speed routing LLM)
MySQL Database (for the techradar database)
Pinecone API (with a dedicated index, e.g., techradardata)

  1. External Resource Configuration: Ensure your Google Sheets document IDs, Google Docs URLs, and Pinecone Index names are correctly configured in the respective n8n nodes.

  2. Sub-Workflow Deployment: This main n8n workflow relies on two sub-workflows (RAG Agent and SQL Agent). You must create and activate these two workflows separately and update the IDs in the 'Execute Workflow' n8n nodes to match the IDs of your newly created sub-workflows.

  3. Activate Triggers: Activate the Cron n8n trigger for monthly MySQL synchronization and the Google Drive n8n trigger for continuous RAG updates, as well as the main Webhook n8n trigger.

Node Details

This advanced n8n workflow leverages numerous specialized n8n nodes:

API Request - Webhook (n8n trigger): The entry point for the chat API, configured to accept POST requests on the /radar-rag path.
Google Sheets - Tech Radar / Read TechRadar (n8n node): Used twice—once for RAG preparation and once for MySQL sync—to fetch all data from the Tech Radar spreadsheet.
Code - Transform table into rows (n8n node): Custom JavaScript converts array-of-object data (from the spreadsheet) into a single, cohesive text block per item, making it suitable for document indexing (RAG).
Google Drive - Doc File Updated (n8n trigger): A critical n8n trigger that ensures the RAG index is updated only when the source Google Doc changes, maintaining data freshness.
Pinecone - Vector Store for Embedding Content (n8n node): Handles the ingestion process, storing the embedded document chunks into the Pinecone index.
LLM - Determine - Agent Input Router (n8n node): Uses a powerful LLM to dynamically determine if the user query is best suited for structured SQL querying or unstructured RAG retrieval. This is a core component of this n8n template.
Determine if is 'RAG' (IF n8n node): A standard n8n node used for conditional routing, checking the output of the LLM router to fork the workflow execution.
Execute Workflow - RAG Agent / Sql Agent (n8n nodes): Calls external, dedicated n8n workflows that execute the respective AI logic (SQL or RAG) and return the preliminary answer.


  • AI Agent - Output Guardrail (n8n node): The final intelligent layer, utilizing LLM capabilities (llama3-8b) and memory (User Conversation history n8n node) to refine the AI's answer, ensuring compliance with predefined safety and relevance guardrails before responding to the user.

Related n8n Workflows

Free

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

I embarked on my coding journey at the age of 13, driven by a deep passion for AI, automation, and engineering. Over the years, I've taken on various roles including Developer, Engineer, Senior Engineer, Architect, Principal Engineer, Freelance Consultant, and Head of Engineering.

Featured*