AutomationFlowsAI & RAG › RAG

RAG

RAG. Uses httpRequest, agent, lmChatGoogleGemini, memoryPostgresChat. Webhook trigger; 16 nodes.

Webhook trigger★★★★☆ complexityAI-powered16 nodesHTTP RequestAgentGoogle Gemini ChatMemory Postgres ChatTool Vector StoreSupabase Vector StoreGoogle Gemini Embeddings
AI & RAG Trigger: Webhook Nodes: 16 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow follows the Agent → Google Gemini Embeddings recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "name": "rag",
  "nodes": [
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 2.1,
      "position": [
        -48,
        96
      ],
      "id": "bc60a346-e6e6-4a4f-ab7b-6891c553629d",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "typeVersion": 1.1,
      "position": [
        -304,
        96
      ],
      "id": "42a5358c-8046-4765-9c99-732e33f83f5e",
      "name": "When chat message received"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "typeVersion": 1,
      "position": [
        -144,
        288
      ],
      "id": "1bb653fd-7040-415b-a78b-9560085e53df",
      "name": "Google Gemini Chat Model",
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {},
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        16,
        288
      ],
      "id": "1204fd33-dc35-4b24-94c5-6a87e614a316",
      "name": "Simple Memory"
    },
    {
      "parameters": {},
      "type": "@n8n/n8n-nodes-langchain.embeddingsGoogleGemini",
      "typeVersion": 1,
      "position": [
        256,
        544
      ],
      "id": "25d66c05-af1f-4eb0-8dac-a9221c7c92ca",
      "name": "Embeddings Google Gemini",
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "dataType": "binary",
        "binaryMode": "specificField",
        "loader": "textLoader",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "typeVersion": 1.1,
      "position": [
        736,
        288
      ],
      "id": "719123c1-d732-46e7-b2f9-d36271d533e8",
      "name": "Default Data Loader"
    },
    {
      "parameters": {
        "formTitle": "Add doc for RAG",
        "formFields": {
          "values": [
            {
              "fieldLabel": "data",
              "fieldType": "file",
              "acceptFileTypes": ".txt"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.formTrigger",
      "typeVersion": 2.2,
      "position": [
        464,
        96
      ],
      "id": "40bc6f21-bfd8-4536-8a2e-d5965b0dc797",
      "name": "On form submission"
    },
    {
      "parameters": {
        "mode": "retrieve-as-tool",
        "toolDescription": "vector store which can retrieve documents about Chat-\u5b1b\u5b1b",
        "memoryKey": {
          "__rl": true,
          "value": "rag_demo",
          "mode": "list",
          "cachedResultName": "rag_demo"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.vectorStoreInMemory",
      "typeVersion": 1.3,
      "position": [
        144,
        288
      ],
      "id": "94fcf172-7a63-40be-8a71-73834a70104d",
      "name": "Retrieve Documents"
    },
    {
      "parameters": {
        "mode": "insert",
        "memoryKey": {
          "__rl": true,
          "value": "rag_demo",
          "mode": "list",
          "cachedResultName": "rag_demo"
        },
        "clearStore": true
      },
      "type": "@n8n/n8n-nodes-langchain.vectorStoreInMemory",
      "typeVersion": 1.3,
      "position": [
        672,
        96
      ],
      "id": "e2e6d257-2abc-4127-b238-8408812dd522",
      "name": "Insert Documents to Store"
    }
  ],
  "connections": {
    "When chat message received": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings Google Gemini": {
      "ai_embedding": [
        [
          {
            "node": "Retrieve Documents",
            "type": "ai_embedding",
            "index": 0
          },
          {
            "node": "Insert Documents to Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Default Data Loader": {
      "ai_document": [
        [
          {
            "node": "Insert Documents to Store",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "Insert Documents to Store",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Retrieve Documents": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "287f7bda-773b-4fa9-b2de-f238979a960d",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "Uf8uGe4wIAJ5TbvX",
  "tags": []
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

RAG. Uses httpRequest, agent, lmChatGoogleGemini, memoryPostgresChat. Webhook trigger; 16 nodes.

Source: https://github.com/jirayu-ct/n8n-agentic-rag-agent/blob/0f3eb3f0057e7c8e7dbee221f88b34aa87a7b4c9/example/RAG.json — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

Camila IA. Uses postgres, crypto, redis, agent. Webhook trigger; 92 nodes.

Postgres, Crypto, Redis +13
AI & RAG

This workflow automates customer chat with Chatwoot & n8n AI agent that handles incoming chats, qualifies leads, answers FAQs from Pinecone knowledge base, and escalates to a live human agent when one

HTTP Request, Memory Postgres Chat, Gmail Tool +7
AI & RAG

This workflow automates multi-channel AI-driven sales engagement for lead qualification, service information delivery, and consultation booking. It integrates WhatsApp, Facebook Messenger, Instagram D

Agent, OpenAI Embeddings, OpenAI Chat +11
AI & RAG

Indoor Farming Agent. Uses lmChatOpenAi, documentDefaultDataLoader, embeddingsOpenAi, toolVectorStore. Webhook trigger; 36 nodes.

OpenAI Chat, Document Default Data Loader, OpenAI Embeddings +16
AI & RAG

RAG. Uses lmChatOpenAi, documentDefaultDataLoader, toolVectorStore, googleDrive. Event-driven trigger; 22 nodes.

OpenAI Chat, Document Default Data Loader, Tool Vector Store +10