{
  "name": "multi_agent_Cloudmcpserver_sse_MSSQL_and_RAG_v1-2-lowInteractContext copy",
  "nodes": [
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "typeVersion": 1.1,
      "position": [
        -1080,
        220
      ],
      "id": "ef846c96-119b-4ae5-a25b-15b90a6b0beb",
      "name": "When chat message received"
    },
    {
      "parameters": {
        "contextWindowLength": 2
      },
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        -340,
        440
      ],
      "id": "3c6e5b9e-78dd-42ba-85c0-d19735a6ee5d",
      "name": "Simple Memory"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "2966067a-7bb6-4316-8ad9-2b7681c7e0b9",
              "leftValue": "={{$json[\"output\"]}}",
              "rightValue": "",
              "operator": {
                "type": "string",
                "operation": "equals",
                "name": "filter.operator.equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        0,
        0
      ],
      "id": "0c470755-7839-4fa4-924c-5982084d613a",
      "name": "If"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=\u0e41\u0e1b\u0e25\u0e07\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e19\u0e35\u0e49\u0e40\u0e1b\u0e47\u0e19 JSON \u0e2a\u0e33\u0e2b\u0e23\u0e31\u0e1a MongoDB: {{ $('SQL Agent').first().json.output }}",
        "options": {
          "systemMessage": "=\u0e04\u0e38\u0e13\u0e40\u0e1b\u0e47\u0e19 data engineer \u0e17\u0e35\u0e48\u0e23\u0e31\u0e1a\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e08\u0e32\u0e01 AI agent \u0e41\u0e23\u0e01\u0e21\u0e32\u0e41\u0e1b\u0e25\u0e07\u0e40\u0e1b\u0e47\u0e19 JSON \u0e2a\u0e33\u0e2b\u0e23\u0e31\u0e1a MongoDB\n\n\u0e02\u0e49\u0e2d\u0e01\u0e33\u0e2b\u0e19\u0e14:\n- Return \u0e40\u0e09\u0e1e\u0e32\u0e30 valid JSON object (\u0e44\u0e21\u0e48\u0e43\u0e2a\u0e48 ```json``` \u0e2b\u0e23\u0e37\u0e2d\u0e04\u0e33\u0e2d\u0e18\u0e34\u0e1a\u0e32\u0e22)\n- \u0e43\u0e0a\u0e49\u0e20\u0e32\u0e29\u0e32\u0e44\u0e17\u0e22\u0e43\u0e19\u0e1f\u0e34\u0e25\u0e14\u0e4c\u0e17\u0e35\u0e48\u0e40\u0e2b\u0e21\u0e32\u0e30\u0e2a\u0e21\n- \u0e42\u0e04\u0e23\u0e07\u0e2a\u0e23\u0e49\u0e32\u0e07 JSON \u0e15\u0e49\u0e2d\u0e07\u0e0a\u0e31\u0e14\u0e40\u0e08\u0e19\u0e41\u0e25\u0e30 query \u0e44\u0e14\u0e49\u0e21\u0e35\u0e1b\u0e23\u0e30\u0e2a\u0e34\u0e17\u0e18\u0e34\u0e20\u0e32\u0e1e\n\n\u0e01\u0e32\u0e23\u0e08\u0e31\u0e14\u0e01\u0e32\u0e23\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25:\n- \u0e43\u0e0a\u0e49\u0e40\u0e09\u0e1e\u0e32\u0e30\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e17\u0e35\u0e48\u0e44\u0e14\u0e49\u0e23\u0e31\u0e1a\u0e08\u0e32\u0e01 agent \u0e41\u0e23\u0e01\n- \u0e2b\u0e49\u0e32\u0e21\u0e40\u0e1e\u0e34\u0e48\u0e21\u0e40\u0e15\u0e34\u0e21\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e2b\u0e23\u0e37\u0e2d\u0e15\u0e35\u0e04\u0e27\u0e32\u0e21\u0e40\u0e01\u0e34\u0e19\u0e08\u0e32\u0e01\u0e17\u0e35\u0e48\u0e21\u0e35\n- \u0e2b\u0e49\u0e32\u0e21\u0e2a\u0e23\u0e49\u0e32\u0e07\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e2b\u0e23\u0e37\u0e2d\u0e02\u0e49\u0e2d\u0e2a\u0e23\u0e38\u0e1b\u0e17\u0e35\u0e48\u0e44\u0e21\u0e48\u0e21\u0e35\u0e43\u0e19\u0e15\u0e49\u0e19\u0e09\u0e1a\u0e31\u0e1a\n- \u0e16\u0e49\u0e32\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e44\u0e21\u0e48\u0e2a\u0e21\u0e1a\u0e39\u0e23\u0e13\u0e4c \u0e43\u0e2b\u0e49\u0e40\u0e1e\u0e34\u0e48\u0e21 \"data_incomplete\": true\n\n\u0e15\u0e31\u0e27\u0e2d\u0e22\u0e48\u0e32\u0e07 output:\n{\"_id\": \"analysis_001\", \"data\": {...}}"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.9,
      "position": [
        280,
        220
      ],
      "id": "6e32de78-edc2-4441-86bb-d76100ade7a3",
      "name": "Data Engineer Agent"
    },
    {
      "parameters": {
        "jsCode": "const staticData = $getWorkflowStaticData('global');\n\n// \u0e15\u0e23\u0e27\u0e08\u0e2a\u0e2d\u0e1a\u0e27\u0e48\u0e32\u0e40\u0e1b\u0e47\u0e19\u0e23\u0e2d\u0e1a\u0e41\u0e23\u0e01\u0e2b\u0e23\u0e37\u0e2d\u0e44\u0e21\u0e48\nif (!staticData.current_session_data) {\n    // \u0e23\u0e2d\u0e1a\u0e41\u0e23\u0e01: \u0e40\u0e01\u0e47\u0e1a\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e17\u0e31\u0e49\u0e07\u0e2b\u0e21\u0e14\u0e08\u0e32\u0e01 input\n    staticData.current_session_data = {\n        original_question: $json[\"chatInput\"],\n        sessionId: $json[\"userId\"] || \"default-session\",\n        startTime: new Date().toISOString()\n    };\n}\n\n// \u0e2a\u0e48\u0e07\u0e2d\u0e2d\u0e01\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e17\u0e35\u0e48\u0e04\u0e07\u0e2d\u0e22\u0e39\u0e48\u0e17\u0e38\u0e01\u0e23\u0e2d\u0e1a\nreturn [{\n    sessionId: staticData.current_session_data.sessionId,\n    original_question: staticData.current_session_data.original_question\n}];\n"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        -780,
        220
      ],
      "id": "34343c88-e6eb-4c50-a008-f06006a5c601",
      "name": "Question memorizer"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "value": "openai/gpt-oss-120b",
          "mode": "list",
          "cachedResultName": "openai/gpt-oss-120b"
        },
        "options": {
          "maxTokens": 8000
        }
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        -520,
        440
      ],
      "id": "c59b5f3f-9447-45ca-91d6-bab7d614feb4",
      "name": "OpenAI Chat Model by OpenRouter",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "value": "qwen/qwen-max",
          "mode": "list",
          "cachedResultName": "qwen/qwen-max"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        100,
        300
      ],
      "id": "67e1f743-fcb8-4031-9e3b-b67420bb5a53",
      "name": "OpenAI Chat Model by OpenRouter-1",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "descriptionType": "manual",
        "toolDescription": "\u0e41\u0e2a\u0e14\u0e07\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e2a\u0e23\u0e38\u0e1b\u0e40\u0e01\u0e35\u0e48\u0e22\u0e27\u0e01\u0e31\u0e1a\u0e10\u0e32\u0e19\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25",
        "connectionType": "sse",
        "operation": "executeTool",
        "toolName": "get_database_info_tool"
      },
      "type": "n8n-nodes-mcp.mcpClientTool",
      "typeVersion": 1,
      "position": [
        -460,
        640
      ],
      "id": "c59622cb-c875-4639-a38c-d28ef32a2dff",
      "name": "get_database_info_tool",
      "credentials": {
        "mcpClientSseApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "descriptionType": "manual",
        "toolDescription": "Execute a read-only SQL query and return the results",
        "connectionType": "sse",
        "operation": "executeTool",
        "toolName": "execute_query_tool",
        "toolParameters": "={{ (function() {\n const paramsString = $fromAI('Tool_Parameters');\n \n // Default query \u0e40\u0e1e\u0e37\u0e48\u0e2d\u0e14\u0e39\u0e23\u0e32\u0e22\u0e0a\u0e37\u0e48\u0e2d\u0e15\u0e32\u0e23\u0e32\u0e07\n const defaultParams = {\n   query: \"SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE' ORDER BY TABLE_NAME\"\n };\n \n if (!paramsString) {\n   return defaultParams;\n }\n \n try {\n   // \u0e25\u0e2d\u0e07\u0e41\u0e1b\u0e25\u0e07 JSON \u0e01\u0e48\u0e2d\u0e19\n   const params = JSON.parse(paramsString);\n   return {\n     query: params.query || params.sql || params.statement || defaultParams.query\n   };\n } catch (e) {\n   // \u0e16\u0e49\u0e32\u0e41\u0e1b\u0e25\u0e07 JSON \u0e44\u0e21\u0e48\u0e44\u0e14\u0e49 \u0e16\u0e37\u0e2d\u0e27\u0e48\u0e32\u0e40\u0e1b\u0e47\u0e19 SQL string \u0e42\u0e14\u0e22\u0e15\u0e23\u0e07\n   if (typeof paramsString === 'string' && paramsString.trim().length > 0) {\n     return {\n       query: paramsString.trim()\n     };\n   }\n   return defaultParams;\n }\n})() }}"
      },
      "type": "n8n-nodes-mcp.mcpClientTool",
      "typeVersion": 1,
      "position": [
        -300,
        640
      ],
      "id": "5f8aa0ca-6f24-4925-968b-6490ad249271",
      "name": "execute_query_tool",
      "credentials": {
        "mcpClientSseApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "descriptionType": "manual",
        "toolDescription": "Preview sample data from a specific table with configurable row limit",
        "connectionType": "sse",
        "operation": "executeTool",
        "toolName": "preview_table",
        "toolParameters": "={{ (function() {\n  const paramsString = $fromAI('Tool_Parameters');\n  \n  // Default \u0e2a\u0e33\u0e2b\u0e23\u0e31\u0e1a preview_table\n  const defaultParams = {\n    table_name: \"allrawloanstat\",\n    limit: 10\n  };\n  \n  if (!paramsString) {\n    return defaultParams;\n  }\n  \n  try {\n    // \u0e25\u0e2d\u0e07\u0e41\u0e1b\u0e25\u0e07 JSON \u0e01\u0e48\u0e2d\u0e19\n    const params = JSON.parse(paramsString);\n    return {\n      table_name: params.table_name || params.tableName || params.table || defaultParams.table_name,\n      limit: params.limit || params.row_count || params.rows || defaultParams.limit\n    };\n  } catch (e) {\n    // \u0e16\u0e49\u0e32\u0e41\u0e1b\u0e25\u0e07 JSON \u0e44\u0e21\u0e48\u0e44\u0e14\u0e49 \u0e25\u0e2d\u0e07 parse SQL query\n    if (typeof paramsString === 'string' && paramsString.trim().length > 0) {\n      const sql = paramsString.trim().toUpperCase();\n      \n      // \u0e2b\u0e32 table name \u0e08\u0e32\u0e01 FROM clause\n      const fromMatch = sql.match(/FROM\\s+(\\w+)/);\n      const tableName = fromMatch ? fromMatch[1].toLowerCase() : defaultParams.table_name;\n      \n      // \u0e2b\u0e32 limit \u0e08\u0e32\u0e01 TOP clause\n      const topMatch = sql.match(/TOP\\s+(\\d+)/);\n      const limit = topMatch ? parseInt(topMatch[1]) : defaultParams.limit;\n      \n      return {\n        table_name: tableName,\n        limit: limit\n      };\n    }\n    return defaultParams;\n  }\n})() }}"
      },
      "type": "n8n-nodes-mcp.mcpClientTool",
      "typeVersion": 1,
      "position": [
        -140,
        640
      ],
      "id": "1682d3ed-790e-4308-ae88-3c045d0f8e65",
      "name": "preview_table",
      "credentials": {
        "mcpClientSseApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{$json[\"original_question\"]}}",
        "options": {
          "systemMessage": "=# CUSTOMER SERVICE CASE EVALUATION AGENT\n\n## CORE IDENTITY\nYou are a professional Customer Service Case Evaluation Agent specialized in analyzing customer requests against company policies. Your primary goals are ACCURACY, CONSISTENCY, and STRICT POLICY COMPLIANCE. You make decisions based solely on documented policies without creating additional rules or assumptions.\n\n## FUNDAMENTAL PRINCIPLES\n1. **Policy First**: All decisions must be based exclusively on documented company policies\n2. **No Rule Creation**: Never invent, assume, or create policy rules that don't exist in documentation\n3. **Systematic Verification**: Always check basic eligibility before making decisions\n4. **Evidence-Based**: Use only verified data from tools - never assume or guess\n5. **Transparent Logic**: Clearly explain the reasoning behind every decision\n\n## MANDATORY CASE EVALUATION WORKFLOW\n\n### Phase 1: Policy Research (REQUIRED)\n- MUST search company documentation for relevant policies\n- Extract EXACT eligibility criteria, timeframes, and procedures\n- Identify product-specific rules and exceptions\n- Document all applicable policy sections with precise references\n- If no policies found, explicitly state this and stop evaluation\n\n### Phase 2: Data Verification (REQUIRED)\n- MUST retrieve actual case data using SQL/database tools\n- Verify all customer information, product details, purchase dates\n- Calculate exact timeframes (purchase date to complaint date)\n- Confirm product categories, damage descriptions, and customer requests\n- Never proceed without verified data\n\n### Phase 3: Eligibility Assessment (REQUIRED)\n**For Return Requests:**\n1. Identify product category and applicable return window\n2. Calculate exact days since purchase\n3. Compare against policy timeframes\n4. Check for policy exceptions or special circumstances\n\n**For Warranty Claims:**\n1. Verify if product category has warranty coverage in policy\n2. Check if timeframe falls within warranty period\n3. Assess if damage type is covered by warranty terms\n4. Identify any warranty exclusions that apply\n\n### Phase 4: Decision Logic (STRICT)\n- **APPROVE** only if ALL eligibility criteria are met\n- **DENY** if ANY required criteria fail\n- **Never create workarounds** for policy limitations\n- **Never assume** coverage that isn't explicitly documented\n\n### Phase 5: Alternative Solutions\nFor denied cases, provide appropriate alternatives:\n- Paid repair services if available\n- Manufacturer warranty guidance\n- Product replacement discounts\n- Care and maintenance advice\n\n## CRITICAL RESTRICTIONS\n\n### ABSOLUTE PROHIBITIONS\n- **NEVER** create approval requirements not in policy (e.g., \"management approval required\")\n- **NEVER** assume warranty coverage for product categories not explicitly covered\n- **NEVER** extend return windows beyond documented timeframes\n- **NEVER** ignore policy timeframes or eligibility criteria\n- **NEVER** make exceptions without explicit policy authorization\n\n### VERIFICATION REQUIREMENTS\n- **ALWAYS** use tools to retrieve actual case data\n- **ALWAYS** search documentation for relevant policies\n- **ALWAYS** calculate timeframes from verified dates\n- **ALWAYS** match product categories to policy rules exactly\n\n## MANDATORY OUTPUT FORMAT\n\n### Case Evaluation Report\n**CASE ID:** [case number]\n**POLICY SEARCH RESULTS:** [exact policies found with references]\n**VERIFIED CASE DATA:** [data from database tools]\n**ELIGIBILITY ANALYSIS:**\n- Product Category: [verified category]\n- Policy Timeframe: [applicable return/warranty period]\n- Actual Duration: [calculated days/months since purchase]\n- Eligibility Status: [MEETS/EXCEEDS policy requirements]\n\n**DECISION:** [APPROVE/DENY with clear reasoning]\n**POLICY BASIS:** [exact policy sections supporting decision]\n**ALTERNATIVE OPTIONS:** [if denied, what alternatives exist]\n**NEXT STEPS:** [specific actions to take]\n\n## ERROR PREVENTION PROTOCOLS\n\n### Common Mistakes to Avoid\n1. **Time Calculation Errors**: Always verify purchase dates and calculate exact timeframes\n2. **Product Categorization**: Don't assume categories - verify from actual data\n3. **Policy Misinterpretation**: Use exact policy language, not interpretations\n4. **Scope Creep**: Don't extend beyond what policies explicitly cover\n5. **Assumption-Based Decisions**: Every decision element must be verifiable\n\n### Quality Checks\n- Does the decision reference specific policy sections?\n- Are all timeframes calculated from verified data?\n- Is the product category confirmed from database?\n- Would this decision be consistent across similar cases?\n- Are any assumptions being made that aren't policy-based?\n\n## TOOL USAGE REQUIREMENTS\n- **SQL/Database Tools**: REQUIRED for all case data verification\n- **Documentation Search**: REQUIRED for all policy research\n- **No Analysis Without Tools**: Cannot provide case evaluations without using actual tools\n\n## DECISION CONSISTENCY PROTOCOL\n- Identical situations should yield identical decisions\n- Policy interpretation should remain constant across cases\n- No case-by-case exceptions unless explicitly allowed by policy\n- Document any unusual circumstances that might affect future similar cases\n\n---\n\n**Remember: Your role is to be the definitive, consistent voice of company policy. Customers and staff alike depend on your decisions being accurate, fair, and policy-compliant. When in doubt, err on the side of strict policy adherence rather than customer accommodation.**",
          "maxIterations": 50
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.9,
      "position": [
        -440,
        220
      ],
      "id": "9076c309-5382-45ee-91a9-a4abe21c952a",
      "name": "SQL Agent",
      "alwaysOutputData": false,
      "retryOnFail": true
    },
    {
      "parameters": {
        "descriptionType": "manual",
        "toolDescription": "List all documentation sources currently stored",
        "connectionType": "sse",
        "operation": "executeTool",
        "toolName": "list_sources"
      },
      "type": "n8n-nodes-mcp.mcpClientTool",
      "typeVersion": 1,
      "position": [
        20,
        640
      ],
      "id": "e3259d8c-42b5-4c97-82d6-b4aa2e368dc9",
      "name": "list_sources",
      "credentials": {
        "mcpClientSseApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "descriptionType": "manual",
        "toolDescription": "Add all supported files from a directory to the RAG database",
        "connectionType": "sse",
        "operation": "executeTool",
        "toolName": "add_directory",
        "toolParameters": "={{ (function() {\n  const paramsString = $fromAI('Tool_Parameters');\n  \n  // Default path\n  const defaultParams = {\n    path: \"/home/user/documents\"\n  };\n  \n  if (!paramsString) {\n    return defaultParams;\n  }\n  \n  try {\n    // \u0e25\u0e2d\u0e07\u0e41\u0e1b\u0e25\u0e07 JSON \u0e01\u0e48\u0e2d\u0e19\n    const params = JSON.parse(paramsString);\n    return {\n      path: params.path || defaultParams.path\n    };\n  } catch (e) {\n    // \u0e16\u0e49\u0e32\u0e41\u0e1b\u0e25\u0e07 JSON \u0e44\u0e21\u0e48\u0e44\u0e14\u0e49 \u0e16\u0e37\u0e2d\u0e27\u0e48\u0e32\u0e40\u0e1b\u0e47\u0e19 path string \u0e42\u0e14\u0e22\u0e15\u0e23\u0e07\n    if (typeof paramsString === 'string' && paramsString.trim().length > 0) {\n      return {\n        path: paramsString.trim()\n      };\n    }\n    return defaultParams;\n  }\n})() }}"
      },
      "type": "n8n-nodes-mcp.mcpClientTool",
      "typeVersion": 1,
      "position": [
        160,
        640
      ],
      "id": "14637c97-78fc-4c42-9ac3-c712246b1aa1",
      "name": "add_directory",
      "credentials": {
        "mcpClientSseApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "descriptionType": "manual",
        "toolDescription": "Search through stored documentation",
        "connectionType": "sse",
        "operation": "executeTool",
        "toolName": "search_documentation",
        "toolParameters": "={{ (function() {\n  const paramsString = $fromAI('Tool_Parameters');\n  \n  // Default parameters\n  const defaultParams = {\n    query: \"search term\",\n    limit: 10\n  };\n  \n  if (!paramsString) {\n    return defaultParams;\n  }\n  \n  try {\n    // \u0e25\u0e2d\u0e07\u0e41\u0e1b\u0e25\u0e07 JSON \u0e01\u0e48\u0e2d\u0e19\n    const params = JSON.parse(paramsString);\n    return {\n      query: params.query || params.search || params.keyword || defaultParams.query,\n      limit: params.limit || params.max || params.count || defaultParams.limit\n    };\n  } catch (e) {\n    // \u0e16\u0e49\u0e32\u0e41\u0e1b\u0e25\u0e07 JSON \u0e44\u0e21\u0e48\u0e44\u0e14\u0e49 \u0e16\u0e37\u0e2d\u0e27\u0e48\u0e32\u0e40\u0e1b\u0e47\u0e19 search string \u0e42\u0e14\u0e22\u0e15\u0e23\u0e07\n    if (typeof paramsString === 'string' && paramsString.trim().length > 0) {\n      return {\n        query: paramsString.trim(),\n        limit: defaultParams.limit\n      };\n    }\n    return defaultParams;\n  }\n})() }}"
      },
      "type": "n8n-nodes-mcp.mcpClientTool",
      "typeVersion": 1,
      "position": [
        300,
        640
      ],
      "id": "e212d8ec-a754-4e29-b348-7729ed352e3d",
      "name": "search_documentation",
      "credentials": {
        "mcpClientSseApi": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "When chat message received": {
      "main": [
        [
          {
            "node": "Question memorizer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "SQL Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "If": {
      "main": [
        [
          {
            "node": "Question memorizer",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Data Engineer Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Question memorizer": {
      "main": [
        [
          {
            "node": "SQL Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model by OpenRouter": {
      "ai_languageModel": [
        [
          {
            "node": "SQL Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model by OpenRouter-1": {
      "ai_languageModel": [
        [
          {
            "node": "Data Engineer Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "get_database_info_tool": {
      "ai_tool": [
        [
          {
            "node": "SQL Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "execute_query_tool": {
      "ai_tool": [
        [
          {
            "node": "SQL Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "preview_table": {
      "ai_tool": [
        [
          {
            "node": "SQL Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "SQL Agent": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "list_sources": {
      "ai_tool": [
        [
          {
            "node": "SQL Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "add_directory": {
      "ai_tool": [
        [
          {
            "node": "SQL Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "search_documentation": {
      "ai_tool": [
        [
          {
            "node": "SQL Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "f8dbe343-798d-450e-b59f-a9bc6341b18d",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "UIF0JUY9iKxyxwwC",
  "tags": [
    {
      "createdAt": "2025-08-30T11:42:07.880Z",
      "updatedAt": "2025-08-30T11:42:07.880Z",
      "id": "4JFGzrMLWzj571P5",
      "name": "in-progress"
    },
    {
      "createdAt": "2025-09-08T14:58:38.244Z",
      "updatedAt": "2025-09-08T14:58:38.244Z",
      "id": "Ylhdx9tvLmH9eemn",
      "name": "tested@8Sep2025"
    }
  ]
}