A LangChain agent in n8n that takes a research question via webhook, uses a web search tool to gather sources, and synthesizes a concise cited brief. Drop-in research assistant you can call from anywhere.
{
"name": "AI Research Agent",
"nodes": [
{
"id": "ra01aa",
"name": "Question Webhook",
"type": "n8n-nodes-base.webhook",
"typeVersion": 2,
"position": [
200,
300
],
"parameters": {
"httpMethod": "POST",
"path": "research",
"responseMode": "responseNode"
}
},
{
"id": "ra02bb",
"name": "Research Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"typeVersion": 1.7,
"position": [
440,
300
],
"parameters": {
"promptType": "define",
"text": "={{ $json.body.question }}",
"options": {
"systemMessage": "You are a research assistant. Use the search tool to find sources, then write a concise brief with inline citations."
}
}
},
{
"id": "ra03cc",
"name": "Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"typeVersion": 1,
"position": [
380,
480
],
"parameters": {
"model": "gpt-4o"
}
},
{
"id": "ra04dd",
"name": "Web Search Tool",
"type": "@n8n/n8n-nodes-langchain.toolSerpApi",
"typeVersion": 1,
"position": [
520,
480
],
"parameters": {}
},
{
"id": "ra05ee",
"name": "Respond",
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1.1,
"position": [
700,
300
],
"parameters": {
"respondWith": "json",
"responseBody": "={{ { \"brief\": $json.output } }}"
}
}
],
"connections": {
"Question Webhook": {
"main": [
[
{
"node": "Research Agent",
"type": "main",
"index": 0
}
]
]
},
"Chat Model": {
"ai_languageModel": [
[
{
"node": "Research Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Web Search Tool": {
"ai_tool": [
[
{
"node": "Research Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Research Agent": {
"main": [
[
{
"node": "Respond",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {},
"meta": {}
}