{
  "createdAt": "2025-09-02T05:02:09.689Z",
  "updatedAt": "2025-09-02T05:02:09.689Z",
  "id": "7NTJXYxlLfh8acC5",
  "name": "Knowledge store agent (with Google Drive)",
  "active": false,
  "isArchived": false,
  "nodes": [
    {
      "parameters": {
        "dataType": "binary",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "typeVersion": 1.1,
      "position": [
        -128,
        256
      ],
      "id": "708d9e4e-6566-4b18-86b8-8301bf0c72dd",
      "name": "Default Data Loader"
    },
    {
      "parameters": {
        "operation": "download",
        "fileId": {
          "__rl": true,
          "value": "={{ $json.id }}",
          "mode": "id"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [
        -432,
        32
      ],
      "id": "604a4e5e-5ccc-4db1-94dc-673711bea6af",
      "name": "Download file"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "typeVersion": 1.2,
      "position": [
        -336,
        656
      ],
      "id": "e8db240e-bb3f-43ab-b4ed-527c6c2e8f54",
      "name": "Embedding model"
    },
    {
      "parameters": {
        "options": {
          "systemMessage": "# Knowledge Store Agent System Prompt\n\nYou are a data analysis agent that retrieves and analyzes information from a vector store to answer user questions.\n\n## Your Task\n\n1. **Search the vector store** - Use similarity search to find relevant documents and data\n2. **Analyze the results** - Understand what the retrieved data tells you\n3. **Provide clear answers** - Give helpful responses based on the data you found\n\n## How to Work with Vector Data\n\n### Search Process\n- Use the user's question to search for similar content\n- Retrieve multiple relevant chunks of data\n- Look for patterns and connections across the results\n- Consider both exact matches and conceptually similar information\n\n### Analysis Guidelines\n- Read through all retrieved documents carefully\n- Identify key information that answers the user's question\n- Note any conflicting or incomplete information\n- Look for trends, patterns, or insights in the data\n\n### Response Format\n- Start with a direct answer to the user's question\n- Support your answer with specific information from the data\n- Cite which documents or sources your information comes from\n- Be clear about what you found and what you didn't find\n\n## Response Guidelines\n\n### When You Find Good Data\n- Give a confident, detailed answer\n- Include relevant quotes or data points\n- Explain how the information relates to their question\n- Offer additional insights if available\n\n### When Data is Limited\n- Be honest about what information is available\n- Share what you did find, even if partial\n- Suggest related questions you could help with\n- Don't make up information not in the data\n\n### When No Relevant Data is Found\n- Clearly state that you couldn't find relevant information\n- Suggest alternative ways to phrase the question\n- Offer to search for related topics\n\n## Key Principles\n\n- Always base answers on the retrieved data\n- Be transparent about your sources\n- Admit when information is unclear or missing\n- Help users understand what the data shows\n- Ask clarifying questions if the user's request is vague\n\nRemember: Your strength is finding and explaining information that already exists in the vector store. Focus on being accurate and helpful with the data you can retrieve."
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 2.2,
      "position": [
        384,
        32
      ],
      "id": "99f9315f-4f3d-48d9-a6f4-8c519b249eba",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "typeVersion": 1.3,
      "position": [
        176,
        32
      ],
      "id": "bedf3615-c8b0-4fa8-afc5-574bca1003d4",
      "name": "When chat message received"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "value": "gpt-4o",
          "mode": "list",
          "cachedResultName": "gpt-4o"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        288,
        240
      ],
      "id": "9751b75b-50ac-49c8-8f4d-24a8035b6e73",
      "name": "Model"
    },
    {
      "parameters": {},
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        432,
        240
      ],
      "id": "167d097a-69f6-4f1b-a741-8c8936adb3d2",
      "name": "Simple Memory"
    },
    {
      "parameters": {
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "triggerOn": "specificFolder",
        "folderToWatch": {
          "__rl": true,
          "value": "1y55jxSWMeFBBFOIXxHWofVA2vkro4YLI",
          "mode": "list",
          "cachedResultName": "Knowledge store",
          "cachedResultUrl": "https://drive.google.com/drive/folders/1y55jxSWMeFBBFOIXxHWofVA2vkro4YLI"
        },
        "event": "fileCreated",
        "options": {}
      },
      "type": "n8n-nodes-base.googleDriveTrigger",
      "typeVersion": 1,
      "position": [
        -640,
        32
      ],
      "id": "0cddc21e-a75f-48df-b168-8e288be12469",
      "name": "File uploaded"
    },
    {
      "parameters": {
        "content": "### Knowledge store agent\nA chat-based AI agent to retrieve, analyze, and answer questions using documents uploaded to Google Drive and stored in a vector database.\n\n#### Set up\n- Configure credentials in the **Google Drive** and **Open AI** nodes\n- Create a folder in Google Drive to store your documents, then select it in the \"File uploaded\" trigger node\n- Upload a file to that folder, return to n8n and click \"Execute workflow\"\n- Once **Insert documents** has been completed you can Open chat and ask the agent questions about your files.\n\n#### Next steps\nTry connecting other data sources to your knowledge base, using other triggers before the **Insert documents** node.\n",
        "height": 512,
        "width": 304,
        "color": 5
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1024,
        -16
      ],
      "typeVersion": 1,
      "id": "b60fde91-e9bf-4f03-a847-b471af228a95",
      "name": "Sticky Note"
    },
    {
      "parameters": {
        "content": "### Embeddings\n\nThe Insert and Retrieve operation use the same embedding node.\n\nThis is to ensure that they are using the **exact same embeddings and settings**.\n\nDifferent embeddings might not work at all, or have unintended consequences.\n",
        "height": 240,
        "width": 320,
        "color": 4
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -208,
        656
      ],
      "typeVersion": 1,
      "id": "2fa9684d-f20a-4262-9b8b-81babb2fecc5",
      "name": "Sticky Note3"
    },
    {
      "parameters": {
        "mode": "insert",
        "memoryKey": {
          "__rl": true,
          "value": "vector_store_key",
          "mode": "list",
          "cachedResultName": "vector_store_key"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.vectorStoreInMemory",
      "typeVersion": 1.3,
      "position": [
        -240,
        32
      ],
      "id": "64d17551-1637-4a53-a3e0-db45894c12a6",
      "name": "Insert documents"
    },
    {
      "parameters": {
        "mode": "retrieve-as-tool",
        "toolDescription": "Use this tool to retrieve any information required.",
        "memoryKey": {
          "__rl": true,
          "value": "vector_store_key",
          "mode": "list",
          "cachedResultName": "vector_store_key"
        },
        "topK": 10
      },
      "type": "@n8n/n8n-nodes-langchain.vectorStoreInMemory",
      "typeVersion": 1.3,
      "position": [
        640,
        368
      ],
      "id": "4f8a4a45-28a4-4684-b838-66011cc6a4a5",
      "name": "Retrieve documents"
    }
  ],
  "connections": {
    "Default Data Loader": {
      "ai_document": [
        [
          {
            "node": "Insert documents",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "Download file": {
      "main": [
        [
          {
            "node": "Insert documents",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Embedding model": {
      "ai_embedding": [
        [
          {
            "node": "Insert documents",
            "type": "ai_embedding",
            "index": 0
          },
          {
            "node": "Retrieve documents",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "File uploaded": {
      "main": [
        [
          {
            "node": "Download file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Retrieve documents": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "staticData": null,
  "meta": {
    "templateId": "knowledge_store_agent_with_google_drive"
  },
  "versionId": "9edeeb3d-b456-46a1-b752-35b1cf0c39cb",
  "triggerCount": 0,
  "shared": [
    {
      "createdAt": "2025-09-02T05:02:09.689Z",
      "updatedAt": "2025-09-02T05:02:09.689Z",
      "role": "workflow:owner",
      "workflowId": "7NTJXYxlLfh8acC5",
      "projectId": "sjNgDrdbhRMMF6SK"
    }
  ],
  "tags": [
    {
      "createdAt": "2025-06-25T04:00:38.130Z",
      "updatedAt": "2025-06-25T04:00:38.130Z",
      "id": "EyGUZypc5DKHVUyY",
      "name": "\ud328\uc2a4\ud2b8\ucea0\ud37c\uc2a4"
    }
  ]
}