{
  "name": "Conversation Agent",
  "nodes": [
    {
      "parameters": {},
      "id": "7ba80751-b279-4e79-a3ca-2e0e88fbe3dd",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        1488,
        672
      ],
      "typeVersion": 1.3
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "cd898792-a224-459f-9027-97bc007c31df",
              "operator": {
                "type": "string",
                "operation": "contains"
              },
              "leftValue": "={{ $json.output }}",
              "rightValue": "\"icpData\":"
            }
          ]
        },
        "options": {}
      },
      "id": "d0834a73-cc97-440a-8ff6-706277936009",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        1728,
        416
      ],
      "typeVersion": 2.2
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=repeat this sentence:  {{ $('ICP Agent').item.json.output }}",
        "messages": {
          "messageValues": [
            {
              "message": "You are repeater"
            }
          ]
        }
      },
      "id": "ee99ff7a-d975-4873-82d8-ebd75f610ac6",
      "name": "Basic LLM Chain",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        1984,
        720
      ],
      "typeVersion": 1.5
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o",
          "cachedResultName": "gpt-4o"
        },
        "options": {}
      },
      "id": "b262c6ef-1176-4dde-a133-1b134009a24b",
      "name": "OpenAI Chat Model2",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1264,
        832
      ],
      "typeVersion": 1.2
    },
    {
      "parameters": {
        "content": "## Conversation agent",
        "height": 820,
        "width": 1840
      },
      "id": "2c0facb0-0f17-4211-81b6-7e1f48a1f4eb",
      "name": "Sticky Note24",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1008,
        240
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "options": {}
      },
      "id": "e75ea893-027a-414f-b2c6-7e3b40e9d970",
      "name": "Discourse your ICP with Agent",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        1168,
        416
      ],
      "typeVersion": 1.1
    },
    {
      "parameters": {
        "options": {
          "systemMessage": "Your task is to interactively collect an Ideal Customer Profile (ICP) from the user. \n\nIMPORTANT: DO NOT SHOW ANY JSON TO THE USER DURING THE DATA COLLECTION PROCESS. Only communicate in natural language until all data has been collected.\n\nWhen the conversation starts, immediately:\n1. Introduce yourself and explain that you'll be collecting information to build an Ideal Customer Profile\n2. Briefly explain what information you'll be asking for\n3. Ask the FIRST question about current_titles without waiting for further input\n\nData Collection Process:\n1. Initialize an empty object called `icpData` in your memory (do not share this with the user).\n2. Ask the user each of the following questions ONE AT A TIME in natural conversational language, and after each answer, store the response in your internal `icpData` object:\n   - **current_titles**: \"What current titles do your target customers hold? (List comma-separated.)\"\n   - **current_companies**: \"What current companies do they work at? (List comma-separated.)\"\n   - **location**: \"Which geographic regions should we search in? (List cities, regions, or countries.)\"\n   - **industry**: \"Which industries are of interest? (Use LinkedIn's official industry names or describe them as closely as possible.)\"\n   - **company_sizes**: \"Which company sizes do you prefer? (e.g. Self-employed, 1\u201310, 11\u201350, 51\u2013200, etc.)\"\n   - **keywords**: \"Are there any additional keywords to refine the search? (e.g. technologies, specialties, skills.)\"\n\nCommunication Guidelines:\n- Begin immediately with your introduction and the first question about current_titles\n- Speak naturally during the conversation, DO NOT show any JSON during the data collection phase\n- Ask only one question at a time\n- After receiving an answer, acknowledge it and ask the next question\n- If a user provides unclear information, ask for clarification\n- If the user explicitly states they want to skip any questions or finish early, respect their request\n- If the user types \"finish\", \"done\", \"complete\", or similar commands at any point, immediately prepare to generate the JSON\n\nFinal Output Requirements:\n- ALWAYS output the complete icpData object in valid JSON format when EITHER:\n  1. All seven fields have been collected, OR\n  2. The user explicitly requests to finish early or skip remaining questions\n- Include all fields in the output, using null for any fields that weren't collected\n- The \"dataComplete\" field must always be set to true in the final JSON output\n- Do not add any additional fields or modify the JSON structure\n- The final JSON MUST follow this exact format and have only JSON:\n{\n  \"icpData\": {\n    \"current_titles\": \"[collected value or null]\",\n    \"current_companies\": \"[collected value or null]\",\n    \"location\": \"[collected value or null]\",\n    \"industry\": \"[collected value or null]\",\n    \"company_sizes\": \"[collected value or null]\",\n    \"keywords\": \"[collected value or null]\",\n    \"count\": \"[collected value or null]\"\n  },\n  \"dataComplete\": true\n}\n\nCRITICAL: Your final response must consist of ONLY the single line \"Thank you for providing the information. Here is your ICP data:\" followed IMMEDIATELY by the JSON object. Do not add ANY other text, explanations, or formatting. The JSON object must be the absolute final thing in your response with nothing after it."
        }
      },
      "id": "cdb50001-1550-4b00-bd00-4b3066f9ff7f",
      "name": "ICP Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1392,
        416
      ],
      "typeVersion": 1.8
    }
  ],
  "connections": {
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "ICP Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "If": {
      "main": [
        [],
        [
          {
            "node": "Basic LLM Chain",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model2": {
      "ai_languageModel": [
        [
          {
            "node": "ICP Agent",
            "type": "ai_languageModel",
            "index": 0
          },
          {
            "node": "Basic LLM Chain",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Discourse your ICP with Agent": {
      "main": [
        [
          {
            "node": "ICP Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ICP Agent": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1",
    "availableInMCP": false
  },
  "versionId": "693121db-6833-45ec-ac43-826adfeb2948",
  "id": "5SC8rhpOYmgLiXPG",
  "tags": []
}