Skip to content

Instantly share code, notes, and snippets.

@alnutile
Created July 20, 2025 17:44
Show Gist options
  • Select an option

  • Save alnutile/bbf38713c432395dee0d457b2ca6c019 to your computer and use it in GitHub Desktop.

Select an option

Save alnutile/bbf38713c432395dee0d457b2ca6c019 to your computer and use it in GitHub Desktop.
Deep Dive Building https://youtu.be/K8fBcudZZys
{
"name": "leads-dash",
"nodes": [
{
"parameters": {
"promptType": "define",
"text": "={{ $('Webhook').item.json.body.record.content }}",
"hasOutputParser": true,
"options": {
"systemMessage": "=Date: {{ $now }}\n\nYou are a helpful AI assistant that is helping the user build a custom CRM and lead generation/reporting system through conversation. You work behind the scenes using a range of tools to carry out tasks, build artifacts, and enrich the system. Your overarching mission is to help the user create a powerful, flexible CRM that can handle leads, outreach, reporting, and automation.\n\nWhen a user message comes in:\n1. Interpret their intent.\n2. Choose the correct tools needed to fulfill the request.\n3. Trigger those tools, using them in sequence if needed.\n4. Gather the results and summarize what was done.\n\n**Your final output MUST follow this schema:**\n- `title`: A short, descriptive title of what the response is about.\n- `response`: A natural language reply to the user explaining what was done or what is next (e.g., \"Here is your list of leads from LinkedIn\" or \"I created a new task for your outreach workflow\").\n- `metadata`: Any useful JSON data (IDs, references, tool invocations, etc.) that may help power UI elements, downstream logic, or persistence.\n\nYou do NOT create the artifacts yourself. Let the tools build the artifacts (leads, tasks, research, etc.), and report back on what happened.\n\nYou are always helping the user incrementally build a better lead management hub.\n\nOnly return values that fit the JSON format: \n{\n \"title\": \"...\",\n \"response\": \"...\",\n \"metadata\": { ... }\n}\n\n\n## NEVER\n\nNever use the both tools **research** and **url_scraper** the do different things but get to the same results. If the prompt is for urls use the url_scraper and that is it, if the prompt is to search the web or do rearch use that. You could use the url_scraper if the research tool returns urls that you feel could provide more details"
}
},
"id": "6f24a624-fd51-48ff-802d-c922745250a8",
"name": "AI Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
480,
-64
],
"typeVersion": 1.6
},
{
"parameters": {
"sseEndpoint": "https://mcp.explorium.ai/sse",
"authentication": "headerAuth",
"include": "selected",
"includeTools": [
"fetch-prospects",
"match-prospects",
"web-search",
"enrich-prospects-profiles",
"enrich-prospects-linkedin-posts",
"enrich-prospects-contacts"
]
},
"id": "ad38b538-291d-4698-a6f8-43bf314b8c9a",
"name": "Explorium MCP",
"type": "@n8n/n8n-nodes-langchain.mcpClientTool",
"position": [
368,
768
],
"typeVersion": 1,
"credentials": {
"httpHeaderAuth": {
"id": "52Lgp1DZhU7yO4dq",
"name": "Explorium"
}
},
"disabled": true
},
{
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini"
},
"options": {
"responseFormat": "json_object"
}
},
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"typeVersion": 1.2,
"position": [
80,
592
],
"id": "7ad651e9-3aeb-4e69-85d6-88921c1bba37",
"name": "OpenAI Chat Model",
"credentials": {
"openAiApi": {
"id": "HpvrXscUWtB5V0Lc",
"name": "DailyAiTraining"
}
}
},
{
"parameters": {
"jsonSchemaExample": "{\n \"title\": \"...\",\n \"response\": \"...\",\n \"metadata\": { }\n}"
},
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"typeVersion": 1.2,
"position": [
1168,
720
],
"id": "2f57fae0-3b8c-448c-b63e-5d963f7e6292",
"name": "Structured Output Parser"
},
{
"parameters": {
"httpMethod": "POST",
"path": "e0294813-dddb-45d7-afa5-8cb59d592f2c",
"options": {}
},
"type": "n8n-nodes-base.webhook",
"typeVersion": 2,
"position": [
-368,
-160
],
"id": "3159f233-1f88-492e-92ec-8cdff12518d6",
"name": "Webhook",
"webhookId": "e0294813-dddb-45d7-afa5-8cb59d592f2c"
},
{
"parameters": {
"workflowId": {
"__rl": true,
"value": "DiehayCxkj473gm2",
"mode": "list",
"cachedResultName": "tasks"
},
"workflowInputs": {
"mappingMode": "defineBelow",
"value": {
"prompt": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('prompt', ``, 'string') }}"
},
"matchingColumns": [
"prompt"
],
"schema": [
{
"id": "prompt",
"displayName": "prompt",
"required": false,
"defaultMatch": false,
"display": true,
"canBeUsedToMatch": true,
"type": "string",
"removed": false
}
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
}
},
"type": "@n8n/n8n-nodes-langchain.toolWorkflow",
"typeVersion": 2.2,
"position": [
480,
608
],
"id": "5e19913f-1178-44e1-a532-54e52cc00d59",
"name": "CreateTasks"
},
{
"parameters": {
"description": "This is the tool for you to give the query to and it will do web research for you and then we'll write it into an artifact. It will return back to you the results of that artifact, which the user will see, but you can help summarize it.",
"workflowId": {
"__rl": true,
"value": "ZhZmac6FcYUunZT4",
"mode": "list",
"cachedResultName": "research"
},
"workflowInputs": {
"mappingMode": "defineBelow",
"value": {
"prompt": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('prompt', ``, 'string') }}",
"session_id": "={{ $('vars').first().json.session_id }}",
"chat_id": "={{ $('Webhook').first().json.body.record.id }}"
},
"matchingColumns": [
"prompt"
],
"schema": [
{
"id": "prompt",
"displayName": "prompt",
"required": false,
"defaultMatch": false,
"display": true,
"canBeUsedToMatch": true,
"type": "string",
"removed": false
},
{
"id": "session_id",
"displayName": "session_id",
"required": false,
"defaultMatch": false,
"display": true,
"canBeUsedToMatch": true,
"type": "string",
"removed": false
},
{
"id": "chat_id",
"displayName": "chat_id",
"required": false,
"defaultMatch": false,
"display": true,
"canBeUsedToMatch": true,
"type": "string",
"removed": false
}
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
}
},
"type": "@n8n/n8n-nodes-langchain.toolWorkflow",
"typeVersion": 2.2,
"position": [
752,
752
],
"id": "5e3e18e8-2646-4fea-bb40-c668718ef1b3",
"name": "research"
},
{
"parameters": {
"workflowId": {
"__rl": true,
"value": "3pCSlWNJYE9jEg2Y",
"mode": "list",
"cachedResultName": "leads"
},
"workflowInputs": {
"mappingMode": "defineBelow",
"value": {
"prompt": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('prompt', ``, 'string') }}"
},
"matchingColumns": [
"prompt"
],
"schema": [
{
"id": "prompt",
"displayName": "prompt",
"required": false,
"defaultMatch": false,
"display": true,
"canBeUsedToMatch": true,
"type": "string",
"removed": false
}
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
}
},
"type": "@n8n/n8n-nodes-langchain.toolWorkflow",
"typeVersion": 2.2,
"position": [
1024,
752
],
"id": "5ede8a8b-fe80-4b6f-9467-0d2c12d2aae9",
"name": "create_leads"
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "73855e41-f792-437b-b950-b657a49235c1",
"leftValue": "={{ $json.body.record.role }}",
"rightValue": "human",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.2,
"position": [
-160,
-144
],
"id": "e8d0f42e-e334-4fdb-a47c-771e0b0c969f",
"name": "IfHuman"
},
{
"parameters": {
"sessionIdType": "customKey",
"sessionKey": "={{ $('vars').first().json.session_id }}",
"contextWindowLength": 10
},
"type": "@n8n/n8n-nodes-langchain.memoryPostgresChat",
"typeVersion": 1.3,
"position": [
240,
592
],
"id": "703a6d82-1512-45f6-b098-b5cb3e5e3382",
"name": "Postgres Chat Memory",
"credentials": {
"postgres": {
"id": "iuDDxbgfkpbZjoJZ",
"name": "Tools"
}
}
},
{
"parameters": {
"operation": "update",
"tableId": "chat",
"filters": {
"conditions": [
{
"keyName": "id",
"condition": "eq",
"keyValue": "={{ $('Webhook').item.json.body.record.id }}"
}
]
},
"fieldsUi": {
"fieldValues": [
{
"fieldId": "step",
"fieldValue": "Running Ai Magic"
},
{
"fieldId": "status",
"fieldValue": "running"
}
]
}
},
"type": "n8n-nodes-base.supabase",
"typeVersion": 1,
"position": [
240,
-64
],
"id": "984c0ff5-5e2d-4415-ae0e-6e5513f00f11",
"name": "Supabase",
"credentials": {
"supabaseApi": {
"id": "AXfAwvIkTMj3vPIr",
"name": "Tools"
}
}
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "0af78ce2-00fa-4fde-b5f9-7230e5f91df0",
"leftValue": "={{ $('Webhook').item.json.body.record.title }}",
"rightValue": "",
"operator": {
"type": "string",
"operation": "empty",
"singleValue": true
}
},
{
"id": "9d01e35c-8426-4b80-a998-37ea941b678e",
"leftValue": "={{ $('Webhook').item.json.body.record.parent_id }}",
"rightValue": "",
"operator": {
"type": "string",
"operation": "empty",
"singleValue": true
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.2,
"position": [
1280,
-64
],
"id": "8f6bc6b8-c2ee-41a5-a69e-2ef059e5cb29",
"name": "If"
},
{
"parameters": {
"modelId": {
"__rl": true,
"value": "gpt-4.1-mini",
"mode": "list",
"cachedResultName": "GPT-4.1-MINI"
},
"messages": {
"values": [
{
"content": "=We just want you to make a title from the incoming question:\n\n\nQuestion\n{{ $('Webhook').item.json.body.record.content }}\n\n\nFORMAT JSON\n\n{\n \"title\": \"<string>\"\n}",
"role": "system"
}
]
},
"jsonOutput": true,
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.openAi",
"typeVersion": 1.8,
"position": [
1232,
240
],
"id": "4ec6e8d0-433f-491d-978e-ca1aee2a0d1e",
"name": "OpenAI",
"credentials": {
"openAiApi": {
"id": "TqEEu0VRFjao8YS9",
"name": "DailyMasterToken"
}
}
},
{
"parameters": {
"operation": "update",
"tableId": "chat",
"filters": {
"conditions": [
{
"keyName": "id",
"condition": "eq",
"keyValue": "={{ $('Webhook').item.json.body.record.id }}"
}
]
},
"fieldsUi": {
"fieldValues": [
{
"fieldId": "title",
"fieldValue": "={{ $json.message.content.title }}"
}
]
}
},
"type": "n8n-nodes-base.supabase",
"typeVersion": 1,
"position": [
1264,
480
],
"id": "15b1685e-a4b3-4257-b4eb-d517f9247763",
"name": "Supabase2",
"credentials": {
"supabaseApi": {
"id": "AXfAwvIkTMj3vPIr",
"name": "Tools"
}
}
},
{
"parameters": {},
"type": "@n8n/n8n-nodes-langchain.toolCalculator",
"typeVersion": 1,
"position": [
864,
752
],
"id": "b05094b6-e58e-4da0-9291-7e7aec8cf183",
"name": "Calculator"
},
{
"parameters": {
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.toolSerpApi",
"typeVersion": 1,
"position": [
352,
624
],
"id": "6c4585e8-e2b9-4e7e-bddb-ff2049a2fe7d",
"name": "SearchTheWeb",
"credentials": {
"serpApi": {
"id": "wDqpFKXyRIfbbEjw",
"name": "SerpFree Account"
}
}
},
{
"parameters": {
"operation": "update",
"tableId": "chat",
"filters": {
"conditions": [
{
"keyName": "id",
"condition": "eq",
"keyValue": "={{ $('Webhook').item.json.body.record.id }}"
}
]
},
"fieldsUi": {
"fieldValues": [
{
"fieldId": "step",
"fieldValue": "Complete"
},
{
"fieldId": "status",
"fieldValue": "completed"
}
]
}
},
"type": "n8n-nodes-base.supabase",
"typeVersion": 1,
"position": [
1088,
-64
],
"id": "af6b344a-d4ac-4e64-bf0e-68df1ce49058",
"name": "UpdateChat",
"credentials": {
"supabaseApi": {
"id": "AXfAwvIkTMj3vPIr",
"name": "Tools"
}
}
},
{
"parameters": {
"tableId": "chat",
"fieldsUi": {
"fieldValues": [
{
"fieldId": "parent_id",
"fieldValue": "={{ $('vars').first().json.session_id }}"
},
{
"fieldId": "role",
"fieldValue": "ai"
},
{
"fieldId": "status",
"fieldValue": "completed"
},
{
"fieldId": "step",
"fieldValue": "Ai Results Ready"
},
{
"fieldId": "content",
"fieldValue": "={{ $json.output.response }}"
},
{
"fieldId": "title",
"fieldValue": "={{ $json.output.title }}"
},
{
"fieldId": "metadata",
"fieldValue": "={{ $json.output.metadata }}"
}
]
}
},
"type": "n8n-nodes-base.supabase",
"typeVersion": 1,
"position": [
864,
-64
],
"id": "76b5b951-f6e7-45c1-a90d-d2a7d84b9833",
"name": "CreateAiChatRow1",
"credentials": {
"supabaseApi": {
"id": "AXfAwvIkTMj3vPIr",
"name": "Tools"
}
}
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "d2fd6e69-fe91-4caa-9bf9-c41034032095",
"leftValue": "={{ $('Webhook').item.json.body.record.parent_id }}",
"rightValue": "",
"operator": {
"type": "string",
"operation": "empty",
"singleValue": true
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.2,
"position": [
-336,
304
],
"id": "947fa6c9-387a-4924-829a-3f139e405c0d",
"name": "IfParentLevel1"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "d2f2df8f-f0e5-4215-a5b5-3af2f12463e1",
"name": "session_id",
"value": "={{ $('Webhook').item.json.body.record.id }}",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
-128,
192
],
"id": "9c4dbc40-45bf-4146-beeb-08b1f5faba27",
"name": "Edit Fields"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "d2f2df8f-f0e5-4215-a5b5-3af2f12463e1",
"name": "session_id",
"value": "={{ $('Webhook').item.json.body.record.parent_id }}",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
-128,
384
],
"id": "f97f6c8d-3348-4b32-8c81-9edf16784417",
"name": "Edit Fields1"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "d2f2df8f-f0e5-4215-a5b5-3af2f12463e1",
"name": "session_id",
"value": "={{ $json.session_id }}",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
48,
272
],
"id": "a6c4d4f0-ca6d-4cab-9caf-9f756cc60e02",
"name": "vars"
},
{
"parameters": {},
"type": "n8n-nodes-base.noOp",
"typeVersion": 1,
"position": [
288,
-256
],
"id": "aecaf3f3-7e0e-48a4-9237-be2d12039a0f",
"name": "No Operation, do nothing",
"notesInFlow": true,
"notes": "This is ai coming in so we do not need to respond to it"
},
{
"parameters": {
"description": "Use this when the user enters a bunch of URLs that they want us to get data from a website.",
"workflowId": {
"__rl": true,
"value": "FxqXTwoZUyzQp2gf",
"mode": "list",
"cachedResultName": "tool-url-scrape"
},
"workflowInputs": {
"mappingMode": "defineBelow",
"value": {
"urls": "={{ $fromAI('urls', `an array of urls`, 'json') }}",
"chat_id": "={{ $('Webhook').item.json.body.record.id }}",
"session_id": "={{ $('vars').item.json.session_id }}"
},
"matchingColumns": [],
"schema": [
{
"id": "urls",
"displayName": "urls",
"required": false,
"defaultMatch": false,
"display": true,
"canBeUsedToMatch": true,
"type": "array"
},
{
"id": "chat_id",
"displayName": "chat_id",
"required": false,
"defaultMatch": false,
"display": true,
"canBeUsedToMatch": true,
"type": "string"
},
{
"id": "session_id",
"displayName": "session_id",
"required": false,
"defaultMatch": false,
"display": true,
"canBeUsedToMatch": true,
"type": "string"
}
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
}
},
"type": "@n8n/n8n-nodes-langchain.toolWorkflow",
"typeVersion": 2.2,
"position": [
624,
752
],
"id": "7764c942-ced6-4a1c-8925-a9f7854a2ccf",
"name": "url_scraper"
}
],
"pinData": {
"Webhook": [
{
"json": {
"headers": {
"connection": "upgrade",
"host": "n8n-do.dailyai.studio",
"x-real-ip": "50.18.170.14",
"x-forwarded-for": "50.18.170.14",
"x-forwarded-proto": "https",
"content-length": "458",
"accept": "*/*",
"content-type": "application/json",
"user-agent": "pg_net/0.14.0"
},
"params": {},
"query": {},
"body": {
"type": "INSERT",
"table": "chat",
"record": {
"id": "0f86e3f5-28cc-4e2f-85ef-fc0e00bd8546",
"role": "human",
"step": "Waiting on AI",
"title": null,
"status": "pending",
"content": "get info from the urls https://simplerecipes.io/recipes/77\n\nhttps://simplerecipes.io/recipes/76",
"metadata": {},
"parent_id": null,
"created_at": "2025-07-17T21:17:20.754101+00:00",
"updated_at": "2025-07-17T21:17:20.754101+00:00"
},
"schema": "public",
"old_record": null
},
"webhookUrl": "https://n8n-do.dailyai.studio/webhook/e0294813-dddb-45d7-afa5-8cb59d592f2c",
"executionMode": "production"
}
}
]
},
"connections": {
"AI Agent": {
"main": [
[
{
"node": "CreateAiChatRow1",
"type": "main",
"index": 0
}
]
]
},
"Explorium MCP": {
"ai_tool": [
[]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Structured Output Parser": {
"ai_outputParser": [
[
{
"node": "AI Agent",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"Webhook": {
"main": [
[
{
"node": "IfHuman",
"type": "main",
"index": 0
}
]
]
},
"CreateTasks": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"research": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"create_leads": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"IfHuman": {
"main": [
[
{
"node": "IfParentLevel1",
"type": "main",
"index": 0
}
],
[
{
"node": "No Operation, do nothing",
"type": "main",
"index": 0
}
]
]
},
"Postgres Chat Memory": {
"ai_memory": [
[
{
"node": "AI Agent",
"type": "ai_memory",
"index": 0
}
]
]
},
"Supabase": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"If": {
"main": [
[
{
"node": "OpenAI",
"type": "main",
"index": 0
}
]
]
},
"OpenAI": {
"main": [
[
{
"node": "Supabase2",
"type": "main",
"index": 0
}
]
]
},
"Calculator": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"SearchTheWeb": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"UpdateChat": {
"main": [
[
{
"node": "If",
"type": "main",
"index": 0
}
]
]
},
"CreateAiChatRow1": {
"main": [
[
{
"node": "UpdateChat",
"type": "main",
"index": 0
}
]
]
},
"IfParentLevel1": {
"main": [
[
{
"node": "Edit Fields",
"type": "main",
"index": 0
}
],
[
{
"node": "Edit Fields1",
"type": "main",
"index": 0
}
]
]
},
"Edit Fields1": {
"main": [
[
{
"node": "vars",
"type": "main",
"index": 0
}
]
]
},
"Edit Fields": {
"main": [
[
{
"node": "vars",
"type": "main",
"index": 0
}
]
]
},
"vars": {
"main": [
[
{
"node": "Supabase",
"type": "main",
"index": 0
}
]
]
},
"url_scraper": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
}
},
"active": true,
"settings": {
"executionOrder": "v1"
},
"versionId": "dff07c07-594c-4eb4-b3f5-80ed93eee73a",
"meta": {
"templateCredsSetupCompleted": true,
"instanceId": "b77b374d91a001765a8bf2832badc1f8fcc5407c99c4c6f3f68d6413d663ef83"
},
"id": "BGy3HEil26VfHdEP",
"tags": [
{
"createdAt": "2025-07-16T20:33:03.612Z",
"updatedAt": "2025-07-16T20:33:03.612Z",
"id": "6zU7BwDqjq5RGjOU",
"name": "building"
},
{
"createdAt": "2025-02-05T12:12:50.916Z",
"updatedAt": "2025-02-05T12:12:50.916Z",
"id": "kyZZigrc6B4KzuMd",
"name": "youtube"
},
{
"createdAt": "2025-07-16T20:33:12.793Z",
"updatedAt": "2025-07-16T20:33:12.793Z",
"id": "oVmz3tH4fxKLa29j",
"name": "leads-dash"
}
]
}
{
"name": "research",
"nodes": [
{
"parameters": {
"workflowInputs": {
"values": [
{
"name": "prompt"
},
{
"name": "session_id"
},
{
"name": "chat_id"
}
]
}
},
"type": "n8n-nodes-base.executeWorkflowTrigger",
"typeVersion": 1.1,
"position": [
-1168,
-608
],
"id": "d69b15be-4664-4b3b-b3ec-51c96df6c5b4",
"name": "When Executed by Another Workflow"
},
{
"parameters": {
"promptType": "define",
"text": "={{ $json.prompt }}",
"hasOutputParser": true,
"options": {
"systemMessage": "=Date: {{$now}}\n\nYour role is to take this content, use the research tool called Tavali to go get information from the web, and then take those results and really create a good report about the particular topic at hand. And you're going to output it in a particular format.\n\ncontent - this final output should be markdown\n\n\n## FORMAT JSON\n{\n \"title\": \"<string>\",\n \"content\": \"<string>\",\n \"tags\": [\"<string>\"],\n \"metadata\": {\n \"urls\": [\n \"<string>\"\n ],\n \"images\": [\n \"<string>\"\n ],\n \"files\": [\n \"<string>\"\n ]\n }\n}"
}
},
"type": "@n8n/n8n-nodes-langchain.agent",
"typeVersion": 1.9,
"position": [
-896,
-608
],
"id": "6c686619-a522-4448-aba0-0ba820d14487",
"name": "AI Agent",
"retryOnFail": true
},
{
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini"
},
"options": {
"responseFormat": "json_object"
}
},
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"typeVersion": 1.2,
"position": [
-1056,
-304
],
"id": "e54e1c25-e35a-469a-b31c-d69216379ded",
"name": "OpenAI Chat Model",
"credentials": {
"openAiApi": {
"id": "v5lKgV7PDt0H77GQ",
"name": "Toolbot Token"
}
}
},
{
"parameters": {
"sessionIdType": "customKey",
"sessionKey": "={{ $json.session_id }}"
},
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"typeVersion": 1.3,
"position": [
-928,
-304
],
"id": "532d0431-c653-4105-b36f-ecfb87661827",
"name": "Simple Memory"
},
{
"parameters": {
"toolDescription": "This is the tool to do the initial web search to get your content.",
"method": "POST",
"url": "https://api.tavily.com/search",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"sendBody": true,
"bodyParameters": {
"parameters": [
{
"name": "query",
"value": "={{ $json.prompt }}"
},
{
"name": "search_depth",
"value": "advanced"
},
{
"name": "time_range",
"value": "month"
},
{
"name": "include_answer",
"value": "basic"
},
{
"name": "topic",
"value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters4_Value', `the value is one of the following general, news, finance`, 'string') }}"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.httpRequestTool",
"typeVersion": 4.2,
"position": [
-768,
-304
],
"id": "d45b66b8-7316-4bfc-bf5b-1bc9799decc5",
"name": "TavilyWebSearch",
"credentials": {
"httpHeaderAuth": {
"id": "3B2HkngPuiG3WSKZ",
"name": "Tavily"
}
}
},
{
"parameters": {
"jsonSchemaExample": "{\n \"title\": \"<string>\",\n \"content\": \"<string>\",\n \"tags\": [\"<string>\"],\n \"metadata\": {\n \"urls\": [\n \"<string>\"\n ],\n \"images\": [\n \"<string>\"\n ],\n \"files\": [\n \"<string>\"\n ]\n }\n}"
},
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"typeVersion": 1.2,
"position": [
-576,
-304
],
"id": "26aa3600-05ed-48c3-9676-0852f4c132de",
"name": "Structured Output Parser"
},
{
"parameters": {
"tableId": "artifacts",
"fieldsUi": {
"fieldValues": [
{
"fieldId": "chat_id",
"fieldValue": "={{ $('When Executed by Another Workflow').first().json.chat_id }}"
},
{
"fieldId": "content",
"fieldValue": "={{ $json.output.content }}"
},
{
"fieldId": "title",
"fieldValue": "={{ $json.output.title }}"
},
{
"fieldId": "metadata",
"fieldValue": "={{ $json.output.metadata }}"
},
{
"fieldId": "tags",
"fieldValue": "={{ $json.output.tags }}"
},
{
"fieldId": "type",
"fieldValue": "report"
}
]
}
},
"type": "n8n-nodes-base.supabase",
"typeVersion": 1,
"position": [
-528,
-608
],
"id": "7fb0680b-64a4-46ee-8faf-efa4abfc587f",
"name": "Supabase",
"credentials": {
"supabaseApi": {
"id": "AXfAwvIkTMj3vPIr",
"name": "Tools"
}
}
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "3ae403bf-dd19-43f6-ab86-5d83bfa2c406",
"name": "content",
"value": "={{ $json.content }}",
"type": "string"
},
{
"id": "bac897f1-c300-4a17-af0f-339387fe4297",
"name": "tags",
"value": "={{ $json.tags }}",
"type": "array"
},
{
"id": "65171c70-6ed7-45d6-9f26-db1e39200243",
"name": "title",
"value": "={{ $json.title }}",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
-304,
-608
],
"id": "faa510ba-c456-4cc8-8635-825a42893e65",
"name": "Output"
}
],
"pinData": {
"When Executed by Another Workflow": [
{
"json": {
"prompt": "Compare AMD and Intel stocks performance in July 2025, focusing on returns over the year-to-date and historical performance.",
"session_id": "0bc1ad82-77f7-401e-a504-32eeb4e6bd85",
"chat_id": "bfb18b88-d678-448c-b20a-8dbc02995421"
}
}
],
"AI Agent": [
{
"json": {
"output": {
"title": "Comparison of AMD and Intel Stock Performance in July 2025",
"content": "In July 2025, Advanced Micro Devices (AMD) has significantly outperformed Intel in terms of stock performance metrics. AMD's stock has registered a year-to-date gain of approximately 33%, driven by strong financial results and strategic advancements in the AI sector. In the first quarter of 2025, AMD reported a revenue boom of 36% year-over-year, largely attributed to a 57.2% increase in data center revenues. The company's ability to innovate and expand its product offerings has solidified investor confidence, contributing to an impressive historical performance, which includes a total return of 36.02% over the past two years, an annualized return of 16.63%, and a maximum drawdown of just 0.08%. \n\nOn the contrary, Intel's recent performance lacks clarity, as it is yet to release its second-quarter results for 2025, which keeps its current year-to-date performance unclear. As of July 2025, detailed insights into Intel's year-to-date performance were unavailable; however, the anticipation for its upcoming earnings report indicates a cautious approach from investors. While AMD appears to be on a growth trajectory, Intel's uncertain financial footing contrasts sharply with its competitor. Overall, AMD's robust returns and strategic growth in AI highlight its leadership in the semiconductor industry, whereas Intel faces challenges that may affect investor sentiments negatively.",
"tags": [
"AMD",
"Intel",
"Stock Comparison",
"Finance",
"Market Performance"
],
"metadata": {
"urls": [
"https://finance.yahoo.com/quote/AMD/",
"https://www.investopedia.com/dow-jones-today-07082025-11767995",
"https://www.marketscreener.com/quote/stock/INTEL-CORPORATION-4829/news/Intel-to-Report-Second-Quarter-2025-Financial-Results-50406594/"
],
"images": [],
"files": []
}
}
}
}
]
},
"connections": {
"When Executed by Another Workflow": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Simple Memory": {
"ai_memory": [
[
{
"node": "AI Agent",
"type": "ai_memory",
"index": 0
}
]
]
},
"TavilyWebSearch": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Structured Output Parser": {
"ai_outputParser": [
[
{
"node": "AI Agent",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"AI Agent": {
"main": [
[
{
"node": "Supabase",
"type": "main",
"index": 0
}
]
]
},
"Supabase": {
"main": [
[
{
"node": "Output",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "c903d5b4-d004-4d70-9365-7f7d9651104f",
"meta": {
"templateCredsSetupCompleted": true,
"instanceId": "b77b374d91a001765a8bf2832badc1f8fcc5407c99c4c6f3f68d6413d663ef83"
},
"id": "ZhZmac6FcYUunZT4",
"tags": [
{
"createdAt": "2025-02-05T12:12:50.916Z",
"updatedAt": "2025-02-05T12:12:50.916Z",
"id": "kyZZigrc6B4KzuMd",
"name": "youtube"
},
{
"createdAt": "2025-07-16T20:33:12.793Z",
"updatedAt": "2025-07-16T20:33:12.793Z",
"id": "oVmz3tH4fxKLa29j",
"name": "leads-dash"
}
]
}
{
"name": "tool-url-scrape",
"nodes": [
{
"parameters": {
"workflowInputs": {
"values": [
{
"name": "urls",
"type": "array"
},
{
"name": "chat_id"
},
{
"name": "session_id"
}
]
}
},
"type": "n8n-nodes-base.executeWorkflowTrigger",
"typeVersion": 1.1,
"position": [
-224,
-288
],
"id": "c6217b7f-8996-450d-8368-6412b2db2a7e",
"name": "When Executed by Another Workflow"
},
{
"parameters": {
"promptType": "define",
"text": "={{ $json.urls.toJsonString() }}",
"hasOutputParser": true,
"options": {
"systemMessage": "=Date: {{$now}}\n\n\nYour role is to take this urls and use the TavilyScrape tool to get content for them, \n\nand then take those results and really create a artifacts with the data it gives you\n\ncontent - this final output should be markdown\n\n\n## FORMAT JSON\n[\n {\n \"title\": \"<string>\",\n \"content\": \"<string>\",\n \"tags\": [\"<string>\"],\n \"metadata\": {\n \"urls\": [\n \"<string>\"\n ],\n \"images\": [\n \"<string>\"\n ],\n \"files\": [\n \"<string>\"\n ]\n }\n},\n {\n \"title\": \"<string>\",\n \"content\": \"<string>\",\n \"tags\": [\"<string>\"],\n \"metadata\": {\n \"urls\": [\n \"<string>\"\n ],\n \"images\": [\n \"<string>\"\n ],\n \"files\": [\n \"<string>\"\n ]\n }\n}\n]"
}
},
"type": "@n8n/n8n-nodes-langchain.agent",
"typeVersion": 1.9,
"position": [
48,
-288
],
"id": "238dafa2-7d78-41d7-8a06-d5f91de659ad",
"name": "AI Agent",
"retryOnFail": true
},
{
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini"
},
"options": {
"responseFormat": "json_object"
}
},
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"typeVersion": 1.2,
"position": [
-160,
112
],
"id": "3c0c8fd0-9cb5-42a0-9dee-471097c225f0",
"name": "OpenAI Chat Model",
"credentials": {
"openAiApi": {
"id": "v5lKgV7PDt0H77GQ",
"name": "Toolbot Token"
}
}
},
{
"parameters": {
"jsonSchemaExample": "[\n {\n \"title\": \"<string>\",\n \"content\": \"<string>\",\n \"tags\": [\"<string>\"],\n \"metadata\": {\n \"urls\": [\n \"<string>\"\n ],\n \"images\": [\n \"<string>\"\n ],\n \"files\": [\n \"<string>\"\n ]\n }\n},\n {\n \"title\": \"<string>\",\n \"content\": \"<string>\",\n \"tags\": [\"<string>\"],\n \"metadata\": {\n \"urls\": [\n \"<string>\"\n ],\n \"images\": [\n \"<string>\"\n ],\n \"files\": [\n \"<string>\"\n ]\n }\n}\n]"
},
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"typeVersion": 1.2,
"position": [
384,
112
],
"id": "f7de8032-da44-4611-a78d-13987375bf40",
"name": "Structured Output Parser"
},
{
"parameters": {
"tableId": "artifacts",
"fieldsUi": {
"fieldValues": [
{
"fieldId": "chat_id",
"fieldValue": "={{ $('When Executed by Another Workflow').first().json.chat_id }}"
},
{
"fieldId": "content",
"fieldValue": "={{ $json.content }}"
},
{
"fieldId": "title",
"fieldValue": "={{ $json.title }}"
},
{
"fieldId": "metadata",
"fieldValue": "={{ $json.metadata }}"
},
{
"fieldId": "tags",
"fieldValue": "={{ $json.tags }}"
},
{
"fieldId": "type",
"fieldValue": "url"
}
]
}
},
"type": "n8n-nodes-base.supabase",
"typeVersion": 1,
"position": [
672,
-16
],
"id": "4e558747-bb7f-40f9-99da-2919ec53e85b",
"name": "Supabase1",
"credentials": {
"supabaseApi": {
"id": "AXfAwvIkTMj3vPIr",
"name": "Tools"
}
}
},
{
"parameters": {
"fieldToSplitOut": "output",
"options": {}
},
"type": "n8n-nodes-base.splitOut",
"typeVersion": 1,
"position": [
400,
-288
],
"id": "8f666d18-ea36-4cba-99e6-404f5c780ced",
"name": "Split Out"
},
{
"parameters": {
"options": {}
},
"type": "n8n-nodes-base.splitInBatches",
"typeVersion": 3,
"position": [
624,
-288
],
"id": "8381f727-e4a4-495b-ad91-ae290d826068",
"name": "Loop Over Items"
},
{
"parameters": {
"aggregate": "aggregateAllItemData",
"options": {}
},
"type": "n8n-nodes-base.aggregate",
"typeVersion": 1,
"position": [
864,
-304
],
"id": "5b539b07-aa41-4c26-aab5-5b3e65d783c9",
"name": "Aggregate"
},
{
"parameters": {
"sessionIdType": "customKey",
"sessionKey": "={{ $json.session_id }}"
},
"type": "@n8n/n8n-nodes-langchain.memoryPostgresChat",
"typeVersion": 1.3,
"position": [
32,
80
],
"id": "ccdf02e5-9645-4d68-9553-8dbff4a0d2f9",
"name": "Postgres Chat Memory",
"credentials": {
"postgres": {
"id": "E57OxB5DnI1nKYhP",
"name": "WhatCanWeWatchTogether"
}
}
},
{
"parameters": {
"toolDescription": "Passing in an array or URLs you will get back data and other info from the services",
"method": "POST",
"url": "https://api.tavily.com/extract",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={\n \"urls\": {{$('When Executed by Another Workflow').first().json.urls.toJsonString()}},\n \"extract_depth\": \"advanced\",\n \"include_images\": true\n} ",
"options": {}
},
"type": "n8n-nodes-base.httpRequestTool",
"typeVersion": 4.2,
"position": [
208,
112
],
"id": "0832e965-c75f-4b6e-bcbe-8026a6efdc42",
"name": "TavilyScrape",
"credentials": {
"httpHeaderAuth": {
"id": "3B2HkngPuiG3WSKZ",
"name": "Tavily"
}
}
}
],
"pinData": {
"When Executed by Another Workflow": [
{
"json": {
"urls": [
"https://simplerecipes.io/recipes/77",
"https://simplerecipes.io/recipes/76"
],
"chat_id": "d4b818bc-9117-4843-beda-c6de702d2b3d",
"session_id": "d4b818bc-9117-4843-beda-c6de702d2b3d"
}
}
]
},
"connections": {
"When Executed by Another Workflow": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"AI Agent": {
"main": [
[
{
"node": "Split Out",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Structured Output Parser": {
"ai_outputParser": [
[
{
"node": "AI Agent",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"Supabase1": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Split Out": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Loop Over Items": {
"main": [
[
{
"node": "Aggregate",
"type": "main",
"index": 0
}
],
[
{
"node": "Supabase1",
"type": "main",
"index": 0
}
]
]
},
"Postgres Chat Memory": {
"ai_memory": [
[
{
"node": "AI Agent",
"type": "ai_memory",
"index": 0
}
]
]
},
"TavilyScrape": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "024f1510-2426-4e5d-8d58-6d50eeb22706",
"meta": {
"templateCredsSetupCompleted": true,
"instanceId": "b77b374d91a001765a8bf2832badc1f8fcc5407c99c4c6f3f68d6413d663ef83"
},
"id": "FxqXTwoZUyzQp2gf",
"tags": [
{
"createdAt": "2025-07-17T21:13:43.444Z",
"updatedAt": "2025-07-17T21:13:43.444Z",
"id": "jWjH17nzIMTP6Uu3",
"name": "lead-dash"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment