AutomationFlowsAI & RAG › Main Agent

Main Agent

main_agent. Uses slackTrigger, agent, memoryRedisChat, slack. Event-driven trigger; 7 nodes.

Event trigger★★☆☆☆ complexityAI-powered7 nodesSlack TriggerAgentMemory Redis ChatSlackTool Workflow
AI & RAG Trigger: Event Nodes: 7 Complexity: ★★☆☆☆ AI nodes: yes Added:

This workflow follows the Agent → Memoryredischat 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": "main_agent",
  "nodes": [
    {
      "id": "Slack Trigger",
      "name": "Slack Trigger",
      "type": "n8n-nodes-base.slackTrigger",
      "typeVersion": 1,
      "position": [
        -600,
        120
      ],
      "parameters": {
        "event": "message.channels"
      },
      "credentials": {
        "slackApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "id": "AI Agent",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1,
      "position": [
        -320,
        120
      ],
      "parameters": {
        "promptType": "define",
        "text": "={{ $json.event.text }}",
        "options": {
          "systemMessage": "You are a helpful Slack assistant. Use tools when required."
        }
      }
    },
    {
      "id": "Redis Memory",
      "name": "Redis Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryRedisChat",
      "typeVersion": 1,
      "position": [
        -320,
        300
      ],
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "={{ $('Slack Trigger').item.json.event.channel + '_' + $('Slack Trigger').item.json.event.user }}"
      },
      "credentials": {
        "redis": {
          "name": "<your credential>"
        }
      }
    },
    {
      "id": "Reply to Slack",
      "name": "Reply to Slack",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2,
      "position": [
        0,
        120
      ],
      "parameters": {
        "resource": "message",
        "operation": "post",
        "channel": "={{ $('Slack Trigger').item.json.event.channel }}",
        "text": "={{ $json.output || $json.text || 'Done' }}"
      },
      "credentials": {
        "slackApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "id": "Tool - search_web",
      "name": "Tool - search_web",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "typeVersion": 1,
      "position": [
        -320,
        -40
      ],
      "parameters": {
        "name": "search_web",
        "description": "Search the web for current information.",
        "workflowId": "tool_search_web"
      }
    },
    {
      "id": "Tool - lookup_crm",
      "name": "Tool - lookup_crm",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "typeVersion": 1,
      "position": [
        -180,
        -40
      ],
      "parameters": {
        "name": "lookup_crm",
        "description": "Lookup a contact in Airtable CRM.",
        "workflowId": "tool_lookup_crm"
      }
    },
    {
      "id": "Tool - draft_email",
      "name": "Tool - draft_email",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "typeVersion": 1,
      "position": [
        -40,
        -40
      ],
      "parameters": {
        "name": "draft_email",
        "description": "Draft an email then wait for human approval.",
        "workflowId": "tool_draft_email"
      }
    }
  ],
  "connections": {
    "Slack Trigger": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Reply to Slack",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Redis Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Tool - search_web": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Tool - lookup_crm": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Tool - draft_email": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "active": false
}

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

main_agent. Uses slackTrigger, agent, memoryRedisChat, slack. Event-driven trigger; 7 nodes.

Source: https://github.com/ogu83/n8n-ai-agent-lab/blob/main/ep2-persistent-agent/workflows/main_agent.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

Slack-Ai-Assistant. Uses agent, lmChatOpenAi, memoryBufferWindow, slackTrigger. Event-driven trigger; 13 nodes.

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

agent_with_rag. Uses slackTrigger, agent, toolWorkflow, slack. Event-driven trigger; 4 nodes.

Slack Trigger, Agent, Tool Workflow +1
AI & RAG

generalist_agent. Uses slackTrigger, agent, toolWorkflow, slack. Event-driven trigger; 4 nodes.

Slack Trigger, Agent, Tool Workflow +1
AI & RAG

Chat with a multi-agent system to write a blog. The orchestrator advances through research, headlines, hooks, outline, intro, draft, and final polish–one phase per reply—outputting options and asking

Agent, Tool Workflow, Memory Buffer Window +9
AI & RAG

This workflow is divided into three functional phases: Initialization, AI Processing, and Response Delivery.

Slack Trigger, Slack, HTTP Request +4