AutomationFlowsAI & RAG › AI Chat Agent with Memory via Webhook

AI Chat Agent with Memory via Webhook

Original n8n title: AI Agent with Memory (webhook Chat)

AI agent with memory (webhook chat). Uses agent, lmChatOpenAi, memoryBufferWindow. Webhook trigger; 5 nodes.

Webhook trigger★★☆☆☆ complexityAI-powered5 nodesAgentOpenAI ChatMemory Buffer Window
AI & RAG Trigger: Webhook Nodes: 5 Complexity: ★★☆☆☆ AI nodes: yes Added:

This workflow follows the Agent → OpenAI Chat 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": "AI agent with memory (webhook chat)",
  "nodes": [
    {
      "id": "a1b2c3d4-0001-4ec6-9000-aaaaaaaaaaaa",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        240,
        300
      ],
      "parameters": {
        "httpMethod": "POST",
        "path": "chat",
        "responseMode": "responseNode",
        "options": {}
      }
    },
    {
      "id": "a1b2c3d4-0002-4ec6-9000-aaaaaaaaaaaa",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.7,
      "position": [
        460,
        300
      ],
      "parameters": {
        "options": {
          "systemMessage": "You are a helpful assistant. Answer the user's question concisely."
        }
      }
    },
    {
      "id": "a1b2c3d4-0003-4ec6-9000-aaaaaaaaaaaa",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        340,
        480
      ],
      "parameters": {
        "model": "gpt-4o-mini",
        "options": {}
      }
    },
    {
      "id": "a1b2c3d4-0004-4ec6-9000-aaaaaaaaaaaa",
      "name": "Window Buffer Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        580,
        480
      ],
      "parameters": {
        "contextWindowLength": 10
      }
    },
    {
      "id": "a1b2c3d4-0005-4ec6-9000-aaaaaaaaaaaa",
      "name": "Respond to Webhook",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [
        700,
        300
      ],
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ { \"reply\": $json.output } }}",
        "options": {}
      }
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI 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
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  }
}
Pro

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

About this workflow

AI agent with memory (webhook chat). Uses agent, lmChatOpenAi, memoryBufferWindow. Webhook trigger; 5 nodes.

Source: https://github.com/AutomateLab-tech/n8n-mcp/blob/main/examples/workflow-ai-agent-webhook.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

AI chatbot for appointment scheduling. Uses memoryBufferWindow, lmChatOpenAi, toolWorkflow, chatTrigger. Webhook trigger; 12 nodes.

Memory Buffer Window, OpenAI Chat, Tool Workflow +4
AI & RAG

InstaTest. Uses memoryBufferWindow, lmChatOpenAi, respondToWebhook, stickyNote. Webhook trigger; 11 nodes.

Memory Buffer Window, OpenAI Chat, Agent
AI & RAG

Once connected, GPT will automatically initiate conversations with messages from new recipients in Intagram.

Memory Buffer Window, OpenAI Chat, Agent
AI & RAG

A natural conversational AI chatbot that collects lead information (Name, Phone, Email, Message) one question at a time without feeling like a form. Uses session-based memory to track conversations, i

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

Read - Automação de Reunião. Uses agent, lmChatOpenAi, memoryBufferWindow, googleDocsTool. Webhook trigger; 9 nodes.

Agent, OpenAI Chat, Memory Buffer Window +2