This workflow corresponds to n8n.io template #10349 — we link there as the canonical source.
This workflow follows the Agent → Chainllm 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 →
{
"nodes": [
{
"id": "846f1917-cd8b-47fb-85cb-633f6ff19888",
"name": "Webhook Entry",
"type": "n8n-nodes-base.webhook",
"position": [
-480,
-48
],
"parameters": {
"path": "advanced-brightdata-search",
"options": {},
"httpMethod": "POST",
"responseMode": "responseNode",
"authentication": "headerAuth"
},
"credentials": {
"httpHeaderAuth": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "421128ee-be55-44a3-b7fa-f876e2da962a",
"name": "Set Variables",
"type": "n8n-nodes-base.set",
"position": [
-256,
-48
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "user-prompt",
"name": "userPrompt",
"type": "string",
"value": "={{ $json.body.source }}"
},
{
"id": "cell-ref",
"name": "cellReference",
"type": "string",
"value": "={{ $json.body.prompt }}"
},
{
"id": "output-lang",
"name": "outputLanguage",
"type": "string",
"value": "={{ $json.body.language || 'English' }}"
},
{
"id": "cache-key",
"name": "cacheKey",
"type": "string",
"value": "={{ $crypto.createHash('md5').update($json.body.prompt + $json.body.source).digest('hex') }}"
},
{
"id": "request-id",
"name": "requestId",
"type": "string",
"value": "={{ $now.format('yyyyMMddHHmmss') }}-{{ $crypto.randomBytes(4).toString('hex') }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "45905849-b08a-471b-8b9c-b6f7e70d478e",
"name": "Cache Check",
"type": "n8n-nodes-base.redis",
"onError": "continueRegularOutput",
"position": [
-48,
-48
],
"parameters": {
"key": "={{ $json.cacheKey }}",
"options": {},
"operation": "get"
},
"typeVersion": 1
},
{
"id": "f3874e1f-190a-4fe4-9dd8-ed53307436e1",
"name": "Check Cache Hit",
"type": "n8n-nodes-base.if",
"position": [
176,
-48
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2
},
"combinator": "and",
"conditions": [
{
"id": "cache-exists",
"operator": {
"type": "string",
"operation": "exists"
},
"leftValue": "={{ $('Cache Check').item.json.value }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2.2
},
{
"id": "d24a360c-7785-402c-bdfa-8bf39d7f7321",
"name": "Rate Limit Check",
"type": "n8n-nodes-base.code",
"position": [
-320,
320
],
"parameters": {
"jsCode": "// Rate limiting: max 60 requests per minute\nconst Redis = require('ioredis');\nconst redis = new Redis($credentials.redis);\n\nconst key = `rate_limit:${new Date().toISOString().slice(0, 16)}`; // per minute\nconst count = await redis.incr(key);\nawait redis.expire(key, 60);\n\nif (count > 60) {\n throw new Error('Rate limit exceeded. Max 60 requests per minute.');\n}\n\nreturn [{ \n json: { \n ...items[0].json,\n rateLimit: { current: count, max: 60 }\n }\n}];"
},
"typeVersion": 2
},
{
"id": "4cf998be-1901-420e-9a76-60d2a796bf34",
"name": "Multi-Step Reasoning Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
-144,
320
],
"parameters": {
"text": "=Analyze this query and determine if it needs to be broken into sub-queries:\n\nQuery: {{ $json.userPrompt }}\nContext: {{ $json.cellReference }}\n\nIf the query is complex (e.g., \"compare X and Y\", \"analyze trends\", \"multiple data points\"), break it into 2-5 focused sub-queries.\nIf the query is simple (e.g., \"what is X\", \"who is the CEO\"), return it as-is.\n\nReturn JSON format:\n{\n \"isComplex\": boolean,\n \"subQueries\": [\"query1\", \"query2\", ...] or [original_query],\n \"reasoning\": \"explanation\"\n}",
"options": {
"systemMessage": "You are an expert at breaking down complex information requests into logical sub-queries. Each sub-query should be independently searchable and answerable."
},
"hasOutputParser": true
},
"typeVersion": 2.2
},
{
"id": "ce0a3979-bbcf-49a8-a438-e95b3eff820a",
"name": "Reasoning Output Parser",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
0,
528
],
"parameters": {
"jsonSchemaExample": "{\n \"isComplex\": false,\n \"subQueries\": [\"query\"],\n \"reasoning\": \"\"\n}"
},
"typeVersion": 1.3
},
{
"id": "e55d6a52-d91f-4ad3-aef8-652ebfc1e009",
"name": "GPT-4o (Reasoning)",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
-144,
528
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o"
},
"options": {
"temperature": 0.3
}
},
"typeVersion": 1.2
},
{
"id": "84d9ece9-9b1f-49f3-a2e7-6d5b62181a67",
"name": "Split Sub-Queries",
"type": "n8n-nodes-base.splitOut",
"position": [
144,
320
],
"parameters": {
"options": {}
},
"typeVersion": 1
},
{
"id": "163afc77-961a-4cca-adaa-0c638f9962f3",
"name": "Query Optimizer Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
320,
320
],
"parameters": {
"text": "=Optimize this search query for maximum relevance:\n\nQuery: {{ $json.subQuery }}\nOriginal context: {{ $('Set Variables').item.json.cellReference }}\nTarget language: {{ $('Set Variables').item.json.outputLanguage }}\nCurrent date: {{ $now.format('yyyy-MM-dd') }}\n\nCreate an optimized search query in English that will:\n1. Include relevant keywords and synonyms\n2. Add temporal context if needed (e.g., \"2025\", \"latest\")\n3. Prioritize authoritative sources\n4. Use proper quotation marks for exact phrases\n\nReturn JSON:\n{\n \"optimizedQuery\": \"the optimized query\",\n \"suggestedCountry\": \"us\" or \"il\",\n \"expectedSources\": [\"type of sources like news, official, financial\"]\n}",
"options": {
"systemMessage": "You are a search query optimization expert. Transform user queries into optimal search engine queries."
},
"hasOutputParser": true
},
"typeVersion": 2.2
},
{
"id": "8f5eecc0-f32a-4641-993c-3afd00973524",
"name": "Optimizer Output Parser",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
464,
528
],
"parameters": {
"jsonSchemaExample": "{\n \"optimizedQuery\": \"\",\n \"suggestedCountry\": \"us\",\n \"expectedSources\": []\n}"
},
"typeVersion": 1.3
},
{
"id": "7d46d961-ebcd-4298-a6f3-a37bc02ede22",
"name": "GPT-4o Mini (Optimizer)",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
320,
528
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini"
},
"options": {
"temperature": 0.1
}
},
"typeVersion": 1.2
},
{
"id": "e21dd153-dd0b-4552-9c86-909a6bed554c",
"name": "Multi-Source Search Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
672,
320
],
"parameters": {
"text": "=Search for the top 5 most relevant links:\n\nQuery: {{ $json.output.optimizedQuery }}\nCountry: {{ $json.output.suggestedCountry }}\nExpected sources: {{ $json.output.expectedSources.join(', ') }}\n\nUse search_engine to find the best results. Return EXACTLY 5 URLs.\n\nPriority sources:\n- Official websites (company, government)\n- Major news outlets (Reuters, Bloomberg, WSJ)\n- Financial reports (SEC filings, investor relations)\n- Wikipedia, Crunchbase for entity info\n- Academic or research sources\n\nAvoid:\n- Social media posts\n- Forums and discussion boards\n- Ads and promotional content\n- Low-quality or clickbait sites\n\nReturn JSON format:\n{\n \"links\": [\n {\n \"url\": \"https://...\",\n \"title\": \"page title\",\n \"snippet\": \"description\",\n \"sourceType\": \"news|official|financial|reference\",\n \"credibilityScore\": 1-10\n }\n ]\n}",
"options": {
"systemMessage": "You are an expert at finding the most credible and relevant sources. Always return exactly 5 links ranked by relevance and credibility."
},
"hasOutputParser": true
},
"typeVersion": 2.2
},
{
"id": "acdaf58b-e349-40fa-9e4a-537ad1208053",
"name": "Bright Data MCP Tool",
"type": "@n8n/n8n-nodes-langchain.mcpClientTool",
"position": [
768,
528
],
"parameters": {
"include": "selected",
"options": {
"timeout": 120000
},
"endpointUrl": "https://mcp.brightdata.com/mcp?token=YOUR_TOKEN_HERE&pro=1",
"includeTools": [
"search_engine"
],
"serverTransport": "httpStreamable"
},
"typeVersion": 1.1
},
{
"id": "bf992e5e-cece-4203-888c-96dfabe54571",
"name": "Search Output Parser",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
896,
528
],
"parameters": {
"jsonSchemaExample": "{\n \"links\": [\n {\n \"url\": \"\",\n \"title\": \"\",\n \"snippet\": \"\",\n \"sourceType\": \"news\",\n \"credibilityScore\": 8\n }\n ]\n}"
},
"typeVersion": 1.3
},
{
"id": "f7cc2f0d-16f6-4fcf-aa5e-29b644328e2e",
"name": "GPT-4o (Search)",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
624,
528
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o"
},
"options": {}
},
"typeVersion": 1.2
},
{
"id": "ce606d56-37bb-484d-b0d5-5008968c38cb",
"name": "Split URLs for Parallel Scraping",
"type": "n8n-nodes-base.splitOut",
"position": [
1008,
320
],
"parameters": {
"options": {}
},
"typeVersion": 1
},
{
"id": "4384e82b-12b8-4f41-858b-af2efd67c965",
"name": "Parallel Web Scraping",
"type": "n8n-nodes-base.httpRequest",
"position": [
1232,
320
],
"parameters": {
"url": "https://api.brightdata.com/request",
"method": "POST",
"options": {
"timeout": 30000,
"batching": {
"batch": {
"batchSize": 5
}
}
},
"sendBody": true,
"sendHeaders": true,
"bodyParameters": {
"parameters": [
{
"name": "zone",
"value": "mcp_unlocker"
},
{
"name": "url",
"value": "={{ $json.url }}"
},
{
"name": "format",
"value": "json"
},
{
"name": "method",
"value": "GET"
},
{
"name": "country",
"value": "={{ $('Query Optimizer Agent').item.json.output.suggestedCountry }}"
},
{
"name": "data_format",
"value": "markdown"
}
]
},
"headerParameters": {
"parameters": [
{
"name": "Authorization",
"value": "Bearer YOUR_TOKEN_HERE"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "d784c590-720b-429c-b580-dea0ae7b80be",
"name": "Advanced Data Extraction & Analysis",
"type": "@n8n/n8n-nodes-langchain.chainLlm",
"onError": "continueRegularOutput",
"position": [
1408,
320
],
"parameters": {
"text": "=## Input Data\n\n### Original Query:\n{{ $('Set Variables').item.json.cellReference }} - {{ $('Set Variables').item.json.userPrompt }}\n\n### Source Information:\n- URL: {{ $('Split URLs for Parallel Scraping').item.json.url }}\n- Title: {{ $('Split URLs for Parallel Scraping').item.json.title }}\n- Source Type: {{ $('Split URLs for Parallel Scraping').item.json.sourceType }}\n- Credibility Score: {{ $('Split URLs for Parallel Scraping').item.json.credibilityScore }}/10\n\n### Scraped Content:\n{{ $json.body }}\n\n---\n\n## Your Task\n\nExtract and analyze the following from the content:\n\n1. **Answer to Query**: Direct answer to the user's question\n2. **Key Facts**: Important facts, numbers, dates\n3. **Entities**: People, organizations, locations, products mentioned\n4. **Sentiment**: Overall tone (positive/neutral/negative) and confidence\n5. **Data Tables**: Any structured data (format as markdown tables)\n6. **Quotes**: Important quotes with attribution\n7. **Dates**: Relevant dates and temporal information\n\n## Output Format (JSON)\n\nReturn ONLY valid JSON:\n\n{\n \"answer\": \"Direct answer to the query\",\n \"summary\": \"Concise summary (max 300 chars)\",\n \"keyFacts\": [\"fact1\", \"fact2\", ...],\n \"entities\": {\n \"people\": [\"name1\", \"name2\"],\n \"organizations\": [\"org1\", \"org2\"],\n \"locations\": [\"loc1\"],\n \"products\": [\"product1\"]\n },\n \"sentiment\": {\n \"overall\": \"positive|neutral|negative\",\n \"confidence\": 0.0-1.0,\n \"reasoning\": \"brief explanation\"\n },\n \"dataTables\": [\n {\n \"title\": \"table name\",\n \"markdown\": \"| Col1 | Col2 |\\n|------|------|\\n| val1 | val2 |\"\n }\n ],\n \"quotes\": [\n {\n \"text\": \"quote text\",\n \"attribution\": \"person or source\"\n }\n ],\n \"dates\": [\"2025-01-15\", \"Q4 2024\"],\n \"relevanceScore\": 1-10\n}",
"batching": {},
"messages": {
"messageValues": [
{
"message": "=You are an advanced data extraction AI specialized in:\n- Extracting structured data from unstructured text\n- Named entity recognition (NER)\n- Sentiment analysis\n- Information synthesis\n- Fact verification\n\n**Critical Rules:**\n1. Extract ONLY information present in the source\n2. Do NOT hallucinate or infer information\n3. Translate to {{ $('Set Variables').item.json.outputLanguage }} if needed\n4. Be precise with numbers, dates, and facts\n5. Always return valid JSON\n6. If data is not found, use empty arrays or null\n\n**Quality Standards:**\n- Accuracy > Completeness\n- Cite facts directly from source\n- Flag uncertainties in reasoning fields"
}
]
},
"hasOutputParser": true
},
"typeVersion": 1.7
},
{
"id": "edf8b49b-8732-4361-9e9b-82c9460c9e1b",
"name": "Extraction Output Parser",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
1552,
512
],
"parameters": {
"jsonSchemaExample": "{\n \"answer\": \"\",\n \"summary\": \"\",\n \"keyFacts\": [],\n \"entities\": {\n \"people\": [],\n \"organizations\": [],\n \"locations\": [],\n \"products\": []\n },\n \"sentiment\": {\n \"overall\": \"neutral\",\n \"confidence\": 0.5,\n \"reasoning\": \"\"\n },\n \"dataTables\": [],\n \"quotes\": [],\n \"dates\": [],\n \"relevanceScore\": 5\n}"
},
"typeVersion": 1.3
},
{
"id": "be3ff2d2-2ed9-42fc-8f50-3665eee61c97",
"name": "GPT-4o (Extraction)",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
1408,
512
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o"
},
"options": {}
},
"typeVersion": 1.2
},
{
"id": "1d1b3367-ff6b-4d93-9ef6-a380e074eb29",
"name": "Source Validation Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
1664,
320
],
"parameters": {
"text": "=Validate this source and extracted information:\n\n**Source Details:**\n- URL: {{ $('Split URLs for Parallel Scraping').item.json.url }}\n- Claimed Type: {{ $('Split URLs for Parallel Scraping').item.json.sourceType }}\n- Initial Credibility: {{ $('Split URLs for Parallel Scraping').item.json.credibilityScore }}/10\n\n**Extracted Data:**\n{{ JSON.stringify($json.output, null, 2) }}\n\n**Validation Criteria:**\n1. Is the domain trustworthy? (check TLD, known sources)\n2. Does the content match the expected source type?\n3. Are facts verifiable and internally consistent?\n4. Any red flags? (clickbait, bias, outdated info)\n5. Does the relevance score make sense?\n\nReturn JSON:\n{\n \"isValid\": boolean,\n \"validationScore\": 1-10,\n \"trustLevel\": \"high|medium|low\",\n \"redFlags\": [\"flag1\", \"flag2\"],\n \"recommendations\": \"how to use this source\",\n \"shouldInclude\": boolean\n}",
"options": {
"systemMessage": "You are a source validation expert. Assess credibility, detect bias, and flag unreliable information."
},
"hasOutputParser": true
},
"typeVersion": 2.2
},
{
"id": "c48f6265-c2ba-4b61-a64c-e7f490aec495",
"name": "Validation Output Parser",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
1808,
512
],
"parameters": {
"jsonSchemaExample": "{\n \"isValid\": true,\n \"validationScore\": 8,\n \"trustLevel\": \"high\",\n \"redFlags\": [],\n \"recommendations\": \"\",\n \"shouldInclude\": true\n}"
},
"typeVersion": 1.3
},
{
"id": "84ab425a-8e7b-417c-a2cc-e36be2518699",
"name": "GPT-4o Mini (Validation)",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
1664,
512
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini"
},
"options": {
"temperature": 0.2
}
},
"typeVersion": 1.2
},
{
"id": "0e5049ce-8def-4366-b25a-f7d85b0cdf43",
"name": "Filter Valid Sources",
"type": "n8n-nodes-base.if",
"position": [
1936,
320
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2
},
"combinator": "and",
"conditions": [
{
"id": "should-include",
"operator": {
"type": "boolean",
"operation": "true"
},
"leftValue": "={{ $json.output.shouldInclude }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2.2
},
{
"id": "35d175db-b777-474a-b91d-144e9843adc7",
"name": "Aggregate All Results",
"type": "n8n-nodes-base.aggregate",
"position": [
2112,
192
],
"parameters": {
"options": {},
"aggregate": "aggregateAllItemData"
},
"typeVersion": 1
},
{
"id": "e0fc624c-e72a-438f-9c1b-414fe2ed4d1a",
"name": "Smart Summarizer with Context",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
2256,
192
],
"parameters": {
"text": "=## Input: Multi-Source Analysis\n\n**Original Query:**\n{{ $('Set Variables').item.json.cellReference }} - {{ $('Set Variables').item.json.userPrompt }}\n\n**Output Language:** {{ $('Set Variables').item.json.outputLanguage }}\n\n**Extracted Data from {{ $json.extractedData.length }} Sources:**\n{{ JSON.stringify($json.extractedData, null, 2) }}\n\n---\n\n## Task: Create Comprehensive Summary\n\nAnalyze all sources and create a final answer that:\n\n1. **Directly answers the user's question**\n2. **Synthesizes information from multiple sources**\n3. **Prioritizes high-credibility sources**\n4. **Includes key facts, entities, and sentiment**\n5. **Notes any conflicting information**\n6. **Stays within 400 characters for main answer**\n7. **Provides extended details separately**\n\n## Output Format (JSON)\n\n{\n \"mainAnswer\": \"400 char summary in {{ $('Set Variables').item.json.outputLanguage }}\",\n \"confidence\": 0.0-1.0,\n \"keyInsights\": [\"insight1\", \"insight2\", \"insight3\"],\n \"consensus\": \"areas where sources agree\",\n \"conflicts\": \"areas where sources disagree (if any)\",\n \"entities\": {\n \"people\": [],\n \"organizations\": [],\n \"locations\": [],\n \"products\": []\n },\n \"overallSentiment\": \"positive|neutral|negative\",\n \"importantDates\": [],\n \"dataHighlights\": [\n {\n \"metric\": \"name\",\n \"value\": \"value\",\n \"source\": \"which source\"\n }\n ],\n \"sourcesUsed\": 5,\n \"extendedSummary\": \"Detailed summary with all key information\"\n}",
"options": {
"systemMessage": "=You are an expert analyst who synthesizes information from multiple sources into clear, accurate summaries in {{ $('Set Variables').item.json.outputLanguage }}.\n\n**Principles:**\n- Accuracy first: Never fabricate information\n- Source ranking: Weight by credibility scores\n- Conflict resolution: Note disagreements, don't hide them\n- Completeness: Include all relevant entities and facts\n- Clarity: Write for non-experts\n- Brevity: Main answer \u2264 400 chars"
},
"hasOutputParser": true
},
"typeVersion": 2.2
},
{
"id": "c07929b4-9180-4f69-922d-11435dbcc9d3",
"name": "Summary Output Parser",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
2400,
400
],
"parameters": {
"jsonSchemaExample": "{\n \"mainAnswer\": \"\",\n \"confidence\": 0.8,\n \"keyInsights\": [],\n \"consensus\": \"\",\n \"conflicts\": \"\",\n \"entities\": {\n \"people\": [],\n \"organizations\": [],\n \"locations\": [],\n \"products\": []\n },\n \"overallSentiment\": \"neutral\",\n \"importantDates\": [],\n \"dataHighlights\": [],\n \"sourcesUsed\": 0,\n \"extendedSummary\": \"\"\n}"
},
"typeVersion": 1.3
},
{
"id": "be44751d-d33b-46d6-ada9-e0ab4ae118ac",
"name": "GPT-4o (Summarizer)",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
2256,
400
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o"
},
"options": {
"temperature": 0.3
}
},
"typeVersion": 1.2
},
{
"id": "8bb399be-0edd-4ed2-b491-876b9024c3bc",
"name": "Store in Cache",
"type": "n8n-nodes-base.redis",
"onError": "continueRegularOutput",
"position": [
2544,
192
],
"parameters": {
"key": "={{ $('Set Variables').item.json.cacheKey }}",
"ttl": 3600,
"value": "={{ JSON.stringify($json.output) }}",
"expire": true,
"operation": "set"
},
"typeVersion": 1
},
{
"id": "dea2d0ed-b5f2-4140-98eb-f6ba2fb5d0be",
"name": "Prepare Outputs",
"type": "n8n-nodes-base.set",
"position": [
2768,
192
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "webhook-response",
"name": "webhookResponse",
"type": "string",
"value": "={{ $json.output.mainAnswer }}"
},
{
"id": "slack-message",
"name": "slackMessage",
"type": "string",
"value": "=\u2705 *Search Complete*\\n\\n*Query:* {{ $('Set Variables').item.json.cellReference }} - {{ $('Set Variables').item.json.userPrompt }}\\n\\n*Answer:* {{ $json.output.mainAnswer }}\\n\\n*Confidence:* {{ Math.round($json.output.confidence * 100) }}%\\n*Sources Used:* {{ $json.output.sourcesUsed }}\\n*Sentiment:* {{ $json.output.overallSentiment }}\\n\\n_Request ID: {{ $('Set Variables').item.json.requestId }}_"
},
{
"id": "email-subject",
"name": "emailSubject",
"type": "string",
"value": "=Search Results: {{ $('Set Variables').item.json.cellReference }}"
},
{
"id": "email-body",
"name": "emailBody",
"type": "string",
"value": "=<h2>Advanced Web Research Results</h2>\\n\\n<p><strong>Query:</strong> {{ $('Set Variables').item.json.userPrompt }}</p>\\n<p><strong>Context:</strong> {{ $('Set Variables').item.json.cellReference }}</p>\\n\\n<h3>Main Answer</h3>\\n<p>{{ $json.output.mainAnswer }}</p>\\n\\n<h3>Key Insights</h3>\\n<ul>\\n{{ $json.output.keyInsights.map(i => '<li>' + i + '</li>').join('\\n') }}\\n</ul>\\n\\n<h3>Extended Summary</h3>\\n<p>{{ $json.output.extendedSummary }}</p>\\n\\n<h3>Data Highlights</h3>\\n<ul>\\n{{ $json.output.dataHighlights.map(d => '<li><strong>' + d.metric + ':</strong> ' + d.value + ' <em>(from ' + d.source + ')</em></li>').join('\\n') }}\\n</ul>\\n\\n<h3>Entities Mentioned</h3>\\n<ul>\\n<li><strong>People:</strong> {{ $json.output.entities.people.join(', ') }}</li>\\n<li><strong>Organizations:</strong> {{ $json.output.entities.organizations.join(', ') }}</li>\\n<li><strong>Locations:</strong> {{ $json.output.entities.locations.join(', ') }}</li>\\n</ul>\\n\\n<hr>\\n<p><em>Generated: {{ $now.format('yyyy-MM-dd HH:mm:ss') }}</em></p>\\n<p><em>Confidence: {{ Math.round($json.output.confidence * 100) }}%</em></p>\\n<p><em>Sources Analyzed: {{ $json.output.sourcesUsed }}</em></p>"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "92028c09-3097-4046-ac6e-d843d313336f",
"name": "Respond to Webhook",
"type": "n8n-nodes-base.respondToWebhook",
"position": [
2992,
80
],
"parameters": {
"options": {
"responseHeaders": {
"entries": [
{
"name": "Content-Type",
"value": "text/plain; charset=utf-8"
}
]
}
},
"respondWith": "text",
"responseBody": "={{ $json.webhookResponse }}"
},
"typeVersion": 1.4
},
{
"id": "35e531fe-47a8-43dc-8ac8-e08b7c9cdf82",
"name": "Send Slack Notification",
"type": "n8n-nodes-base.slack",
"onError": "continueRegularOutput",
"position": [
2992,
208
],
"parameters": {
"text": "={{ $json.slackMessage }}",
"otherOptions": {}
},
"typeVersion": 2.3
},
{
"id": "edbf4987-666e-437d-878f-213a3207bf42",
"name": "Send Email Report",
"type": "n8n-nodes-base.emailSend",
"onError": "continueRegularOutput",
"position": [
2992,
352
],
"parameters": {
"options": {},
"subject": "={{ $json.emailSubject }}",
"toEmail": "={{ $('Webhook Entry').item.json.body.notifyEmail || 'team@yourdomain.com' }}",
"fromEmail": "user@example.com"
},
"typeVersion": 2.1
},
{
"id": "f78d7f9a-5de3-4721-bd06-cfd34a542c93",
"name": "Log to DataTable",
"type": "n8n-nodes-base.dataTable",
"onError": "continueRegularOutput",
"position": [
2992,
496
],
"parameters": {
"operation": "append",
"dataTableId": {
"__rl": true,
"mode": "list",
"value": "YOUR_DATATABLE_ID"
}
},
"typeVersion": 1
},
{
"id": "0824c24a-81b3-40b6-a2f7-0595a1e7cf84",
"name": "Return Cached Result",
"type": "n8n-nodes-base.respondToWebhook",
"position": [
400,
-96
],
"parameters": {
"options": {
"responseHeaders": {
"entries": [
{
"name": "X-Cache",
"value": "HIT"
}
]
}
},
"respondWith": "json",
"responseBody": "={{ JSON.parse($('Cache Check').item.json.value) }}"
},
"typeVersion": 1.4
},
{
"id": "b846aa93-0079-46d4-bb52-345ffca70784",
"name": "Log Cache Hit",
"type": "n8n-nodes-base.dataTable",
"onError": "continueRegularOutput",
"position": [
400,
-240
],
"parameters": {
"operation": "append",
"dataTableId": {
"__rl": true,
"mode": "list",
"value": "YOUR_DATATABLE_ID"
}
},
"typeVersion": 1
},
{
"id": "00f81dfd-a518-45c4-acc6-a49483e4f357",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-704,
-368
],
"parameters": {
"color": 5,
"width": 1296,
"height": 512,
"content": "# Input Handling and Caching\n\n## Receives webhook request, sets variables like prompt and cache key, checks Redis cache for existing results, and returns cached response if hit, ensuring efficient reuse of prior computations.\n\n"
},
"typeVersion": 1
},
{
"id": "67c24041-ed99-4b3e-aee4-9344509089f2",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-704,
144
],
"parameters": {
"width": 1296,
"height": 704,
"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\n\n\n\n\n\n\n\n\n\n\n\n\n# Query Decomposition and Optimization\n\n## Applies rate limiting, uses AI to break complex queries into sub-queries, optimizes each for search relevance with keywords and context, preparing targeted English queries for authoritative sources. \n\n"
},
"typeVersion": 1
},
{
"id": "d295efd7-0d94-4312-a07d-0f2583217d90",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
592,
-368
],
"parameters": {
"color": 4,
"width": 768,
"height": 1216,
"content": "# Multi-Source Search and Scraping\n\n\n## Performs AI-driven search via Bright Data for top 5 credible URLs, splits for parallel scraping to extract markdown content from official, news, and financial sites, avoiding low-quality sources. \n\n"
},
"typeVersion": 1
},
{
"id": "fe362a54-d47a-48f8-b921-071dda8af5f9",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
1360,
-368
],
"parameters": {
"color": 6,
"width": 1152,
"height": 1216,
"content": "# Data Extraction, Validation, and Synthesis\n\n## Extracts structured data (facts, entities, sentiment) from scraped content using AI, validates source credibility and filters valid ones, aggregates results, and generates a comprehensive summary with confidence scores. "
},
"typeVersion": 1
},
{
"id": "10e799b2-2920-4d4b-8701-386bbb7f91e8",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
2512,
-368
],
"parameters": {
"color": 2,
"width": 848,
"height": 1216,
"content": "# Output and Notifications\n## Caches final summary, prepares responses for webhook, sends Slack notifications and email reports with insights, and logs to data table for tracking, completing the research workflow. \n\n"
},
"typeVersion": 1
},
{
"id": "7dc6b369-e35f-4d8c-a6ed-1631ccca185d",
"name": "Sticky Note5",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1728,
-368
],
"parameters": {
"color": 4,
"width": 1024,
"height": 1216,
"content": "# \ud83d\udd0d Advanced AI-Powered Web Research System\n\n**Created by [Daniel Shashko](https://linkedin.com/in/daniel-shashko)**\n\nThis enterprise-grade workflow transforms natural language queries into comprehensive, multi-source research reports using AI agents, parallel web scraping, and intelligent data synthesis.\n\n## Key Features\n\u2705 **Smart Query Processing** - AI breaks complex questions into optimized sub-queries \n\u2705 **Multi-Source Intelligence** - Searches and scrapes 5 credible sources in parallel \n\u2705 **Intelligent Extraction** - Extracts facts, entities, sentiment, and structured data \n\u2705 **Source Validation** - AI validates credibility and filters unreliable content \n\u2705 **Redis Caching** - 1-hour cache for instant responses to duplicate queries \n\u2705 **Rate Limiting** - 60 requests/minute protection \n\u2705 **Multi-Channel Output** - Webhook response, Slack, email reports, and data logging\n\n## Tech Stack\n- **AI Models**: GPT-4o (reasoning, search, extraction) + GPT-4o-mini (optimization, validation)\n- **Search**: Bright Data MCP Tool + Web Scraping API\n- **Cache**: Redis with 1-hour TTL\n- **Output**: Webhook, Slack, Email, n8n DataTable\n\n## \ud83d\udce6 Companion Files\n**Note**: This workflow works with an accompanying [**`google-apps-script.js`**](https://gist.github.com/danishashko/fb509b733aebf5538676ca80b19fa28b) file for Google Sheets integration.\n\n## Workflow Stages\n1. **Input & Cache** \u2192 Webhook \u2192 Variables \u2192 Cache Check \u2192 Return if hit\n2. **Query Processing** \u2192 Rate limit \u2192 AI reasoning \u2192 Query optimization \n3. **Search & Scrape** \u2192 Multi-source search \u2192 Parallel scraping (5 URLs)\n4. **Analysis** \u2192 Data extraction \u2192 Source validation \u2192 Filter & aggregate\n5. **Synthesis** \u2192 AI summarizer \u2192 Cache storage \u2192 Multi-channel output\n\n## API Input Format\n```json\n{\n \"prompt\": \"Your question here\",\n \"source\": \"Context or cell reference\", \n \"language\": \"English\",\n \"notifyEmail\": \"user@domain.com\"\n}\n```\n\n## Response Format\n- **Main Answer**: \u2264400 chars in requested language\n- **Confidence Score**: 0.0-1.0\n- **Key Insights**: Top 3-5 findings\n- **Entities**: People, orgs, locations, products\n- **Extended Summary**: Full detailed analysis\n- **Data Highlights**: Key metrics with sources"
},
"typeVersion": 1
}
],
"connections": {
"Cache Check": {
"main": [
[
{
"node": "Check Cache Hit",
"type": "main",
"index": 0
}
]
]
},
"Set Variables": {
"main": [
[
{
"node": "Cache Check",
"type": "main",
"index": 0
}
]
]
},
"Webhook Entry": {
"main": [
[
{
"node": "Set Variables",
"type": "main",
"index": 0
}
]
]
},
"Store in Cache": {
"main": [
[
{
"node": "Prepare Outputs",
"type": "main",
"index": 0
}
]
]
},
"Check Cache Hit": {
"main": [
[
{
"node": "Return Cached Result",
"type": "main",
"index": 0
},
{
"node": "Log Cache Hit",
"type": "main",
"index": 0
}
],
[
{
"node": "Rate Limit Check",
"type": "main",
"index": 0
}
]
]
},
"GPT-4o (Search)": {
"ai_languageModel": [
[
{
"node": "Multi-Source Search Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Prepare Outputs": {
"main": [
[
{
"node": "Respond to Webhook",
"type": "main",
"index": 0
},
{
"node": "Send Slack Notification",
"type": "main",
"index": 0
},
{
"node": "Send Email Report",
"type": "main",
"index": 0
},
{
"node": "Log to DataTable",
"type": "main",
"index": 0
}
]
]
},
"Rate Limit Check": {
"main": [
[
{
"node": "Multi-Step Reasoning Agent",
"type": "main",
"index": 0
}
]
]
},
"Split Sub-Queries": {
"main": [
[
{
"node": "Query Optimizer Agent",
"type": "main",
"index": 0
}
]
]
},
"GPT-4o (Reasoning)": {
"ai_languageModel": [
[
{
"node": "Multi-Step Reasoning Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"GPT-4o (Extraction)": {
"ai_languageModel": [
[
{
"node": "Advanced Data Extraction & Analysis",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"GPT-4o (Summarizer)": {
"ai_languageModel": [
[
{
"node": "Smart Summarizer with Context",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Bright Data MCP Tool": {
"ai_tool": [
[
{
"node": "Multi-Source Search Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Filter Valid Sources": {
"main": [
[
{
"node": "Aggregate All Results",
"type": "main",
"index": 0
}
]
]
},
"Search Output Parser": {
"ai_outputParser": [
[
{
"node": "Multi-Source Search Agent",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"Aggregate All Results": {
"main": [
[
{
"node": "Smart Summarizer with Context",
"type": "main",
"index": 0
}
]
]
},
"Parallel Web Scraping": {
"main": [
[
{
"node": "Advanced Data Extraction & Analysis",
"type": "main",
"index": 0
}
]
]
},
"Query Optimizer Agent": {
"main": [
[
{
"node": "Multi-Source Search Agent",
"type": "main",
"index": 0
}
]
]
},
"Summary Output Parser": {
"ai_outputParser": [
[
{
"node": "Smart Summarizer with Context",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"GPT-4o Mini (Optimizer)": {
"ai_languageModel": [
[
{
"node": "Query Optimizer Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Optimizer Output Parser": {
"ai_outputParser": [
[
{
"node": "Query Optimizer Agent",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"Reasoning Output Parser": {
"ai_outputParser": [
[
{
"node": "Multi-Step Reasoning Agent",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"Source Validation Agent": {
"main": [
[
{
"node": "Filter Valid Sources",
"type": "main",
"index": 0
}
]
]
},
"Extraction Output Parser": {
"ai_outputParser": [
[
{
"node": "Advanced Data Extraction & Analysis",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"GPT-4o Mini (Validation)": {
"ai_languageModel": [
[
{
"node": "Source Validation Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Validation Output Parser": {
"ai_outputParser": [
[
{
"node": "Source Validation Agent",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"Multi-Source Search Agent": {
"main": [
[
{
"node": "Split URLs for Parallel Scraping",
"type": "main",
"index": 0
}
]
]
},
"Multi-Step Reasoning Agent": {
"main": [
[
{
"node": "Split Sub-Queries",
"type": "main",
"index": 0
}
]
]
},
"Smart Summarizer with Context": {
"main": [
[
{
"node": "Store in Cache",
"type": "main",
"index": 0
}
]
]
},
"Split URLs for Parallel Scraping": {
"main": [
[
{
"node": "Parallel Web Scraping",
"type": "main",
"index": 0
}
]
]
},
"Advanced Data Extraction & Analysis": {
"main": [
[
{
"node": "Source Validation Agent",
"type": "main",
"index": 0
}
]
]
}
}
}
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.
httpHeaderAuth
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
This workflow transforms natural language queries into research reports through a five-stage AI pipeline. When triggered via webhook (typically from Google Sheets using the companion [](https://gist.github.com/danishashko/fb509b733aebf5538676ca80b19fa28b) (GitHub gist), it first…
Source: https://n8n.io/workflows/10349/ — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
This n8n workflow orchestrates a powerful suite of AI Agents and automations to manage and optimize various aspects of an e-commerce operation, particularly for platforms like Shopify. It leverages La
This workflow automates customer feedback processing by analyzing sentiment, identifying key issues, generating personalized responses, and escalating critical cases to support teams when required. De
This workflow automates end-to-end AI-driven content moderation for platforms managing user-generated content, including marketplaces, communities, and enterprise systems. It is designed for product,
This workflow automates veterinary clinic operations and client communications for animal hospitals and veterinary practices managing appointments, inventory, and patient care. It solves the dual chal
This workflow automates comprehensive data validation and regulatory compliance reporting through intelligent AI-driven analysis. Designed for compliance officers, data governance teams, and regulator