{
  "name": "YT 1: AI Agents with memory, Postgress data base, vector database",
  "nodes": [
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $json.snippet }}",
        "options": {
          "systemMessage": "You are a helpful assistant"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 3.1,
      "position": [
        208,
        0
      ],
      "id": "85fc007f-dde6-49cc-8086-aec8b0915eaa",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "builtInTools": {},
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.3,
      "position": [
        80,
        208
      ],
      "id": "49b4e42b-81b9-403b-9272-e09c6f4ca09c",
      "name": "OpenAI Chat Model",
      "credentials": {
        "openAiApi": {
          "id": "vSZrRZ0IgjC3OBIy",
          "name": "OpenAi account"
        }
      }
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "a"
      },
      "type": "@n8n/n8n-nodes-langchain.memoryPostgresChat",
      "typeVersion": 1.3,
      "position": [
        224,
        208
      ],
      "id": "73ebc6b1-f02f-44ed-95ed-47eeb96f16b8",
      "name": "Postgres Chat Memory",
      "credentials": {
        "postgres": {
          "id": "CqT6aCCeFa6FiMZh",
          "name": "Postgres account 2"
        }
      }
    },
    {
      "parameters": {
        "mode": "retrieve-as-tool",
        "toolDescription": "you analyse car washing methods",
        "tableName": {
          "__rl": true,
          "value": "documents",
          "mode": "list",
          "cachedResultName": "documents"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.vectorStoreSupabase",
      "typeVersion": 1.3,
      "position": [
        400,
        224
      ],
      "id": "a548accb-901b-4606-8022-028acefeac80",
      "name": "Supabase Vector Store",
      "credentials": {
        "supabaseApi": {
          "id": "pNL1T7j9Gpq3ixbB",
          "name": "Supabase account"
        }
      }
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "typeVersion": 1.2,
      "position": [
        400,
        432
      ],
      "id": "e5baa32f-2776-475e-ab81-6da26a8105cf",
      "name": "Embeddings OpenAI",
      "credentials": {
        "openAiApi": {
          "id": "vSZrRZ0IgjC3OBIy",
          "name": "OpenAi account"
        }
      }
    },
    {
      "parameters": {
        "operation": "download",
        "fileId": {
          "__rl": true,
          "value": "1WXgmse0mzmk118Kk-8GZRF9IvRUQEKgWNhVu7e4kGjY",
          "mode": "list",
          "cachedResultName": "Ferrari Spider Car Wash Guide",
          "cachedResultUrl": "https://docs.google.com/document/d/1WXgmse0mzmk118Kk-8GZRF9IvRUQEKgWNhVu7e4kGjY/edit?usp=drivesdk"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [
        -32,
        640
      ],
      "id": "b32a5cd3-b3b0-4158-be28-dfcf42e26679",
      "name": "Download file",
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "ZjSng2TqoftUIu7u",
          "name": "Google Drive account"
        }
      }
    },
    {
      "parameters": {
        "mode": "insert",
        "tableName": {
          "__rl": true,
          "value": "documents",
          "mode": "list",
          "cachedResultName": "documents"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.vectorStoreSupabase",
      "typeVersion": 1.3,
      "position": [
        176,
        640
      ],
      "id": "954832af-2837-4fe0-9523-02f2fa262545",
      "name": "Supabase Vector Store1",
      "credentials": {
        "supabaseApi": {
          "id": "pNL1T7j9Gpq3ixbB",
          "name": "Supabase account"
        }
      }
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "typeVersion": 1.2,
      "position": [
        -32,
        848
      ],
      "id": "051a8e87-8fae-4567-9fcd-cac6214b784d",
      "name": "Embeddings OpenAI1",
      "credentials": {
        "openAiApi": {
          "id": "vSZrRZ0IgjC3OBIy",
          "name": "OpenAi account"
        }
      }
    },
    {
      "parameters": {
        "textSplittingMode": "custom",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "typeVersion": 1.1,
      "position": [
        208,
        848
      ],
      "id": "7f215fe5-fa58-47bb-8aab-0717f9f91acf",
      "name": "Default Data Loader"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
      "typeVersion": 1,
      "position": [
        208,
        1040
      ],
      "id": "d145dcfe-4476-4ac4-ab1f-fb83fd72e950",
      "name": "Recursive Character Text Splitter"
    },
    {
      "parameters": {
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "filters": {}
      },
      "type": "n8n-nodes-base.gmailTrigger",
      "typeVersion": 1.3,
      "position": [
        -64,
        0
      ],
      "id": "b46543e5-bd51-4a13-812d-e45f193d6142",
      "name": "Gmail Trigger",
      "credentials": {
        "gmailOAuth2": {
          "id": "x5FWufMfxuZU6ZDA",
          "name": "Gmail account"
        }
      }
    },
    {
      "parameters": {
        "sendTo": "={{ $('Gmail Trigger').item.json.From }}",
        "subject": "={{ $('Gmail Trigger').item.json.Subject }}",
        "message": "={{ $json.output }}",
        "options": {}
      },
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.2,
      "position": [
        560,
        0
      ],
      "id": "222782a0-41e6-4297-9643-dcfdf6cd9870",
      "name": "Send a message",
      "webhookId": "0ac4adad-09a5-49f5-8bf5-a02ef72a86f3",
      "credentials": {
        "gmailOAuth2": {
          "id": "x5FWufMfxuZU6ZDA",
          "name": "Gmail account"
        }
      }
    }
  ],
  "pinData": {},
  "connections": {
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Postgres Chat Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Supabase Vector Store": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI": {
      "ai_embedding": [
        [
          {
            "node": "Supabase Vector Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI1": {
      "ai_embedding": [
        [
          {
            "node": "Supabase Vector Store1",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Default Data Loader": {
      "ai_document": [
        [
          {
            "node": "Supabase Vector Store1",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "Recursive Character Text Splitter": {
      "ai_textSplitter": [
        [
          {
            "node": "Default Data Loader",
            "type": "ai_textSplitter",
            "index": 0
          }
        ]
      ]
    },
    "Download file": {
      "main": [
        [
          {
            "node": "Supabase Vector Store1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gmail Trigger": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Send a message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1",
    "availableInMCP": false
  },
  "versionId": "a803efda-8172-4868-9b9e-ff4db5af4a6e",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "df250217e36126b205250695baf2e8422cc27f2f57e01954fee87f402bc930b2"
  },
  "id": "N15SdArZ2zj51u6atxyAY",
  "tags": []
}