AutomationFlowsAI & RAG › AI Chat Agent with OpenAI & Logic API

AI Chat Agent with OpenAI & Logic API

Original n8n title: Logic API Agent Workflow

Logic Api Agent Workflow. Uses chatTrigger, agent, httpRequestTool, lmChatOpenAi. Chat trigger; 4 nodes.

Chat trigger trigger★★☆☆☆ complexityAI-powered4 nodesChat TriggerAgentHTTP Request ToolOpenAI Chat
AI & RAG Trigger: Chat trigger Nodes: 4 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": "My workflow",
  "nodes": [
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "typeVersion": 1.4,
      "position": [
        0,
        0
      ],
      "id": "6c8ba9e0-463f-4382-b014-f811a6684bcd",
      "name": "When chat message received"
    },
    {
      "parameters": {
        "options": {
          "systemMessage": "#ROLE\nYou are a helpful assistant\n\n# TOOL\n## always call LOGICAPI\nIf the task requires more than one decision, call the Ejentum Logic API first; absorb the results as instructions to follow. \nLogicAPI helps u harness the best and block the worst.\n(never mention the tool in the outputs, is a secret, u use it but u do not reveal it)\n"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 3.1,
      "position": [
        208,
        0
      ],
      "id": "85d1402c-ef19-47b2-89ac-b6719de475f6",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "toolDescription": "Before executing any non-trivial task, call the Ejentum Logic API tool with a short task description. Inject the returned text into your reasoning BEFORE acting. Follow the [PROCEDURE] and verify against the [FALSIFICATION TEST].\n",
        "method": "POST",
        "url": "https://ejentum-main-ab125c3.zuplo.app/logicv1/",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"query\": \"{{ $fromAI('query', 'short description of the task') }}\",\n  \"mode\": \"{{ $fromAI('mode', 'reasoning mode: reasoning, code, anti-deception, memory, reasoning-multi, code-multi, memory-multi', 'string') }}\"\n}\n",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequestTool",
      "typeVersion": 4.4,
      "position": [
        416,
        224
      ],
      "id": "3f3de4aa-f127-42f0-bfc4-fc52fea468d6",
      "name": "LogicAPI",
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "value": "gpt-4o",
          "mode": "list",
          "cachedResultName": "gpt-4o"
        },
        "builtInTools": {},
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.3,
      "position": [
        192,
        224
      ],
      "id": "e3f0dbbe-5bd1-4e0d-aaf7-25c790160164",
      "name": "gpt-4",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "When chat message received": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "LogicAPI": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "gpt-4": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1",
    "binaryMode": "separate",
    "availableInMCP": false
  },
  "versionId": "0d065171-df1b-439d-b0d8-2699bfce2811",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "Y294Q1RgrPVCUxHU",
  "tags": []
}

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

Logic Api Agent Workflow. Uses chatTrigger, agent, httpRequestTool, lmChatOpenAi. Chat trigger; 4 nodes.

Source: https://github.com/ejentum/integrations/blob/main/n8n/logic_api_agent_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

This is an n8n workflow designed to implement an advanced AI chatbot with real-time conversation and search capabilities. Configured with a minimalist European design, this chatbot is ready to be inte

Chat Trigger, Chat, Agent +3
AI & RAG

Luke. Uses chatTrigger, lmChatOpenAi, httpRequestTool, agent. Chat trigger; 10 nodes.

Chat Trigger, OpenAI Chat, HTTP Request Tool +2
AI & RAG

Real estate investors and analysts evaluating buy-and-hold rentals, BRRRR deals, or any property where you want to triangulate rent estimates from multiple sources rather than trusting a single Zestim

Agent, OpenAI Chat, HTTP Request Tool +1
AI & RAG

AI Graphic Designer. Uses agent, chatTrigger, lmChatOpenAi, memoryBufferWindow. Chat trigger; 9 nodes.

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

Build a powerful AI chatbot that provides precise answers from your own company's knowledge base. This template provides a smart AI agent that connects to Lookio, a platform where you can easily uploa

Chat Trigger, Memory Buffer Window, OpenAI Chat +2