A comprehensive n8n workflow demonstrating advanced AI techniques: Retrieval Augmented Generation (RAG) with Pinecone, autonomous agents for scheduling, and LLM-powered email classification using n8n.
Download this n8n workflow template and start using it instantly.






















Automation Specialists looking for advanced n8n templates.
Technical Teams interested in building RAG knowledge bases.
Developers needing to implement autonomous AI agents using n8n.
Users aiming to leverage powerful language models (LLMs) within their n8n trigger flows.
This advanced n8n workflow serves as a powerful demonstration of three distinct, cutting-edge AI automation techniques available within n8n. It moves far beyond simple integration, showcasing the true capability of the platform for technical teams.
First, it presents an example of an LLM-powered email classifier, automatically labeling incoming emails based on content. Second, and most complex, is the Retrieval Augmented Generation (RAG) setup, which indexes a PDF document into a vector database (Pinecone) and then uses an n8n trigger (Chat Trigger) to allow querying against that custom knowledge base using GPT-4o. Finally, it illustrates how to build an autonomous AI assistant using the Agent n8n node, capable of using external tools (like Google Calendar API calls) to fulfill user requests, such as booking appointments. This collection of n8n templates is invaluable for understanding modern AI integration.
The n8n workflow is divided into three primary examples:
Gmail Trigger, starts the process upon a new email.Assign label with AI LangChain Text Classifier n8n node takes the email text.OpenAI Chat Model to categorize the email into 'automation' or 'music' based on descriptions.Gmail n8n node (Add automation label or Add music label) applies the correct label to the message.PDFs to download (a placeholder) providing the PDF URL and metadata. The Download PDF HTTP Request node retrieves the binary file.Recursive Character Text Splitter breaks the PDF into manageable chunks.Default Data Loader processes the binary data, and Embeddings OpenAI generates vector representations.Insert into Pinecone vector store n8n node uploads these vectors into the specified Pinecone index and namespace ('whitepaper').When chat message received n8n trigger starts the query process.Read Pinecone Vector Store (linked to Embeddings OpenAI2) to access the vectors.Vector Store Retriever fetches the most relevant document chunks.Question and Answer Chain feeds these chunks, along with the user query, to the OpenAI Chat Model (GPT-4o) to generate a grounded response, ensuring the answer is based only on the PDF content.Appointment booking agent n8n node uses a detailed system prompt and Window Buffer Memory to maintain context.Anthropic Chat Model (for the LLM reasoning).Get calendar availability tool (a specialized n8n node for API calls) to check Max’s schedule.Book appointment tool to execute the Google Calendar API call, scheduling the 30-minute event.To use this powerful n8n workflow, follow these steps:
OpenAI Chat Model, Anthropic Chat Model, Embeddings OpenAI).Get calendar availability, Book appointment).Send message n8n node.Insert into Pinecone vector store n8n node configuration.This n8n workflow utilizes numerous specialized LangChain and core n8n node types:
Webhook / Chat Trigger: Core n8n trigger nodes (Webhook, When chat message received). They define the starting point for execution.
LangChain Text Classifier (Assign label with AI): Uses an LLM (OpenAI Chat Model1) to categorize input text (email body) into predefined classes (automation, music). This is a key AI component of the n8n workflow.
n8n Gmail Node: Performs operations like adding labels (addLabels) based on AI classification.
LangChain Agent (Appointment booking agent): The core intelligence of Example 3. It utilizes system messages and memory to act autonomously and decide which tools to use.
LangChain Tool HTTP Request (Get calendar availability, Book appointment): Specialized n8n nodes that expose API endpoints (Google Calendar) to the AI Agent for decision-making and execution.
LangChain Vector Store Pinecone: Used in two modes: insert (for uploading embedded chunks) and read (for retrieval during RAG querying). Requires Pinecone credentials for this n8n template.
LangChain Question and Answer Chain: Orchestrates the RAG process, taking context from the retriever and generating an answer via the OpenAI Chat Model (GPT-4o).
Core n8n Node (Execute JavaScript, If): Demonstrates basic data manipulation and conditional logic early in the n8n workflow structure.
Use this efficient n8n workflow to capture product ideas instantly via Slack slash commands and automatically organize them into a Notion database, ensuring no idea is ever lost.

Use this robust n8n workflow to automatically synchronize new products created in Pipedrive directly into Stripe. Includes product setup and price record generation.

Seamlessly automate lead synchronization using this n8n workflow. Move contacts from Airtable directly into a Lemlist campaign, streamlining your sales outreach and improving efficiency.

Use this advanced n8n workflow to automatically generate and apply optimized YouTube SEO metadata (titles, descriptions, tags) using an AI agent (DeepSeek) after user confirmation.








































