AutomationFlowsAI & RAG › RAG Agent Part-1 (context Injection)

RAG Agent Part-1 (context Injection)

RAG Agent Part-1 (Context Injection). Uses googleDrive, vectorStorePinecone, embeddingsOpenAi, documentDefaultDataLoader. Event-driven trigger; 10 nodes.

Event trigger★★★☆☆ complexityAI-powered10 nodesGoogle DrivePinecone Vector StoreOpenAI EmbeddingsDocument Default Data LoaderText Splitter Recursive Character Text Splitter
AI & RAG Trigger: Event Nodes: 10 Complexity: ★★★☆☆ AI nodes: yes Added:

This workflow follows the Documentdefaultdataloader → OpenAI 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 Agent Part-1 (Context Injection)",
  "nodes": [
    {
      "parameters": {},
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        -272,
        0
      ],
      "id": "e9ef4aca-0221-4e70-9092-3ed70406e7b1",
      "name": "When clicking \u2018Execute workflow\u2019"
    },
    {
      "parameters": {
        "resource": "fileFolder",
        "limit": 10,
        "filter": {
          "folderId": {
            "__rl": true,
            "value": "YOUR_GOOGLE_DRIVE_FOLDER_ID",
            "mode": "list",
            "cachedResultName": "n8n_documents_rag_agent_pinecone",
            "cachedResultUrl": "https://drive.google.com/drive/folders/YOUR_GOOGLE_DRIVE_FOLDER_ID"
          }
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [
        -64,
        0
      ],
      "id": "ac3d471e-eee9-4b7d-abd8-26bb8451fe85",
      "name": "Search files and folders",
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "download",
        "fileId": {
          "__rl": true,
          "value": "={{ $json.id }}",
          "mode": "id"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [
        144,
        0
      ],
      "id": "056cf30c-9893-4bc3-ac45-7667c130a1c5",
      "name": "Download file",
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "mode": "insert",
        "pineconeIndex": {
          "__rl": true,
          "value": "resume-projects-docs",
          "mode": "list",
          "cachedResultName": "resume-projects-docs"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
      "typeVersion": 1.3,
      "position": [
        352,
        0
      ],
      "id": "152e92e5-3931-486b-83a3-a5bce0cdc98d",
      "name": "Pinecone Vector Store",
      "credentials": {
        "pineconeApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "typeVersion": 1.2,
      "position": [
        272,
        208
      ],
      "id": "cd34e7eb-0eca-4bd7-a8c9-a1860276392c",
      "name": "Embeddings OpenAI",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "dataType": "binary",
        "textSplittingMode": "custom",
        "options": {
          "metadata": {
            "metadataValues": [
              {
                "name": "file_name",
                "value": "={{ $json.name }}"
              }
            ]
          }
        }
      },
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "typeVersion": 1.1,
      "position": [
        496,
        208
      ],
      "id": "4509bbdd-1166-4401-88b7-79e4f2cae359",
      "name": "Default Data Loader"
    },
    {
      "parameters": {
        "chunkOverlap": 250,
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
      "typeVersion": 1,
      "position": [
        496,
        368
      ],
      "id": "34d266ab-b05f-45ff-a517-04765f4d528e",
      "name": "Recursive Character Text Splitter"
    },
    {
      "parameters": {
        "content": "Pinecone API Key: \nYOUR_PINECONE_API_KEY",
        "width": 448
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        800,
        -32
      ],
      "typeVersion": 1,
      "id": "00c5f2d9-3055-4aed-8a04-96cae224d56a",
      "name": "Sticky Note"
    },
    {
      "parameters": {
        "content": "Note: \n\nVector dimension should always match with dimension of index. (e.g., 512, 1536). \n\nChange dimension while creating 'index' in Pinecone database. ",
        "height": 176,
        "width": 336,
        "color": 6
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -288,
        208
      ],
      "typeVersion": 1,
      "id": "7a9c8cfd-dd31-41ed-a375-314f3fd0eac0",
      "name": "Sticky Note1"
    },
    {
      "parameters": {
        "content": "Learning (Data Injection Flow): \n\nData Extraction: The process begins with source documents, such as PDFs. Data is extracted from these files to begin the workflow.\n\nChunking: The extracted text is split into smaller segments called \"Chunks of text\" (e.g., Chunk 1, Chunk 2, etc.).\n\nEmbedding Generation: These text chunks are sent to an \"Embedding API\". The API converts the text chunks into numerical representations known as \"vectors\" or \"Embeddings\".\n\nStorage in Semantic Index: The generated embeddings are then stored in a \"semantic index,\" which becomes the \"Knowledge base\".\n\nVector Store Components: In this index/vector store, both the \"Embeddings\" and the original \"Doc chunks\" are stored together.\n\nSupported Technologies: Examples of technologies used for this storage include ChromaDb, Faiss, Pinecone, and Azure Index.\n",
        "height": 608,
        "width": 448,
        "color": 5
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        800,
        208
      ],
      "typeVersion": 1,
      "id": "3171ffe9-0b6c-4768-9c0e-65286e6dc1fc",
      "name": "Sticky Note2"
    }
  ],
  "connections": {
    "When clicking \u2018Execute workflow\u2019": {
      "main": [
        [
          {
            "node": "Search files and folders",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Search files and folders": {
      "main": [
        [
          {
            "node": "Download file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download file": {
      "main": [
        [
          {
            "node": "Pinecone Vector Store",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI": {
      "ai_embedding": [
        [
          {
            "node": "Pinecone Vector Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Default Data Loader": {
      "ai_document": [
        [
          {
            "node": "Pinecone Vector Store",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "Recursive Character Text Splitter": {
      "ai_textSplitter": [
        [
          {
            "node": "Default Data Loader",
            "type": "ai_textSplitter",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1",
    "binaryMode": "separate",
    "availableInMCP": false
  },
  "staticData": null,
  "triggerCount": 0,
  "meta": {
    "templateCredsSetupCompleted": true
  }
}

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 Agent Part-1 (Context Injection). Uses googleDrive, vectorStorePinecone, embeddingsOpenAi, documentDefaultDataLoader. Event-driven trigger; 10 nodes.

Source: https://github.com/DuttPanchal04/n8n-ai-automation-portfolio/blob/main/rag-agent-part-1-context-injection/rag-agent-part-1-context-injection-workflow.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

Deploy a personal AI assistant that answers recruiter questions about your skills and projects, then automatically emails your CV as a PDF attachment when requested. Upload your portfolio documents (r

Google Drive Trigger, Google Drive, Pinecone Vector Store +11
AI & RAG

Security incidents. Uses googleDriveTrigger, googleDrive, vectorStorePinecone, documentDefaultDataLoader. Event-driven trigger; 29 nodes.

Google Drive Trigger, Google Drive, Pinecone Vector Store +9
AI & RAG

The IngestionDocs workflow is a fully automated **document ingestion and knowledge management system built with n8n**. Its purpose is to continuously ingest organizational documents from Google Drive,

Pinecone Vector Store, OpenAI Embeddings, Document Default Data Loader +9
AI & RAG

Automates the process of generating, storing, and publishing engaging LinkedIn posts derived from books (PDFs) using AI and vector search.

Google Drive Trigger, Google Drive, Pinecone Vector Store +10
AI & RAG

Unlock unparalleled efficiency and elevate customer satisfaction with our AI-Powered Customer Support: Email, Knowledge Base & Human Escalation Automation template. This sophisticated n8n workflow is

OpenAI Chat, Agent, Gmail +11