{
  "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
}