Deep-Research-Agent

Experte

Dies ist ein Market Research, Multimodal AI-Bereich Automatisierungsworkflow mit 43 Nodes. Hauptsächlich werden Set, Code, Filter, Notion, Switch und andere Nodes verwendet. Tiefenrecherche-Agent - Automatisierte Recherchen und Notion-Berichtsgenerator

Voraussetzungen
  • Notion API Key
  • HTTP Webhook-Endpunkt (wird von n8n automatisch generiert)
  • Möglicherweise sind Ziel-API-Anmeldedaten erforderlich
  • OpenAI API Key
  • Google Gemini API Key
Workflow-Vorschau
Visualisierung der Node-Verbindungen, mit Zoom und Pan
Workflow exportieren
Kopieren Sie die folgende JSON-Konfiguration und importieren Sie sie in n8n
{
  "id": "nKxX4LgQ12KWv18t",
  "meta": {
    "instanceId": "ade7e20aad77e0a552d206f839739da695af286a3148c41c951c915d6af91ebc"
  },
  "name": "Deep Research Agent",
  "tags": [],
  "nodes": [
    {
      "id": "6043ae3c-caaf-464e-8883-329b8ebbe188",
      "name": "Simple Speicher",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        -496,
        464
      ],
      "parameters": {
        "sessionKey": "={{ $json?.message?.chat?.id ||  $json?.body?.session_id }}",
        "sessionIdType": "customKey",
        "contextWindowLength": 10
      },
      "typeVersion": 1.3
    },
    {
      "id": "fe701b28-b35c-475c-ac3f-8d640e5fe7c5",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        -352,
        464
      ],
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "{\n   \"is_pass_next\" : \"boolean\",\n   \"message\" : \"string\"\n}"
      },
      "typeVersion": 1.2
    },
    {
      "id": "c8c06a2e-6386-44b2-acbf-a8006f07302f",
      "name": "Schalter",
      "type": "n8n-nodes-base.switch",
      "position": [
        -240,
        240
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "Feedback",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "9e5f68a3-6af4-48ce-9bf6-6c6e06236301",
                    "operator": {
                      "type": "boolean",
                      "operation": "false",
                      "singleValue": true
                    },
                    "leftValue": "={{ $json.output.is_pass_next }}",
                    "rightValue": ""
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Pass",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "ac64b26c-d9e6-48a1-9fff-8b85156725b2",
                    "operator": {
                      "type": "boolean",
                      "operation": "true",
                      "singleValue": true
                    },
                    "leftValue": "={{ $json.output.is_pass_next }}",
                    "rightValue": ""
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "d7c2c361-1be6-42ce-8738-cdd82c8f0edc",
      "name": "Strategy Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -576,
        240
      ],
      "parameters": {
        "text": "=You are the research and planning agent. Your role is to help users plan high-quality research content — quickly, clearly, and efficiently.\n\nUser input: {{ $json?.message?.text ||  $json?.body?.message}}\n\n🌟 Your Mission:\nAfter greeting message ask what user want to research about. Just ask What would you like to research?\n\nGiven the following research topic from the user, ask some follow up questions to clarify the research direction. Return a maximum of 3 questions, but feel free to return less if the original query is clear. Ask all questions one by one.\n\nAfter clarity questions send draft for user to confirm. \n\n🧠 OUTPUT FORMAT (Always use this JSON output structure):\n\nIf needs feedback or clarity from user: \n\n{\n  \"is_pass_next\": false,\n  \"message\": \"message\"\n}\n\nIf strategy is ready for confirmation:\n{\n  \"is_pass_next\": false,\n  \"message\": \"Here’s your research plan draft:\"\n}\n\n🚀 If user confirms:\n{\n  \"is_pass_next\": true,\n  \"message\": \"The research plan is as follow:\",\n}\n\nToday's date : {{ $now }}",
        "options": {},
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.8
    },
    {
      "id": "31a933c3-f158-4d67-afdd-e5cdcdae400c",
      "name": "Search Query Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        864,
        336
      ],
      "parameters": {
        "text": "=Given the following prompt from the user, generate a list of SERP queries to research the topic.\nReduce the number of words in each query to its keywords only.\nReturn a maximum of 3 queries, but feel free to return less if the original prompt is clear. Make sure each query is unique and not similar to each other: <prompt>{{ $('Switch').item.json.output.message }}</prompt>",
        "options": {},
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.8
    },
    {
      "id": "f45ffc9d-d0a7-4911-9941-2c91b7afb040",
      "name": "Structured Output Parser1",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1056,
        528
      ],
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "{\n  \"type\": \"object\",\n  \"properties\": {\n    \"queries\": {\n      \"type\": \"array\",\n      \"items\": {\n        \"type\": \"object\",\n        \"properties\": {\n          \"query\": {\n            \"type\": \"string\",\n            \"description\": \"The SERP query\"\n          },\n          \"researchGoal\": {\n            \"type\": \"string\",\n            \"description\": \"First talk about the goal of the research that this query is meant to accomplish, then go deeper into how to advance the research once the results are found, mention additional research directions. Be as specific as possible, especially for additional research directions.\"\n          }\n        }\n      }\n    }\n  }\n}"
      },
      "typeVersion": 1.2
    },
    {
      "id": "54f2196a-8a6f-4ccf-9065-f55124e13bd8",
      "name": "Split Out",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        1232,
        448
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "output.queries"
      },
      "typeVersion": 1
    },
    {
      "id": "b393662d-b263-4f50-84d9-5ffe151de982",
      "name": "Loop Over Queries",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        1408,
        448
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "52aafb1c-f41f-4c4d-a219-a8454359f2e9",
      "name": "HTTP-Anfrage",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1632,
        544
      ],
      "parameters": {
        "url": "https://api.tavily.com/search",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "authentication": "genericCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "query",
              "value": "={{ $json.query }}"
            }
          ]
        },
        "genericAuthType": "httpCustomAuth"
      },
      "typeVersion": 4.2
    },
    {
      "id": "b8c9f466-cac6-4208-bfa1-5bba645bb345",
      "name": "Edit Fields",
      "type": "n8n-nodes-base.set",
      "position": [
        1856,
        544
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "00d1543a-0036-43a3-8034-14bc29317218",
              "name": "tavily_results",
              "type": "string",
              "value": "={{ $json.results }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "1ab76c27-4a42-44f1-93fc-d543bac471d0",
      "name": "OpenAI",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        2048,
        544
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini",
          "cachedResultName": "GPT-4.1-MINI"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "=You are an intelligent assistant. A user has asked the following query:\n\n[Search Query]: {{ $('HTTP Request').item.json.query }}\n\nBelow is the draft for research that user has passed: {{ $('Switch').item.json.output.message }}\n\nBelow are the search results retrieved from the internet (from Tavily):\n\n{{ $json.tavily_results }}\n\nEach result includes a title, URL, and content. From these, choose the **single most relevant URL** that best matches the user's query. Focus on accuracy, relevance, and depth of the content. Only return the URL — do not include any explanation or extra text.\n\nreturn it like below JSON format: \n{\n final_url: \"url\"\n}\n"
            }
          ]
        },
        "jsonOutput": true
      },
      "typeVersion": 1.8
    },
    {
      "id": "0c0878e5-380a-4a42-a813-fca117493835",
      "name": "HTTP-Anfrage1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2416,
        544
      ],
      "parameters": {
        "url": "https://api.tavily.com/extract",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "authentication": "genericCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "urls",
              "value": "={{ $json.message.content.final_url }}"
            },
            {
              "name": "extract_depth",
              "value": "advanced"
            }
          ]
        },
        "genericAuthType": "httpCustomAuth"
      },
      "typeVersion": 4.2
    },
    {
      "id": "ca0172ea-53a1-4de0-b494-395a30bf9bbe",
      "name": "Aggregieren",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        1616,
        144
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData"
      },
      "typeVersion": 1
    },
    {
      "id": "9b08f0c7-1516-429e-ab33-69dfa9ee967f",
      "name": "OpenAI1",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        336,
        368
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "GPT-4O-MINI"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "=You will be given research draft that user asked to you need to create title and description using this draft. \n\ndraft:  {{ $('Switch').item.json.output.message }}\n\noutput using below json format: \n{\n \"title\": string,\n \"description\": string\n}"
            }
          ]
        },
        "jsonOutput": true
      },
      "typeVersion": 1.8
    },
    {
      "id": "cd496279-c0b7-43e3-83b0-8f9f09bd3662",
      "name": "Notion",
      "type": "n8n-nodes-base.notion",
      "position": [
        656,
        384
      ],
      "parameters": {
        "title": "={{ $json.message.content.title }}",
        "options": {},
        "resource": "databasePage",
        "databaseId": {
          "__rl": true,
          "mode": "list",
          "value": "1f536e90-e9d0-805c-a1c1-f2fab42a8a7b",
          "cachedResultUrl": "https://www.notion.so/1f536e90e9d0805ca1c1f2fab42a8a7b",
          "cachedResultName": "n8n DeepResearch"
        },
        "propertiesUi": {
          "propertyValues": [
            {
              "key": "Request ID|rich_text",
              "textContent": "={{ $('Code').item.json.randomId.toString() }}"
            },
            {
              "key": "Name|title",
              "title": "={{ $json.message.content.title }}"
            },
            {
              "key": "Description|rich_text",
              "textContent": "={{ $json.message.content.description }}"
            },
            {
              "key": "Created time|date",
              "date": "={{ $now.toISO() }}"
            },
            {
              "key": "Status|status",
              "statusValue": "In progress"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "1106292a-d120-42ef-83fa-f4bb21ad5d78",
      "name": "Notion1",
      "type": "n8n-nodes-base.notion",
      "position": [
        4128,
        192
      ],
      "parameters": {
        "pageId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Convert to HTML').item.json.id }}"
        },
        "options": {},
        "resource": "databasePage",
        "operation": "update",
        "propertiesUi": {
          "propertyValues": [
            {
              "key": "Status|status",
              "statusValue": "Done"
            },
            {
              "key": "Last Updated|date",
              "date": "={{ $now.toISO() }}"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "db6c3631-ca97-440f-96d2-8dee9db7524f",
      "name": "HTTP-Anfrage2",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        3952,
        352
      ],
      "parameters": {
        "url": "=https://api.notion.com/v1/blocks/{{ $('Convert to HTML').item.json.id }}/children",
        "method": "PATCH",
        "options": {
          "timeout": "={{ 1000 * 60 }}"
        },
        "jsonBody": "={{\n{\n  \"children\": $json.block\n}\n}}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "predefinedCredentialType",
        "headerParameters": {
          "parameters": [
            {
              "name": "Notion-Version",
              "value": "2022-06-28"
            }
          ]
        },
        "nodeCredentialType": "notionApi"
      },
      "typeVersion": 4.2
    },
    {
      "id": "1993f8af-a0c3-456c-bbce-60c2b681befa",
      "name": "Convert to HTML",
      "type": "n8n-nodes-base.markdown",
      "position": [
        2352,
        160
      ],
      "parameters": {
        "mode": "markdownToHtml",
        "options": {
          "tables": true
        },
        "markdown": "={{ $('Report Agent').item.json.output }}"
      },
      "typeVersion": 1
    },
    {
      "id": "1c80381d-c67c-4d57-999d-85e7fdc8e5b1",
      "name": "HTML to Array",
      "type": "n8n-nodes-base.set",
      "position": [
        2576,
        192
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "851b8a3f-c2d3-41ad-bf60-4e0e667f6c58",
              "name": "tag",
              "type": "array",
              "value": "={{ $json.data.match(/<table[\\s\\S]*?<\\/table>|<ul[\\s\\S]*?<\\/ul>|<[^>]+>[^<]*<\\/[^>]+>/g) }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "a440531f-b5bf-4523-b43b-2d5211861be4",
      "name": "Tags to Items",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        2784,
        192
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "tag"
      },
      "typeVersion": 1
    },
    {
      "id": "b615171d-56f1-4184-b9f0-23008728b89c",
      "name": "Notion Block Generator",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        2960,
        176
      ],
      "parameters": {
        "text": "={{ $json.tag.trim() }}",
        "messages": {
          "messageValues": [
            {
              "message": "=Convert the following html into its equivalent Notion Block as per Notion's API schema.\n* Ensure the content is always included and remains the same.\n* Return only a json response.\n* Generate child-level blocks. Should not define \"parent\" or \"children\" property.\n* Strongly prefer headings, paragraphs, tables and lists type blocks.\n* available headings are heading_1, heading_2 and heading_3 - h4,h5,h6 should use heading_3 type instead. ensure headings use the rich text definition.\n* ensure lists blocks include all list items.\n\n## Examples\n\n1. headings\n```\n<h3 id=\"references\">References</h3>\n```\nwould convert to \n```\n{\"object\":  \"block\", \"type\": \"heading_3\", \"heading_3\": { \"rich_text\": [{\"type\": \"text\",\"text\": {\"content\": \"References\"}}]}}\n```\n\n2. lists\n```\n<ul><li>hello</li><li>world</li></ul>\n```\nwould convert to\n```\n[\n{\n  \"object\": \"block\",\n  \"type\": \"bulleted_list_item\",\n  \"bulleted_list_item\": {\"rich_text\": [{\"type\": \"text\",\"text\": {\"content\": \"hello\"}}]}\n},\n{\n  \"object\": \"block\",\n  \"type\": \"bulleted_list_item\",\n  \"bulleted_list_item\": {\"rich_text\": [{\"type\": \"text\",\"text\": {\"content\": \"world\"}}]}\n}\n]\n```\n\n3. tables\n```\n<table>\n  <thead>\n    <tr><th>Technology</th><th>Potential Impact</th></tr>\n  </thead>\n  <tbody>\n    <tr>\n      <td>5G Connectivity</td><td>Enables faster data speeds and advanced apps</td>\n    </tr>\n  </tbody>\n</table>\n```\nwould convert to\n```\n{\n  \"object\": \"block\",\n  \"type\": \"table\",\n  \"table\": {\n    \"table_width\": 2,\n    \"has_column_header\": true,\n    \"has_row_header\": false,\n    \"children\": [\n      {\n        \"object\": \"block\",\n        \"type\": \"table_row\",\n        \"table_row\": {\n          \"cells\": [\n            [\n              {\n                \"type\": \"text\",\n                \"text\": {\n                  \"content\": \"Technology\",\n                  \"link\": null\n                }\n              },\n              {\n                \"type\": \"text\",\n                \"text\": {\n                  \"content\": \"Potential Impact\",\n                  \"link\": null\n                }\n              }\n            ],\n            [\n              {\n                \"type\": \"text\",\n                \"text\": {\n                  \"content\": \"5G Connectivity\",\n                  \"link\": null\n                }\n              },\n              {\n                \"type\": \"text\",\n                \"text\": {\n                  \"content\": \"Enables faster data speeds and advanced apps\",\n                  \"link\": null\n                }\n              }\n            ]\n          ]\n        }\n      }\n    ]\n  }\n}\n```\n4. anchor links\nSince Notion doesn't support anchor links, just convert them to rich text blocks instead.\n```\n<a href=\"#module-0-pre-course-setup-and-learning-principles\">Module 0: Pre-Course Setup and Learning Principles</a>\n```\nconverts to\n```\n{\n  \"object\": \"block\",\n  \"type\": \"paragraph\",\n  \"paragraph\": {\n    \"rich_text\": [\n      {\n        \"type\": \"text\",\n        \"text\": {\n          \"content\": \"Module 0: Pre-Course Setup and Learning Principles\"\n        }\n      }\n    ]\n  }\n}\n```\n5. Invalid html parts\nWhen the html is not syntax valid eg. orphaned closing tags, then just skip the conversion and use an empty rich text block.\n```\n</li>\\n</ol>\n```\ncan be substituted with\n```\n{\n  \"object\": \"block\",\n  \"type\": \"paragraph\",\n  \"paragraph\": {\n    \"rich_text\": [\n      {\n        \"type\": \"text\",\n        \"text\": {\n          \"content\": \" \"\n        }\n      }\n    ]\n  }\n}\n```"
            }
          ]
        },
        "promptType": "define"
      },
      "typeVersion": 1.5
    },
    {
      "id": "8bc449e8-93ed-493c-a716-ba263bfa4f51",
      "name": "Google Gemini-Chat-Modell",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        2992,
        320
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemini-2.0-flash"
      },
      "typeVersion": 1
    },
    {
      "id": "b10f665f-c433-4e73-9c4c-dfb0d72c1d70",
      "name": "Parse JSON blocks",
      "type": "n8n-nodes-base.set",
      "onError": "continueRegularOutput",
      "position": [
        3312,
        224
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "73fcb8a0-2672-4bd5-86de-8075e1e02baf",
              "name": "=block",
              "type": "array",
              "value": "={{\n(function(){\n  const block = $json.response.text\n    .replace('```json', '')\n    .replace('```', '')\n    .trim()\n    .parseJson();\n  if (Array.isArray(block)) return block;\n  if (block.type.startsWith('heading_')) {\n    const prev = Number(block.type.split('_')[1]);\n    const next = Math.max(1, prev - 1);\n    if (next !== prev) {\n      block.type = `heading_${next}`;\n      block[`heading_${next}`] = Object.assign({}, block[`heading_${prev}`]);\n      block[`heading_${prev}`] = undefined;\n    }\n  }\n  return [block];\n})()\n}}"
            }
          ]
        }
      },
      "executeOnce": false,
      "typeVersion": 3.4
    },
    {
      "id": "111fb999-e768-4a54-b654-b4c764ec01c6",
      "name": "Valid Blocks",
      "type": "n8n-nodes-base.filter",
      "position": [
        3488,
        240
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "f68cefe0-e109-4d41-9aa3-043f3bc6c449",
              "operator": {
                "type": "string",
                "operation": "notExists",
                "singleValue": true
              },
              "leftValue": "={{ $json.error }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "2a22fe91-8594-47be-963d-5163537d72c4",
      "name": "For Each Block...",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        3744,
        240
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "24e0ec98-3ac2-432a-a743-c4c5f6e38bfc",
      "name": "Get Existing Row",
      "type": "n8n-nodes-base.notion",
      "position": [
        2160,
        144
      ],
      "parameters": {
        "limit": 1,
        "filters": {
          "conditions": [
            {
              "key": "Request ID|rich_text",
              "condition": "equals",
              "richTextValue": "={{ $('Code').item.json.randomId.toString() }}"
            }
          ]
        },
        "options": {},
        "resource": "databasePage",
        "matchType": "allFilters",
        "operation": "getAll",
        "databaseId": {
          "__rl": true,
          "mode": "list",
          "value": "1f536e90-e9d0-805c-a1c1-f2fab42a8a7b",
          "cachedResultUrl": "https://www.notion.so/1f536e90e9d0805ca1c1f2fab42a8a7b",
          "cachedResultName": "n8n DeepResearch"
        },
        "filterType": "manual"
      },
      "typeVersion": 2.2
    },
    {
      "id": "08e46831-969d-4f29-8c85-16cc3551e0c5",
      "name": "Code",
      "type": "n8n-nodes-base.code",
      "position": [
        160,
        368
      ],
      "parameters": {
        "jsCode": "const randomId = Math.floor(100000 + Math.random() * 900000);\nreturn { randomId };\n"
      },
      "typeVersion": 2
    },
    {
      "id": "826965b5-2c22-43d9-9802-419c8cb4d55d",
      "name": "Aggregieren1",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        3920,
        176
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData"
      },
      "typeVersion": 1
    },
    {
      "id": "0be97ae1-09cf-444e-9bf0-2fd9edeeb72b",
      "name": "OpenRouter Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        -624,
        464
      ],
      "parameters": {
        "model": "anthropic/claude-3.5-sonnet",
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "396d20c8-adbc-4357-bfde-f15d63ee250d",
      "name": "OpenRouter Chat Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        848,
        528
      ],
      "parameters": {
        "model": "anthropic/claude-3.5-sonnet",
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "1209861a-0b12-488d-9888-7d2e00ca177f",
      "name": "OpenRouter Chat Model2",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        1808,
        304
      ],
      "parameters": {
        "model": "anthropic/claude-3.5-sonnet",
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "d12593f1-028a-4033-8519-2ce283e07793",
      "name": "Webhook-Trigger",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -880,
        304
      ],
      "webhookId": "1c86c408-aeed-40c5-b4ba-aad5f4cdf0ad",
      "parameters": {
        "path": "1c86c408-aeed-40c5-b4ba-aad5f4cdf0ad",
        "options": {},
        "httpMethod": "POST",
        "responseMode": "responseNode"
      },
      "typeVersion": 2
    },
    {
      "id": "a33171cd-487f-4d82-97b6-c17933ea498f",
      "name": "Respond to Webhook-Trigger",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        -64,
        144
      ],
      "parameters": {
        "options": {},
        "respondWith": "text",
        "responseBody": "={{ $json.output.message }}"
      },
      "typeVersion": 1.1
    },
    {
      "id": "aa54d1b3-1f8c-4942-9a7b-7f26e1aa376b",
      "name": "Respond to Webhook-Trigger1",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        -48,
        368
      ],
      "parameters": {
        "options": {},
        "respondWith": "text",
        "responseBody": "Thank you for your response. We are preparing your report. Once it is finished we will send report link to you."
      },
      "typeVersion": 1.1
    },
    {
      "id": "1bf4266f-e2e6-4491-9138-5237a89ae520",
      "name": "HTTP-Anfrage3",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        4320,
        224
      ],
      "parameters": {
        "method": "POST",
        "options": {},
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "report_title",
              "value": "={{ $json.name || '' }}"
            },
            {
              "name": "report_url",
              "value": "={{ $json.url || \"\" }}"
            },
            {
              "name": "status",
              "value": "={{ $json.property_status || \"\" }}"
            },
            {
              "name": "session_id",
              "value": "={{ $('Webhook').item.json.body.session_id || \"\" }}"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "215cb1cf-0798-4a72-8ae7-fb065a90ed05",
      "name": "Haftnotiz",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1872,
        -48
      ],
      "parameters": {
        "width": 832,
        "height": 1264,
        "content": "## Deep Research Agent – Automated Research & Notion Report Builder\n\n### Overview  \n\n- This workflow acts as an AI-powered research assistant that takes a topic from the user, performs multi-step intelligent research, and stores the final report in Notion. It uses advanced search, content extraction, and AI summarization to deliver a high-quality research report—fully automated from query to publication.\n\n---\n\n### How It Works  \n- **User Interaction**  \n  - The workflow starts by asking the user what topic they want to research.  \n  - A “Strategy Agent” asks 2–3 clarifying questions to refine the scope.  \n  - Once the user confirms, it creates a **Notion database page** with the research title.\n\n- **Search Query Generation**  \n  - Generates up to **3 relevant search queries** for the given topic.\n\n- **Data Gathering** (Loop over each query)  \n  - Sends the query to **Tavily Search API** to find the most relevant blogs/articles.  \n  - Picks the top-matched link and uses Tavily again to extract its content.  \n  - Repeats the process for all 3 queries.\n\n- **Report Compilation**  \n  - Aggregates extracted content from all sources.  \n  - A **Final Report Agent** creates a well-structured research report in **Markdown**.  \n  - Converts Markdown → HTML → splits into chunks.  \n  - Pushes each chunk into the Notion report page.  \n\n- **Delivery**  \n  - Sends the **final Notion report link** back to the user.\n\n---\n\n### How to Use  \n- This workflow is triggered via **Webhook**.  \n- **Attach the provided webhook URL** to any application, form, or chatbot to collect the user’s topic.  \n- Once triggered, the workflow will run automatically and deliver the research link without any manual steps.\n\n---\n\n### Requirements  \nTo use this workflow, you’ll need:  \n- **n8n account** (self-hosted or cloud)  \n- **Notion account** with a database where reports will be stored  \n- **Tavily API Key** – for search & content extraction  \n- **OpenRouter API key** *or* **OpenAI API key** – for AI agents & report generation  \n- **Google Gemini API Key** – for converting Markdown to HTML and splitting content for Notion  \n- Notion database ID connected in n8n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "805c58a6-9fcf-413f-9fd9-7bcb54943fce",
      "name": "Haftnotiz1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -672,
        -16
      ],
      "parameters": {
        "color": 7,
        "width": 800,
        "height": 640,
        "content": "**Strategy Agent & Clarification Stage**  \nHandles the initial topic understanding:  \n- Uses OpenRouter Chat Model + Memory to interpret the user’s request.  \n- Determines if clarifying questions are needed before drafting.  \n- If clarification needed → goes to Feedback path.  \n- If draft confirmed → continues to next stage.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "1d00461a-936f-442d-8cc6-dfebfb2956ff",
      "name": "Haftnotiz2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        288,
        128
      ],
      "parameters": {
        "color": 7,
        "width": 896,
        "height": 592,
        "content": "**Notion Page Creation & Search Query Generation**  \n- Uses OpenAI to generate a **title and description** for the Notion research report.  \n- Creates a new Notion database page with the generated title.  \n- **Search Query Agent** (via OpenRouter Chat Model) generates **3 relevant search queries** for the topic.  \n- Passes these queries forward for the research phase.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "d8d8a162-90fc-4c2b-bf47-99d334e980e7",
      "name": "Haftnotiz3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1584,
        496
      ],
      "parameters": {
        "color": 7,
        "width": 1008,
        "height": 496,
        "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n**Search & Content Extraction**  \n- Sends the search query to **Tavily Search API** to find the most relevant result.  \n- Processes and selects the top-matched link.  \n- Uses **Tavily Extract API** to retrieve the full content from the selected source.  \n- Passes the extracted content forward for aggregation.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "d6808baf-5e90-4c70-95aa-bfde2e5fcdbf",
      "name": "Report Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1808,
        128
      ],
      "parameters": {
        "text": "=You are a research and writing assistant.\n\nYour task is to generate a comprehensive and well-structured blog-style report based on the following research topic and raw extracted content. Use professional, clear language suitable for a wide audience. Organize the report using headings and subheadings. Avoid repetition. At the end of the report, include a \"Sources\" section with a list of the URLs used. \n\nThis is the final draft on which you need to create report from given topic and draft: \n{{ $('Switch').item.json.output.message }}. Try to create final report from this outline and draft.\n\n---\n**Extracted Content**:\n\n1. Source: {{ $json.data[0].results[0].url }}\nContent:{{ $json.data[0].results[0].raw_content }}\n\n\n2. Source: {{ $json.data[1].results[0].url }}\nContent: {{ $json.data[1].results[0].raw_content }}\n\n3. Source: {{ $json.data[2].results[0].url }}\nContent:{{ $json.data[2].results[0].raw_content }}\n\n---\n\n**Instructions**:\n- Make as detailed report as possible. Include all the useful information.\n- Analyze and synthesize the information from all sources.\n- Structure the report into meaningful sections with headings and subheadings (e.g., Introduction, Key Insights, Challenges, Opportunities, Conclusion, etc.).\n- Do not copy the content verbatim — rewrite and consolidate it into an original, cohesive narrative.\n- Maintain factual accuracy.\n- Make it as as detailed as possible, aim for 3 or more pages, include ALL the learnings from research.\n- Format the report in markdown. Use headings, lists and tables only and where appropriate.\n- At the end of **each paragraph**, insert a superscript source reference in markdown format like this: `[1]`, `[2]`, `[3]`, based on which source(s) the paragraph is derived from.\n- Do not mention the source URL in the paragraph body.\n- Do not include content that cannot be mapped to one of the sources.\n- At the end include sources link with correct url.\n",
        "options": {},
        "promptType": "define"
      },
      "typeVersion": 1.8
    },
    {
      "id": "ca0d4afd-4ee3-4f43-b41a-444661451a8d",
      "name": "Haftnotiz4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1584,
        -48
      ],
      "parameters": {
        "color": 7,
        "width": 944,
        "height": 496,
        "content": "**Report Compilation & Formatting**  \n- Aggregates all extracted content from previous steps.  \n- **Report Agent** (via OpenRouter Chat Model) generates a complete, well-structured research report in Markdown format.  \n- Retrieves the existing Notion report page.  \n- Converts the Markdown report into HTML for structured insertion into Notion.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "381e1216-db41-4d0c-b47a-cc10c70a5fdf",
      "name": "Haftnotiz5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2560,
        -48
      ],
      "parameters": {
        "color": 7,
        "width": 1088,
        "height": 496,
        "content": "**HTML to Notion Block Conversion**  \n- Splits the HTML content into an array for easier processing.  \n- Converts each array item into individual tags/items.  \n- **Notion Block Generator** (via Google Gemini Chat Model) transforms content into Notion-compatible block format.  \n- Parses the generated JSON blocks.  \n- Filters and keeps only valid Notion blocks for final insertion.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "bed2bbfc-c2a2-49f4-983b-a36c37178aae",
      "name": "Haftnotiz6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3680,
        -48
      ],
      "parameters": {
        "color": 7,
        "width": 864,
        "height": 688,
        "content": "**Final Storage & Response**  \n- Loops through all valid Notion blocks and processes them individually.  \n- Aggregates the processed blocks.  \n- Updates the Notion database/page with the aggregated content.  \n- Sends a final HTTP request containing the generated Notion page link back to the user.  \n"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "732c71a1-d47f-45c1-8e49-8045ff54fb72",
  "connections": {
    "08e46831-969d-4f29-8c85-16cc3551e0c5": {
      "main": [
        [
          {
            "node": "9b08f0c7-1516-429e-ab33-69dfa9ee967f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "cd496279-c0b7-43e3-83b0-8f9f09bd3662": {
      "main": [
        [
          {
            "node": "31a933c3-f158-4d67-afdd-e5cdcdae400c",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "1ab76c27-4a42-44f1-93fc-d543bac471d0": {
      "main": [
        [
          {
            "node": "HTTP Request1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Respond to Webhook1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "1106292a-d120-42ef-83fa-f4bb21ad5d78": {
      "main": [
        [
          {
            "node": "HTTP Request3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "9b08f0c7-1516-429e-ab33-69dfa9ee967f": {
      "main": [
        [
          {
            "node": "cd496279-c0b7-43e3-83b0-8f9f09bd3662",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook": {
      "main": [
        [
          {
            "node": "d7c2c361-1be6-42ce-8738-cdd82c8f0edc",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate": {
      "main": [
        [
          {
            "node": "d6808baf-5e90-4c70-95aa-bfde2e5fcdbf",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "54f2196a-8a6f-4ccf-9065-f55124e13bd8": {
      "main": [
        [
          {
            "node": "b393662d-b263-4f50-84d9-5ffe151de982",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate1": {
      "main": [
        [
          {
            "node": "1106292a-d120-42ef-83fa-f4bb21ad5d78",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "b8c9f466-cac6-4208-bfa1-5bba645bb345": {
      "main": [
        [
          {
            "node": "1ab76c27-4a42-44f1-93fc-d543bac471d0",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "b8c9f466-cac6-4208-bfa1-5bba645bb345",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "d6808baf-5e90-4c70-95aa-bfde2e5fcdbf": {
      "main": [
        [
          {
            "node": "24e0ec98-3ac2-432a-a743-c4c5f6e38bfc",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "111fb999-e768-4a54-b654-b4c764ec01c6": {
      "main": [
        [
          {
            "node": "2a22fe91-8594-47be-963d-5163537d72c4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "1c80381d-c67c-4d57-999d-85e7fdc8e5b1": {
      "main": [
        [
          {
            "node": "a440531f-b5bf-4523-b43b-2d5211861be4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request1": {
      "main": [
        [
          {
            "node": "b393662d-b263-4f50-84d9-5ffe151de982",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request2": {
      "main": [
        [
          {
            "node": "2a22fe91-8594-47be-963d-5163537d72c4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "d7c2c361-1be6-42ce-8738-cdd82c8f0edc",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "a440531f-b5bf-4523-b43b-2d5211861be4": {
      "main": [
        [
          {
            "node": "b615171d-56f1-4184-b9f0-23008728b89c",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "d7c2c361-1be6-42ce-8738-cdd82c8f0edc": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "1993f8af-a0c3-456c-bbce-60c2b681befa": {
      "main": [
        [
          {
            "node": "1c80381d-c67c-4d57-999d-85e7fdc8e5b1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "24e0ec98-3ac2-432a-a743-c4c5f6e38bfc": {
      "main": [
        [
          {
            "node": "1993f8af-a0c3-456c-bbce-60c2b681befa",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "2a22fe91-8594-47be-963d-5163537d72c4": {
      "main": [
        [
          {
            "node": "Aggregate1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "HTTP Request2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "b393662d-b263-4f50-84d9-5ffe151de982": {
      "main": [
        [
          {
            "node": "Aggregate",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "b10f665f-c433-4e73-9c4c-dfb0d72c1d70": {
      "main": [
        [
          {
            "node": "111fb999-e768-4a54-b654-b4c764ec01c6",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "31a933c3-f158-4d67-afdd-e5cdcdae400c": {
      "main": [
        [
          {
            "node": "54f2196a-8a6f-4ccf-9065-f55124e13bd8",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Respond to Webhook1": {
      "main": [
        [
          {
            "node": "08e46831-969d-4f29-8c85-16cc3551e0c5",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "0be97ae1-09cf-444e-9bf0-2fd9edeeb72b": {
      "ai_languageModel": [
        [
          {
            "node": "d7c2c361-1be6-42ce-8738-cdd82c8f0edc",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "b615171d-56f1-4184-b9f0-23008728b89c": {
      "main": [
        [
          {
            "node": "b10f665f-c433-4e73-9c4c-dfb0d72c1d70",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "396d20c8-adbc-4357-bfde-f15d63ee250d": {
      "ai_languageModel": [
        [
          {
            "node": "31a933c3-f158-4d67-afdd-e5cdcdae400c",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "1209861a-0b12-488d-9888-7d2e00ca177f": {
      "ai_languageModel": [
        [
          {
            "node": "d6808baf-5e90-4c70-95aa-bfde2e5fcdbf",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "b615171d-56f1-4184-b9f0-23008728b89c",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "fe701b28-b35c-475c-ac3f-8d640e5fe7c5": {
      "ai_outputParser": [
        [
          {
            "node": "d7c2c361-1be6-42ce-8738-cdd82c8f0edc",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "f45ffc9d-d0a7-4911-9941-2c91b7afb040": {
      "ai_outputParser": [
        [
          {
            "node": "31a933c3-f158-4d67-afdd-e5cdcdae400c",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    }
  }
}
Häufig gestellte Fragen

Wie verwende ich diesen Workflow?

Kopieren Sie den obigen JSON-Code, erstellen Sie einen neuen Workflow in Ihrer n8n-Instanz und wählen Sie "Aus JSON importieren". Fügen Sie die Konfiguration ein und passen Sie die Anmeldedaten nach Bedarf an.

Für welche Szenarien ist dieser Workflow geeignet?

Experte - Marktforschung, Multimodales KI

Ist es kostenpflichtig?

Dieser Workflow ist völlig kostenlos. Beachten Sie jedoch, dass Drittanbieterdienste (wie OpenAI API), die im Workflow verwendet werden, möglicherweise kostenpflichtig sind.

Workflow-Informationen
Schwierigkeitsgrad
Experte
Anzahl der Nodes43
Kategorie2
Node-Typen20
Schwierigkeitsbeschreibung

Für fortgeschrittene Benutzer, komplexe Workflows mit 16+ Nodes

Externe Links
Auf n8n.io ansehen

Diesen Workflow teilen

Kategorien

Kategorien: 34