{
  "name": "AI agent to chat with Supabase/PostgreSQL DB",
  "nodes": [
    {
      "id": "0a4e65b7-39be-44eb-8c66-913ebfe8a87a",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1140,
        840
      ],
      "parameters": {
        "width": 215,
        "height": 80,
        "content": "**Replace password and username for Supabase**"
      }
    },
    {
      "id": "2cea21fc-f3fe-47b7-a7b6-12acb0bc03ac",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -160,
        320
      ],
      "parameters": {
        "width": 280.2462120317618,
        "height": 545.9087885077763,
        "content": "### Set up steps\n\n#### Preparation\n1. **Create Accounts**:\n   - [N8N](https://n8n.partnerlinks.io/2hr10zpkki6a): For workflow automation.\n   - [Supabase](https://supabase.com/): For database hosting a"
      }
    },
    {
      "id": "eacc0c8c-11d5-44fb-8ff1-10533a233693",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -160,
        -200
      ],
      "parameters": {
        "width": 636.2128494576581,
        "height": 497.1532689930921,
        "content": "![5min Logo](https://res.cloudinary.com/de9jgixzm/image/upload/v1739773200/Skool%20Assets/ejm3hqnvhgwpnu2fv92s.png)\n## AI Agent to chat with Supabase/PostgreSQL DB\n**Made by [Mark Shcherbakov](https:/"
      }
    },
    {
      "id": "be1559ea-1f75-4e7c-9bdd-3add8d8be70b",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        140,
        320
      ],
      "parameters": {
        "width": 330.5152611046425,
        "height": 239.5888196628349,
        "content": "### ... or watch set up video [20 min]\n[![Youtube Thumbnail](https://res.cloudinary.com/de9jgixzm/image/upload/v1739773279/Youtube%20Thumbs/Chat%20With%20DB.png)](https://www.youtube.com/watch?v=-GgKz"
      }
    },
    {
      "id": "4ea87754-dead-49ea-848c-ed86c98e217b",
      "name": "When chat message received",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        720,
        400
      ]
    },
    {
      "id": "c20d6e57-eb41-4682-a7f5-5bb4323df476",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        760,
        680
      ]
    },
    {
      "id": "8d3b1faf-643c-4070-996d-a59cb06e1827",
      "name": "DB Schema",
      "type": "n8n-nodes-base.postgresTool",
      "position": [
        1180,
        660
      ]
    },
    {
      "id": "d9346ade-79d1-44c2-8fa6-b337ad8b0544",
      "name": "Get table definition",
      "type": "n8n-nodes-base.postgresTool",
      "position": [
        1340,
        660
      ]
    },
    {
      "id": "b88a21e0-d2ff-4431-bd84-dfd43edeb5c4",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        960,
        280
      ],
      "parameters": {
        "width": 215,
        "height": 80,
        "content": "**Finetune the prompt of assistant**"
      }
    },
    {
      "id": "fbe9eb68-5990-485c-820f-08234ea33194",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        940,
        400
      ]
    },
    {
      "id": "7f82d6d9-d7d6-4443-bbaa-c9b276a376e3",
      "name": "Run SQL Query",
      "type": "n8n-nodes-base.postgresTool",
      "position": [
        1040,
        660
      ]
    }
  ],
  "connections": {
    "DB Schema": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Run SQL Query": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Get table definition": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}