Chat with a database using AI

    Shared 8/17/2026

    0 views

    Visual Workflow

    JSON Code

    {
      "id": "vSpwLB2bhckPTKJw",
      "meta": {
        "instanceId": "5bf153630c3f9d98febc21183744fe0b5c3668ae187d91ff22fd7c92542047dd",
        "templateId": "2090",
        "templateCredsSetupCompleted": true
      },
      "name": "Chat with a database using AI",
      "tags": [],
      "nodes": [
        {
          "id": "3019b559-6100-4ead-8e1a-a7dece2a6982",
          "name": "Sticky Note1",
          "type": "n8n-nodes-base.stickyNote",
          "position": [
            512,
            -64
          ],
          "parameters": {
            "color": 7,
            "width": 677,
            "height": 505,
            "content": "This workflow uses a Postgres DB, but you could swap it for a MySQL or SQLite one"
          },
          "typeVersion": 1
        },
        {
          "id": "73786411-5383-4921-82ee-06b3b582bab7",
          "name": "When chat message received",
          "type": "@n8n/n8n-nodes-langchain.chatTrigger",
          "position": [
            576,
            48
          ],
          "webhookId": "1c0d08f0-abd0-4bdc-beef-370c27aae1a0",
          "parameters": {
            "options": {}
          },
          "typeVersion": 1.1
        },
        {
          "id": "9df537e7-3ca2-4e72-bc85-ae0d944fbdd1",
          "name": "Simple Memory",
          "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
          "position": [
            896,
            272
          ],
          "parameters": {},
          "typeVersion": 1.3
        },
        {
          "id": "57b2b959-9f25-475f-b6bb-842139725411",
          "name": "AI Agent",
          "type": "@n8n/n8n-nodes-langchain.agent",
          "position": [
            800,
            48
          ],
          "parameters": {
            "options": {}
          },
          "typeVersion": 1.8
        },
        {
          "id": "f21ac2dc-56ff-4ea6-a29e-168e7dfaf3fa",
          "name": "OpenAI Chat Model",
          "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
          "position": [
            736,
            272
          ],
          "parameters": {
            "model": {
              "__rl": true,
              "mode": "list",
              "value": "gpt-5-mini",
              "cachedResultName": "gpt-5-mini"
            },
            "options": {}
          },
          "credentials": {
            "openAiApi": {
              "id": "und1mGOqtVqlpj8p",
              "name": "n8n free OpenAI API credits"
            }
          },
          "typeVersion": 1.2
        }
      ],
      "active": true,
      "pinData": {},
      "settings": {
        "binaryMode": "separate",
        "availableInMCP": false,
        "executionOrder": "v1"
      },
      "versionId": "7a0099c9-2077-44c5-af54-534d9c9588c7",
      "nodeGroups": [],
      "connections": {
        "Simple Memory": {
          "ai_memory": [
            [
              {
                "node": "AI Agent",
                "type": "ai_memory",
                "index": 0
              }
            ]
          ]
        },
        "OpenAI Chat Model": {
          "ai_languageModel": [
            [
              {
                "node": "AI Agent",
                "type": "ai_languageModel",
                "index": 0
              }
            ]
          ]
        },
        "When chat message received": {
          "main": [
            [
              {
                "node": "AI Agent",
                "type": "main",
                "index": 0
              }
            ]
          ]
        }
      }
    }