AutomationFlowsAI & RAG › Local Ollama AI Agent Chatbot

Local Ollama AI Agent Chatbot

Local Ollama AI Agent Chatbot. Uses chatTrigger, agent, lmChatOllama, memoryBufferWindow. Chat trigger; 8 nodes.

Chat trigger trigger★★★★☆ complexityAI-powered8 nodesChat TriggerAgentOllama ChatMemory Buffer WindowTool Code
AI & RAG Trigger: Chat trigger Nodes: 8 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
{
  "name": "Local Ollama AI Agent Chatbot",
  "nodes": [
    {
      "parameters": {
        "options": {}
      },
      "id": "chat-1",
      "name": "When chat message received",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "typeVersion": 1.4,
      "position": [
        -600,
        0
      ]
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $json.chatInput }}",
        "options": {
          "systemMessage": "You are a multilingual customer support AI agent. Reply in the same language as the user. Use tools when needed. Keep replies short, polite, and business-friendly."
        }
      },
      "id": "agent-1",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 2,
      "position": [
        -260,
        0
      ]
    },
    {
      "parameters": {
        "model": "llama3.2:latest",
        "options": {
          "temperature": 0.2
        }
      },
      "id": "model-1",
      "name": "Ollama Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOllama",
      "typeVersion": 1,
      "position": [
        -460,
        260
      ]
    },
    {
      "parameters": {
        "contextWindowLength": 10
      },
      "id": "memory-1",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        -260,
        260
      ]
    },
    {
      "parameters": {
        "description": "Lookup product pricing or quotation guidance.",
        "jsCode": "return JSON.stringify({ found: false, message: 'Replace with your own price lookup logic.' });"
      },
      "id": "tool-1",
      "name": "price_lookup",
      "type": "@n8n/n8n-nodes-langchain.toolCode",
      "typeVersion": 1.2,
      "position": [
        -40,
        260
      ]
    },
    {
      "parameters": {
        "description": "Lookup order status details.",
        "jsCode": "return JSON.stringify({ found: false, message: 'Replace with your own order status lookup logic.' });"
      },
      "id": "tool-2",
      "name": "order_status_lookup",
      "type": "@n8n/n8n-nodes-langchain.toolCode",
      "typeVersion": 1.2,
      "position": [
        180,
        260
      ]
    },
    {
      "parameters": {
        "description": "Use when the user requests human or sales support.",
        "jsCode": "return JSON.stringify({ handoff: true, message: 'Replace with your own sales handoff process.' });"
      },
      "id": "tool-3",
      "name": "sales_handoff",
      "type": "@n8n/n8n-nodes-langchain.toolCode",
      "typeVersion": 1.2,
      "position": [
        400,
        260
      ]
    },
    {
      "parameters": {
        "jsCode": "const item = $input.first().json;\nlet reply = item.output || item.text || item.response || item.message?.content || '';\nreply = String(reply || '').replace(/<think>[\\s\\S]*?<\\/think>/gi, '').trim();\nreturn [{ json: { output: reply || 'Sorry, I could not generate a reply. Please try again.' } }];"
      },
      "id": "code-1",
      "name": "Format Chat Output",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        80,
        0
      ]
    }
  ],
  "connections": {
    "When chat message received": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Format Chat Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Ollama Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "price_lookup": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "order_status_lookup": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "sales_handoff": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "meta": {
    "templateCredsSetupCompleted": false
  }
}
Pro

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

About this workflow

Local Ollama AI Agent Chatbot. Uses chatTrigger, agent, lmChatOllama, memoryBufferWindow. Chat trigger; 8 nodes.

Source: https://github.com/mobizmad/n8n-workflow-templates/blob/main/chatbots/local-ollama-ai-agent-chatbot/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

Community Node Disclaimer: This workflow uses KlickTipp community nodes.

Chat Trigger, OpenAI Chat, Memory Buffer Window +6
AI & RAG

Airtable AI Agent. Uses lmChatOpenAi, agent, toolWorkflow, toolCode. Chat trigger; 42 nodes.

OpenAI Chat, Agent, Tool Workflow +6
AI & RAG

Ai Agent To Chat With Airtable And Analyze Data. Uses lmChatOpenAi, agent, stickyNote, memoryBufferWindow. Chat trigger; 41 nodes.

OpenAI Chat, Agent, Memory Buffer Window +6
AI & RAG

I prepared a detailed guide that shows the entire process of building an AI agent that integrates with Airtable data in n8n. This template covers everything from data preparation to advanced configura

OpenAI Chat, Agent, Memory Buffer Window +6
AI & RAG

Think Tool. Uses stickyNote, agent, googleCalendarTool, memoryBufferWindow. Chat trigger; 28 nodes.

Agent, Google Calendar Tool, Memory Buffer Window +8