This workflow corresponds to n8n.io template #17516 — 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 →
{
"id": "Ms5auD9favHXCJoD",
"meta": {
"builderVariant": "mcp",
"aiBuilderAssisted": true
},
"name": "Chat with an AI research assistant that looks things up before answering",
"tags": [],
"nodes": [
{
"id": "0062cc3a-ac62-4cc9-9cde-6a1271ce5e04",
"name": "Chat Message Received",
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"position": [
48,
48
],
"parameters": {
"public": true,
"options": {
"title": "Ask & Explain",
"subtitle": "Your AI research buddy",
"responseMode": "streaming",
"inputPlaceholder": "Ask me anything..."
},
"initialMessages": "Hi! Ask me anything and I will look it up and explain it simply."
},
"typeVersion": 1.4
},
{
"id": "122afbee-f4c3-467b-ba17-c6f8a78fac1f",
"name": "Research Assistant Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
368,
48
],
"parameters": {
"text": "={{ $json.chatInput }}",
"options": {
"systemMessage": "You are a friendly research assistant. Use the Wikipedia tool to check facts before answering, and the Calculator for any arithmetic. Explain things simply, in plain language, and cite what you looked up. If you are unsure, say so."
},
"promptType": "define"
},
"typeVersion": 3.1
},
{
"id": "cad11b15-0fc9-4b2e-96d8-4663b19c0fb4",
"name": "Agent Model",
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"position": [
288,
304
],
"parameters": {
"options": {
"temperature": 0.3
},
"modelName": "models/gemini-3.1-flash-lite"
},
"credentials": {
"googlePalmApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.1
},
{
"id": "ac43beec-c570-43cd-8448-1f6deefdce84",
"name": "Conversation Memory",
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"position": [
448,
304
],
"parameters": {
"contextWindowLength": 10
},
"typeVersion": 1.4
},
{
"id": "6c3a556c-3ea8-4c05-9fd0-a6e9487d63ff",
"name": "Wikipedia",
"type": "@n8n/n8n-nodes-langchain.toolWikipedia",
"position": [
608,
304
],
"parameters": {},
"typeVersion": 1
},
{
"id": "06b26f5e-0f21-487f-9f94-d49aed111930",
"name": "Calculator",
"type": "@n8n/n8n-nodes-langchain.toolCalculator",
"position": [
768,
304
],
"parameters": {},
"typeVersion": 1
},
{
"id": "705b813f-ea3a-4f22-86bc-0e3ae805877d",
"name": "Tag Question Topic",
"type": "@n8n/n8n-nodes-langchain.chainLlm",
"position": [
368,
608
],
"parameters": {
"text": "=Reply with only a 1-3 word topic label for this question, nothing else: {{ $json.chatInput }}",
"batching": {},
"promptType": "define"
},
"typeVersion": 1.9
},
{
"id": "c593c751-d2dd-4287-aec5-db539ff014e0",
"name": "Topic Tagger Model",
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"position": [
304,
768
],
"parameters": {
"options": {
"temperature": 0
},
"modelName": "models/gemini-3.1-flash-lite"
},
"credentials": {
"googlePalmApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.1
},
{
"id": "0dc97ccf-9c84-4d4d-a21e-a570397adfbc",
"name": "Log Question",
"type": "n8n-nodes-base.googleSheets",
"position": [
672,
608
],
"parameters": {
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "list",
"value": "",
"cachedResultName": "Questions"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "",
"cachedResultName": "Select your spreadsheet"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.7
},
{
"id": "16372ae6-c598-4e26-84c1-c876d68062a7",
"name": "Overview Sticky",
"type": "n8n-nodes-base.stickyNote",
"position": [
-464,
-128
],
"parameters": {
"width": 440,
"height": 760,
"content": "## Chat with an AI research assistant that looks things up before answering\n\n### How it works\nThis is a proper AI Agent, not a one-shot prompt. Open the built-in chat and ask anything - the AI Agent, powered by Google Gemini, decides on its own whether to look the topic up in Wikipedia and whether to use the calculator, then answers in plain language and remembers the conversation through a Simple Memory window so follow-up questions work. In parallel, a Basic LLM Chain tags every question with a short topic and logs it to Google Sheets, so you can see what people actually ask. The agent streams its reply straight to the chat widget while the logging happens on a separate branch.\n\n### Setup\n1. Connect Google Gemini (PaLM) API and Google Sheets.\n2. Point the Log Question node at your spreadsheet (tab: Questions).\n3. Open the chat URL and start asking questions.\n\n### Customization tips\nAdd more tools such as an HTTP Request tool or a Google Sheets tool, or swap the chat for Telegram or Slack."
},
"typeVersion": 1
},
{
"id": "02a1e257-0096-4d3b-8589-c35f11c331a6",
"name": "S1",
"type": "n8n-nodes-base.stickyNote",
"position": [
0,
-128
],
"parameters": {
"color": 7,
"width": 924,
"height": 564,
"content": "## 1. AI Agent (with memory & tools)\nThe Agent chooses when to use the Wikipedia and Calculator tools and remembers the conversation. It streams its reply to the chat widget."
},
"typeVersion": 1
},
{
"id": "e68ae68c-d423-4cf4-8261-535ebc2486cb",
"name": "S2",
"type": "n8n-nodes-base.stickyNote",
"position": [
0,
448
],
"parameters": {
"color": 7,
"width": 924,
"height": 444,
"content": "## 2. Parallel logging (Basic LLM Chain)\nOn a separate branch, a Basic LLM Chain tags each question with a topic and appends it to Google Sheets - side effects never block the chat reply."
},
"typeVersion": 1
}
],
"active": false,
"settings": {
"binaryMode": "separate",
"availableInMCP": true,
"executionOrder": "v1"
},
"versionId": "54773b7b-376d-45b6-9e7b-a4141a552477",
"nodeGroups": [],
"connections": {
"Wikipedia": {
"ai_tool": [
[
{
"node": "Research Assistant Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Calculator": {
"ai_tool": [
[
{
"node": "Research Assistant Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Agent Model": {
"ai_languageModel": [
[
{
"node": "Research Assistant Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Tag Question Topic": {
"main": [
[
{
"node": "Log Question",
"type": "main",
"index": 0
}
]
]
},
"Topic Tagger Model": {
"ai_languageModel": [
[
{
"node": "Tag Question Topic",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Conversation Memory": {
"ai_memory": [
[
{
"node": "Research Assistant Agent",
"type": "ai_memory",
"index": 0
}
]
]
},
"Chat Message Received": {
"main": [
[
{
"node": "Research Assistant Agent",
"type": "main",
"index": 0
},
{
"node": "Tag Question Topic",
"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.
googlePalmApigoogleSheetsOAuth2Api
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
This workflow provides a chat-based research assistant powered by Google Gemini that can look up facts on Wikipedia, do calculations, and remember context, while also tagging each user question and logging it to a Google Sheets spreadsheet. Receives a user message through the…
Source: https://n8n.io/workflows/17516/ — 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 workflow is designed for growth agencies, SaaS founders, and sales teams who want to move beyond static lead forms. It is ideal for those who need a "living" system that not only captures leads b
teste. Uses chatTrigger, agent, lmChatGroq, memoryBufferWindow. Chat trigger; 24 nodes.
pix-zap. Uses chatTrigger, agent, toolCalculator, toolWikipedia. Chat trigger; 21 nodes.
curso-orig. Uses chatTrigger, agent, lmChatGroq, memoryBufferWindow. Chat trigger; 21 nodes.
✨ Intro This workflow shows how to go beyond a “plain” AI chatbot by: