AutomationFlowsAI & RAG › AI Chat Agent with Ollama and MSSQL

AI Chat Agent with Ollama and MSSQL

Original n8n title: Ollama Mssql Workflow

Ollama-Mssql-Workflow. Uses chatTrigger, lmChatOllama, memoryBufferWindow, agent. Chat trigger; 7 nodes.

Chat trigger trigger★★☆☆☆ complexityAI-powered7 nodesChat TriggerOllama ChatMemory Buffer WindowAgentMicrosoft Sql ToolTool Calculator
AI & RAG Trigger: Chat trigger Nodes: 7 Complexity: ★★☆☆☆ AI nodes: yes Added:

This workflow follows the Agent → Chat Trigger recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "nodes": [
    {
      "parameters": {
        "public": true,
        "initialMessages": "Ahoj! Jsem AI asistent b\u011b\u017e\u00edc\u00ed na Ollama. Jak ti mohu pomoci?",
        "options": {
          "allowFileUploads": false,
          "allowedFilesMimeTypes": "",
          "showWelcomeScreen": true,
          "subtitle": "Lok\u00e1ln\u00ed AI asistent",
          "title": "Ollama Chat"
        }
      },
      "id": "b85590c9-ccee-4386-a159-818099c74a90",
      "name": "Chat Trigger",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "typeVersion": 1.1,
      "position": [
        -560,
        -160
      ]
    },
    {
      "parameters": {
        "model": "gpt-oss:latest",
        "options": {}
      },
      "id": "189168e5-5d2f-4185-ac97-a358b1a6e054",
      "name": "Ollama Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOllama",
      "typeVersion": 1,
      "position": [
        -256,
        80
      ],
      "credentials": {
        "ollamaApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "={{ $json.sessionId }}"
      },
      "id": "c9335cb7-2c1e-4295-b9cd-879e749cf932",
      "name": "Window Buffer Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.2,
      "position": [
        -64,
        80
      ]
    },
    {
      "parameters": {
        "options": {}
      },
      "id": "d3d64575-6abd-4574-88d8-b3bbff1310b6",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.7,
      "position": [
        -160,
        -160
      ]
    },
    {
      "parameters": {
        "descriptionType": "manual",
        "toolDescription": "Get list of available tables in DB.",
        "operation": "executeQuery",
        "query": "SELECT * FROM sys.Tables"
      },
      "type": "n8n-nodes-base.microsoftSqlTool",
      "typeVersion": 1.1,
      "position": [
        256,
        48
      ],
      "id": "46a18df4-c26a-40cd-a2fd-45c2c6d6e99b",
      "name": "Microsoft SQL",
      "credentials": {
        "microsoftSql": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "descriptionType": "manual",
        "toolDescription": "Get data from table. SELECT * FROM {{ $fromAI('table_name') }}",
        "operation": "executeQuery",
        "query": "SELECT * FROM {{ $fromAI('table_name') }}"
      },
      "type": "n8n-nodes-base.microsoftSqlTool",
      "typeVersion": 1.1,
      "position": [
        112,
        64
      ],
      "id": "8057b0e3-00fc-4a10-aba5-1265faf3a4f5",
      "name": "Microsoft SQL1",
      "credentials": {
        "microsoftSql": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {},
      "type": "@n8n/n8n-nodes-langchain.toolCalculator",
      "typeVersion": 1,
      "position": [
        368,
        -64
      ],
      "id": "682faa1c-ece7-42ba-a1af-e1d11a970170",
      "name": "Calculator"
    }
  ],
  "connections": {
    "Chat Trigger": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Ollama Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Window Buffer Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Microsoft SQL": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Microsoft SQL1": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Calculator": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  },
  "meta": {
    "templateCredsSetupCompleted": true
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Ollama-Mssql-Workflow. Uses chatTrigger, lmChatOllama, memoryBufferWindow, agent. Chat trigger; 7 nodes.

Source: https://github.com/LadislavSmid/Training-AI-agents/blob/e0430b5c969b9c005ec48b5c7d25185d5740c54c/N8N/ollama-mssql-workflow.json — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

NGSS Agent v2.2 github. Uses memoryBufferWindow, toolWorkflow, chatTrigger, agent. Chat trigger; 13 nodes.

Memory Buffer Window, Tool Workflow, Chat Trigger +2
AI & RAG

A smart personal assistant that can reason, search, calculate, and remember — powered by Google Gemini and ready in one click.

Chat Trigger, Agent, Tool Think +4
AI & RAG

A reasoning agent that can think, search, calculate, and remember — powered by GROQ inference and ready to deploy in one click.

Chat Trigger, Agent, Tool Think +4
AI & RAG

This template is for users who want to combine the power of AI with Google Sheets for managing and calculating data quickly. It’s ideal for small businesses, data entry teams, and anyone who tracks li

Chat Trigger, Agent, Memory Buffer Window +3
AI & RAG

This workflow dynamically chooses between two new powerful Anthropic models — Claude Opus 4 and Claude Sonnet 4 — to handle user queries, based on their complexity and nature, maintaining scalability

Chat Trigger, Output Parser Structured, Agent +5