AutomationFlowsAI & RAG › Agent Chat UI

Agent Chat UI

agent_chat_ui. Uses chatTrigger, httpRequest. Chat trigger; 4 nodes.

Chat trigger trigger★★★★☆ complexityAI-powered4 nodesChat TriggerHTTP Request
AI & RAG Trigger: Chat trigger Nodes: 4 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow follows the Chat Trigger → HTTP Request 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
{
  "id": "7b5e9c1d-4eaa-4a83-bef9-09e1c5d6a901",
  "name": "agent_chat_ui",
  "active": true,
  "settings": {
    "executionOrder": "v1"
  },
  "nodes": [
    {
      "id": "ChatTriggerAgent",
      "name": "Chat Trigger",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "typeVersion": 1.1,
      "position": [
        220,
        320
      ],
      "parameters": {
        "options": {}
      }
    },
    {
      "id": "NormalizeChatInput",
      "name": "Normalize Chat Input",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        460,
        320
      ],
      "parameters": {
        "jsCode": "const incoming = String($json.chatInput ?? $json.message ?? $json.text ?? '').trim();\nif (!incoming) throw new Error('chatInput is required');\nconst sessionId = String($json.sessionId ?? $json.session_id ?? `chat-${Date.now()}`).trim();\nconst userId = String($json.userId ?? $json.user_id ?? 'n8n-chat-user').trim();\nconst traceId = `chat-${sessionId}-${Date.now()}`;\nreturn [{\n  json: {\n    session_id: sessionId,\n    user_id: userId,\n    question: incoming,\n    trace_id: traceId\n  }\n}];"
      }
    },
    {
      "id": "CallAgentQueryMain",
      "name": "HTTP: agent_query_main",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        700,
        320
      ],
      "continueOnFail": true,
      "parameters": {
        "method": "POST",
        "url": "={{ (($env.INTERNAL_WEBHOOK_BASE_URL || 'http://127.0.0.1:5678').replace(/\\/?$/, '')) + '/webhook/' + ($env.N8N_AGENT_QUERY_WEBHOOK_PATH || 'agent-query') }}",
        "responseFormat": "string",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ { session_id: $json.session_id, user_id: $json.user_id, question: $json.question, trace_id: $json.trace_id } }}",
        "options": {
          "timeout": 120000
        }
      }
    },
    {
      "id": "BuildChatResponse",
      "name": "Build Chat Response",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        940,
        320
      ],
      "parameters": {
        "jsCode": "if ($json.error) {\n  const message = String($json.error.message ?? $json.error ?? 'unknown upstream error');\n  return [{ json: { text: '\u041d\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0445.', output: '\u041d\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0445.', trace_id: '', error: message } }];\n}\nconst rawBody = $json.body ?? $json.data ?? $json.response ?? $json;\nlet payload = rawBody;\nif (typeof rawBody === 'string') {\n  try {\n    payload = JSON.parse(rawBody);\n  } catch {\n    payload = {};\n  }\n}\nconst answer = String(payload?.answer ?? '').trim() || '\u041d\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0445.';\nconst traceId = String(payload?.trace_id ?? '').trim();\nreturn [{\n  json: {\n    text: answer,\n    output: answer,\n    trace_id: traceId\n  }\n}];"
      }
    }
  ],
  "connections": {
    "Chat Trigger": {
      "main": [
        [
          {
            "node": "Normalize Chat Input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize Chat Input": {
      "main": [
        [
          {
            "node": "HTTP: agent_query_main",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP: agent_query_main": {
      "main": [
        [
          {
            "node": "Build Chat Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "meta": {
    "templateCredsSetupCompleted": false
  },
  "tags": [
    {
      "name": "agent"
    },
    {
      "name": "chat"
    }
  ]
}
Pro

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

About this workflow

agent_chat_ui. Uses chatTrigger, httpRequest. Chat trigger; 4 nodes.

Source: https://github.com/Andrey787878/ai-knowledge-assistant/blob/main/n8n/workflows/agent_chat_ui.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

💰 Beginner Investor – Learn the market faster with AI-powered insights guiding your decisions. 📈 Retail Trader – Optimize your trading strategy with in-depth analysis typically reserved for profession

HTTP Request, Output Parser Structured, OpenAI Chat +4
AI & RAG

This comprehensive workflow automates the complete financial document processing pipeline using AI. Upload invoices via chat, drop expense receipts into a folder, or add bank statements - the system a

Chat Trigger, HTTP Request, Google Sheets +8
AI & RAG

This template attempts to create an AI-powered content assistant for WordPress sites using Mistral AI, enabling article recommendations, content summarization, and contextual Q&A capabilities.

Chat Trigger, Output Parser Structured, Agent +10
AI & RAG

by Varritech Technologies

Chat Trigger, Agent, OpenAI Chat +8
AI & RAG

Who’s it for Creators who want to create faceless videos automatically, while keeping human oversight and quality control.

Read Write File, Agent, OpenAI Chat +7