{
  "name": "Natural language database queries with dual-agent AI & PostgreSQL integration",
  "nodes": [
    {
      "id": "c4a7b5c1-f74e-4de0-9469-146a197c42f5",
      "name": "When Executed by Another Workflow",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "position": [
        -1568,
        368
      ]
    },
    {
      "id": "1f37374e-3c5c-4dad-bfa0-5e948cfbd6e5",
      "name": "Query agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -1328,
        368
      ]
    },
    {
      "id": "1019eeda-425f-4450-934e-0224c689a801",
      "name": "Think",
      "type": "@n8n/n8n-nodes-langchain.toolThink",
      "position": [
        -1136,
        592
      ]
    },
    {
      "id": "2219bc4a-cdf2-4297-9bd6-423d0f138319",
      "name": "OpenRouter Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        -1344,
        560
      ]
    },
    {
      "id": "21a65536-abfd-4d19-94c9-9aa8d839db16",
      "name": "Postgres Chat Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryPostgresChat",
      "position": [
        -288,
        80
      ]
    },
    {
      "id": "32cf9699-649c-4781-b27b-c68e7ff306a4",
      "name": "OpenRouter Chat Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        -448,
        80
      ]
    },
    {
      "id": "cacfb298-2ee6-4292-ade7-bb18436df301",
      "name": "Think1",
      "type": "@n8n/n8n-nodes-langchain.toolThink",
      "position": [
        -144,
        80
      ]
    },
    {
      "id": "6c979f9c-38df-4b8d-a7c2-be499bd37cd7",
      "name": "Download File1",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -1040,
        -288
      ]
    },
    {
      "id": "578c6f2d-d738-49d3-95f4-6de6a48c5754",
      "name": "Transcribe1",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        -816,
        -288
      ]
    },
    {
      "id": "68b40dcf-46a0-47e8-9f63-ce020f08c4c6",
      "name": "Telegram Trigger1",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -1488,
        -176
      ]
    },
    {
      "id": "e28131b3-4c13-4c5a-b6d1-e9be94970c9f",
      "name": "Voice or Text",
      "type": "n8n-nodes-base.switch",
      "position": [
        -1264,
        -176
      ]
    },
    {
      "id": "b8d80841-beeb-43f9-a51b-3ea3683c4ba1",
      "name": "Text",
      "type": "n8n-nodes-base.set",
      "position": [
        -944,
        -80
      ]
    },
    {
      "id": "e5e1508a-ceb2-49fd-b3d2-ef87338a230b",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        -608,
        -176
      ]
    },
    {
      "id": "be9cde2d-e131-406b-a061-49193941e159",
      "name": "Main agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -320,
        -176
      ]
    },
    {
      "id": "ec7a16f3-fd62-4952-a074-3c044de6e86f",
      "name": "SEND MESSAGE",
      "type": "n8n-nodes-base.telegram",
      "position": [
        128,
        -176
      ]
    },
    {
      "id": "4dfb46ad-d110-40e6-9a87-3c247fc2d8d3",
      "name": "CALL QUERY AGENT",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [
        -16,
        80
      ]
    },
    {
      "id": "dd79a9fb-cf29-4266-a51d-114713e030c0",
      "name": "ACCES DATABASE WITH DYNAMIC QUERYS",
      "type": "n8n-nodes-base.postgres",
      "position": [
        -976,
        368
      ]
    },
    {
      "id": "a302abcd-e6a0-4150-bcd7-84c549c1dc94",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1600,
        -544
      ],
      "parameters": {
        "width": 1960,
        "height": 800,
        "content": "# MAIN AGENT"
      }
    },
    {
      "id": "cfcf980f-e037-4c6a-9dd3-7ba4359f6b44",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1600,
        272
      ],
      "parameters": {
        "width": 1220,
        "height": 440,
        "content": "# SUB AGENT"
      }
    },
    {
      "id": "4aaa94db-f919-44d4-9c0f-c703d3838e94",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2320,
        -544
      ],
      "parameters": {
        "width": 1780,
        "height": 1760,
        "content": "# Setup & Configuration Guide\n\n## 📋 **Setup Checklist**\n```\n□ Install N8N workflow platform\n□ Set up PostgreSQL database\n□ Configure AI Agent nodes\n□ Test sub-workflow connection\n□ Validate query limi"
      }
    },
    {
      "id": "e223ef72-1654-4368-8832-963e485a600b",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -304,
        320
      ],
      "parameters": {
        "width": 576,
        "height": 560,
        "content": "## Need a tailor-made workflow? Tell me about your business and get a free proposal:\n\n**[Start here → Custom Automation Form](https://taskmorphr.com/contact)**\n\n---\n## 📈 Cost-Savings Snapshot  \nCuriou"
      }
    },
    {
      "id": "49e2aa95-5fa3-4576-bb06-c9b8b7bba111",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        16,
        720
      ],
      "parameters": {
        "width": 224,
        "height": 128,
        "content": "### 🛠️ Build it yourself  \nBrowse every ready-made workflow:  \n[Full Template Pack — coming soon](https://n8n.io/creators/diagopl/)\n"
      }
    }
  ],
  "connections": {
    "Text": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Merge": {
      "main": [
        [
          {
            "node": "Main agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Think": {
      "ai_tool": [
        [
          {
            "node": "Query agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Think1": {
      "ai_tool": [
        [
          {
            "node": "Main agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Main agent": {
      "main": [
        [
          {
            "node": "SEND MESSAGE",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Query agent": {
      "main": [
        [
          {
            "node": "ACCES DATABASE WITH DYNAMIC QUERYS",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Transcribe1": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Voice or Text": {
      "main": [
        [
          {
            "node": "Download File1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download File1": {
      "main": [
        [
          {
            "node": "Transcribe1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "CALL QUERY AGENT": {
      "ai_tool": [
        [
          {
            "node": "Main agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger1": {
      "main": [
        [
          {
            "node": "Voice or Text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Postgres Chat Memory": {
      "ai_memory": [
        [
          {
            "node": "Main agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "OpenRouter Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Query agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "OpenRouter Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Main agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "When Executed by Another Workflow": {
      "main": [
        [
          {
            "node": "Query agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}