{
  "name": "Generate Complete Database Schemas with Claude for SQL Databases",
  "nodes": [
    {
      "id": "111e7ffd-a227-419e-92d8-4674937d500b",
      "name": "Initialize Variables",
      "type": "n8n-nodes-base.set",
      "position": [
        -2800,
        640
      ]
    },
    {
      "id": "fdd03c42-f3a4-4f97-b92b-b485006597d5",
      "name": "Architect Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "position": [
        -2448,
        864
      ]
    },
    {
      "id": "0fcd5225-a3e2-41ec-8a20-f91374943abb",
      "name": "Reviewer Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "position": [
        -2032,
        800
      ]
    },
    {
      "id": "35e74634-e270-4bb5-9254-92cc9ae537e0",
      "name": "Optimizer Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "position": [
        -1648,
        816
      ]
    },
    {
      "id": "5cf35188-cd26-4c03-a077-74c1b1e2a219",
      "name": "Agent 1: Database Architect",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -2512,
        624
      ]
    },
    {
      "id": "36347feb-c90a-4c6b-91de-05ce97d206c7",
      "name": "Agent 2: Schema Reviewer",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -2112,
        624
      ]
    },
    {
      "id": "2af46d4b-c82d-4caa-b035-00f031139901",
      "name": "Agent 3: Optimizer & Scorer",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -1696,
        624
      ]
    },
    {
      "id": "e996f5e3-2a0a-4074-8401-98678a9af716",
      "name": "Track Iteration",
      "type": "n8n-nodes-base.set",
      "position": [
        -1360,
        848
      ]
    },
    {
      "id": "8bcad8e1-19ba-4272-9a79-df0ca6e78b9b",
      "name": "SQL Generator Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "position": [
        -720,
        800
      ]
    },
    {
      "id": "8b4d9e93-09bf-44ae-8de5-867f8f863680",
      "name": "Agent 4: Generate SQL Script",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -736,
        544
      ]
    },
    {
      "id": "63b46e42-9b6a-41de-9451-79971b04139e",
      "name": "Success Response",
      "type": "n8n-nodes-base.set",
      "position": [
        352,
        432
      ]
    },
    {
      "id": "32d22b08-b65c-46fc-bb9d-6c70c9248ab2",
      "name": "Error Response",
      "type": "n8n-nodes-base.set",
      "position": [
        352,
        656
      ]
    },
    {
      "id": "f568d255-cfe1-4e5a-a511-bdba7169c1c8",
      "name": "Max Iterations Reached",
      "type": "n8n-nodes-base.set",
      "position": [
        -944,
        720
      ]
    },
    {
      "id": "8cb73c84-fd04-4f5c-a125-a905b723f83d",
      "name": "Is Score A or B?",
      "type": "n8n-nodes-base.if",
      "position": [
        -1296,
        576
      ]
    },
    {
      "id": "420bdf51-d812-40a6-8dc2-3a2b7e5de425",
      "name": "Can Retry?",
      "type": "n8n-nodes-base.if",
      "position": [
        -1136,
        896
      ]
    },
    {
      "id": "daa05f0e-e96f-4772-8aa2-fd87decab67e",
      "name": "Form",
      "type": "n8n-nodes-base.form",
      "position": [
        640,
        560
      ]
    },
    {
      "id": "f95d30af-f34c-4055-a6d9-4cd2d6a2b349",
      "name": "Execute SQL in PostgreSQL",
      "type": "n8n-nodes-base.postgres",
      "position": [
        32,
        544
      ]
    },
    {
      "id": "2a1a9a5c-b10b-43e0-bbfc-a32592dcd374",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3696,
        640
      ],
      "parameters": {
        "width": 528,
        "height": 256,
        "content": "## 📝 Form Intake\n**User fills database requirements**\n\n⚙️ **Customization Options:**\n- Add more fields for specific industries\n- Add file upload for existing schema\n- Add budget field for pricing tier"
      }
    },
    {
      "id": "f2bc8cbd-9fb3-49ed-afcc-5c66cf514c41",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3168,
        320
      ],
      "parameters": {
        "width": 352,
        "height": 240,
        "content": "## 🔧 Setup Phase\n**Prepares data for agent pipeline**\n\n⚙️ **Customization:**\n- Store user data in CRM here\n- Log to analytics (Mixpanel/Segment)\n- Add user identification/tracking\n\n🎯 **Purpose:** Enab"
      }
    },
    {
      "id": "cad9ac20-ac3e-460f-840f-d7d454cab077",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2640,
        256
      ],
      "parameters": {
        "width": 352,
        "height": 320,
        "content": "## 🤖 Agent 1: Architect\n**Creates initial schema design**\n\n⚙️ **Model Config:**\n- Temp: 0.3 (creative but consistent)\n- Max tokens: 4000\n\n🎨 **Customization:**\n- Switch to GPT-4 for cost savings\n- Incr"
      }
    },
    {
      "id": "1fd88b9e-b13d-4ae7-8280-c27941bb78f6",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2224,
        256
      ],
      "parameters": {
        "width": 336,
        "height": 320,
        "content": "## 🤖 Agent 2: Reviewer\n**Quality control & validation**\n\n⚙️ **Model Config:**\n- Temp: 0.1 (strict & analytical)\n- Max tokens: 3000\n\n🎨 **Customization:**\n- Add compliance checks (GDPR, HIPAA)\n- Add ind"
      }
    },
    {
      "id": "aa91d473-11a4-42fc-a99b-2d5f2fb0a5d6",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1808,
        256
      ],
      "parameters": {
        "width": 336,
        "height": 320,
        "content": "## 🤖 Agent 3: Optimizer\n**Final polish & scoring**\n\n⚙️ **Model Config:**\n- Temp: 0.5 (balanced creativity)\n- Max tokens: 3500\n\n🎨 **Customization:**\n- Adjust scoring criteria\n- Add performance benchmar"
      }
    },
    {
      "id": "589e4e59-6771-48c5-bbd0-65a5a2037800",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1344,
        208
      ],
      "parameters": {
        "width": 432,
        "height": 336,
        "content": "## 🔄 Quality Gate\n**Ensures high-quality output**\n\n⚙️ **Current Logic:**\n- A/B grades → Proceed ✅\n- C/D/F grades → Retry (max 3x)\n\n🎨 **Customization:**\n- Change threshold (accept C+?)\n- Add manual app"
      }
    },
    {
      "id": "ddfe7f84-6dec-4d76-b1bb-e9b518d08fab",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -960,
        1024
      ],
      "parameters": {
        "width": 368,
        "height": 304,
        "content": "## 🔁 Retry Loop\n**Iterative improvement system**\n\n⚙️ **Current:** Max 3 attempts\n\n🎨 **Customization:**\n- Increase max retries for complex projects\n- Add different agents for retries\n- Implement escala"
      }
    },
    {
      "id": "c85e8f0d-105f-4311-931f-595806af11e1",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -800,
        176
      ],
      "parameters": {
        "width": 368,
        "height": 336,
        "content": "## 🤖 Agent 4: SQL Generator\n**Converts schema to executable SQL**\n\n⚙️ **Model Config:**\n- Temp: 0.2 (precision critical)\n- Max tokens: 4000\n\n🎨 **Customization:**\n- Add migration versioning (Flyway/Liq"
      }
    },
    {
      "id": "aa299285-26ea-41c1-8563-371280cb3ae1",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        160,
        48
      ],
      "parameters": {
        "width": 336,
        "height": 336,
        "content": "## ✅ Execution Validation\n**Handles success & failures gracefully**\n\n⚙️ **Current Behavior:**\n- Success → Full response\n- Failure → Script + error details\n\n🎨 **Customization:**\n- Retry failed SQL auto"
      }
    },
    {
      "id": "3a0fcc3f-d8fa-4ebb-8361-68b5fefc4998",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3680,
        128
      ],
      "parameters": {
        "width": 480,
        "height": 480,
        "content": "## 🚀 Workflow Overview\n**AI Database Architect - Multi-Agent System**\n\n📊 **Performance:**\n- Average time: 60-90 seconds\n- Success rate: ~85% first attempt\n- Cost per run: ~$0.15-0.30\n\n🎯 **Conversion S"
      }
    },
    {
      "id": "efc60c80-5ed9-4f4e-bef4-1d59741b72e7",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -48,
        752
      ],
      "parameters": {
        "width": 256,
        "height": 176,
        "content": "## Query Execute\n\nIf you are using **PostgreSQL** this will automatically run the script on your database"
      }
    },
    {
      "id": "017f5635-1592-4da2-ab23-d70c2df11d74",
      "name": "Form Submission",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -3088,
        720
      ]
    },
    {
      "id": "54b07bcf-7c04-4064-a8f4-ed08eb8865e0",
      "name": "If User Is Using Excel",
      "type": "n8n-nodes-base.if",
      "position": [
        -400,
        560
      ]
    },
    {
      "id": "4bd49a49-fa81-42d1-b80d-192a99cbfaf3",
      "name": "Form End Without Execute",
      "type": "n8n-nodes-base.form",
      "position": [
        -80,
        1008
      ]
    },
    {
      "id": "ce8db403-6f22-44e7-8e68-b773102ff7ab",
      "name": "Sticky Note19",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3664,
        928
      ],
      "parameters": {
        "width": 448,
        "height": 272,
        "content": "## 🚀 Built by Evervise\n\n**Automating the repetitive so you can focus on what matters**\n\n### Need Help?\n📧 **Support**: mark.marin@evervise.com\n🌐 **Website**: [evervise.ai](https://evervise.ai)  \n💬 **Re"
      }
    }
  ],
  "connections": {
    "Can Retry?": {
      "main": [
        [
          {
            "node": "Agent 1: Database Architect",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Max Iterations Reached",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Error Response": {
      "main": [
        [
          {
            "node": "Form",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Reviewer Model": {
      "ai_languageModel": [
        [
          {
            "node": "Agent 2: Schema Reviewer",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Architect Model": {
      "ai_languageModel": [
        [
          {
            "node": "Agent 1: Database Architect",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Form Submission": {
      "main": [
        [
          {
            "node": "Initialize Variables",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Optimizer Model": {
      "ai_languageModel": [
        [
          {
            "node": "Agent 3: Optimizer & Scorer",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Track Iteration": {
      "main": [
        [
          {
            "node": "Can Retry?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is Score A or B?": {
      "main": [
        [
          {
            "node": "Agent 4: Generate SQL Script",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Track Iteration",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Success Response": {
      "main": [
        [
          {
            "node": "Form",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SQL Generator Model": {
      "ai_languageModel": [
        [
          {
            "node": "Agent 4: Generate SQL Script",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Initialize Variables": {
      "main": [
        [
          {
            "node": "Agent 1: Database Architect",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If User Is Using Excel": {
      "main": [
        [
          {
            "node": "Execute SQL in PostgreSQL",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Form End Without Execute",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Max Iterations Reached": {
      "main": [
        [
          {
            "node": "Agent 4: Generate SQL Script",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Agent 2: Schema Reviewer": {
      "main": [
        [
          {
            "node": "Agent 3: Optimizer & Scorer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Execute SQL in PostgreSQL": {
      "main": [
        [
          {
            "node": "Success Response",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Error Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Agent 1: Database Architect": {
      "main": [
        [
          {
            "node": "Agent 2: Schema Reviewer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Agent 3: Optimizer & Scorer": {
      "main": [
        [
          {
            "node": "Is Score A or B?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Agent 4: Generate SQL Script": {
      "main": [
        [
          {
            "node": "If User Is Using Excel",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}