Describe the problem/error/question
I have a workflow that uses the AIAgent node to analyse data in a Google sheet. I use gpt-5.2 as AI. The question I ask is : Ccount the number of rows where username is “hogeschool_vhl” and the Date is not empty. I have two scenario’s : One i which i directly put this prompt into the node. The other scenario is where I read exactly the same prompt from another sheet and place that prompt into the prompt field of the AIAgent node. The same dataset used in both scenarios. Both scenario’s not only come up with the wrong number, but both numbers are alo wrong. What bothers me now is how come a same numerical question on the same dataset, results in a different answer. if I know how I can also post two screenshots showing the same prompt and a different answer.
What is the error message (if any)?
Please share your workflow
(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)
{
"nodes": [
{
"parameters": {
"promptType": "define",
"text": "={{ $json.Prompt }}",
"options": {
"systemMessage": "You are a helpful AI assistant . Provide clear, concise, and friendly responses in English. If asked for a number, only respond with the number.\nThe dataset to be used is in set: Sheet1 from the Google sheet: Instagram_Posts.\nThe dataset is the result of scraping of Instagram account executed by Bright Data.\nThis is the data in the file:\nUsername : this is the username/ account name of the instagram poster\nDate : this is the date of the post\nPost: this is the actual post\nLikes : the number of likes the post has received\nNr comments: this is the number of comments made on the post\n\nIf the number of comments is larger than 0, in that case additional rows are added with fields:\nUsername: the username/ account to which a comment is made\nDate :Kept empty\nPost: Kept empty\nLikes : Kept empty\nNr comments:Kept empty\nuser_commenting: the username/ account that made a comment\nLikes_of_Comments: the number of likes of that comment.\n"
}
},
"id": "4d6caf91-1ef4-494e-9491-d5dc37548cd7",
"name": "AI Agent1",
"type": "@n8n/n8n-nodes-langchain.agent",
"typeVersion": 3.1,
"position": [
128,
-64
]
},
{
"parameters": {
"model": {
"__rl": true,
"value": "gpt-5.2",
"mode": "list",
"cachedResultName": "gpt-5.2"
},
"builtInTools": {},
"options": {
"timeout": 120000
}
},
"id": "f861a7f8-5b2a-41ae-bde8-f7f3ab6d94fe",
"name": "OpenAI Chat Model1",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"typeVersion": 1.3,
"position": [
16,
176
],
"credentials": {
"openAiApi": {
"id": "U16ZdfkT0Wm1cRyo",
"name": "OpenAi account"
}
}
},
{
"parameters": {
"documentId": {
"__rl": true,
"value": "1MRzwapyMZMG0vnGoMx4fanRwfV-xtL5W9xunCuhdjwg",
"mode": "list",
"cachedResultName": "Instagram_Posts",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1MRzwapyMZMG0vnGoMx4fanRwfV-xtL5W9xunCuhdjwg/edit?usp=drivesdk"
},
"sheetName": {
"__rl": true,
"value": "gid=0",
"mode": "list",
"cachedResultName": "Sheet1",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1MRzwapyMZMG0vnGoMx4fanRwfV-xtL5W9xunCuhdjwg/edit#gid=0"
},
"options": {}
},
"type": "n8n-nodes-base.googleSheetsTool",
"typeVersion": 4.7,
"position": [
320,
192
],
"id": "e0dd802d-396f-461b-81c9-9daf6e20b314",
"name": "Get row(s) in sheet in Google Sheets",
"credentials": {
"googleSheetsOAuth2Api": {
"id": "i5ZDOao1fR8d2f3v",
"name": "Google Sheets account"
}
}
},
{
"parameters": {},
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [
-432,
-64
],
"id": "94aa7517-c7e4-4e57-8383-e5733ddcb03c",
"name": "When clicking ‘Execute workflow’"
},
{
"parameters": {
"documentId": {
"__rl": true,
"value": "1MRzwapyMZMG0vnGoMx4fanRwfV-xtL5W9xunCuhdjwg",
"mode": "list",
"cachedResultName": "Instagram_Posts",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1MRzwapyMZMG0vnGoMx4fanRwfV-xtL5W9xunCuhdjwg/edit?usp=drivesdk"
},
"sheetName": {
"__rl": true,
"value": 53746632,
"mode": "list",
"cachedResultName": "AI Analysis",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1MRzwapyMZMG0vnGoMx4fanRwfV-xtL5W9xunCuhdjwg/edit#gid=53746632"
},
"filtersUI": {
"values": [
{
"lookupColumn": "Include",
"lookupValue": "1"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4.7,
"position": [
-192,
-64
],
"id": "3fe968af-34e5-46b6-a61b-7f005cb36260",
"name": "Get row(s) in sheet",
"credentials": {
"googleSheetsOAuth2Api": {
"id": "i5ZDOao1fR8d2f3v",
"name": "Google Sheets account"
}
}
},
{
"parameters": {
"operation": "update",
"documentId": {
"__rl": true,
"value": "1MRzwapyMZMG0vnGoMx4fanRwfV-xtL5W9xunCuhdjwg",
"mode": "list",
"cachedResultName": "Instagram_Posts",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1MRzwapyMZMG0vnGoMx4fanRwfV-xtL5W9xunCuhdjwg/edit?usp=drivesdk"
},
"sheetName": {
"__rl": true,
"value": 53746632,
"mode": "list",
"cachedResultName": "AI Analysis",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1MRzwapyMZMG0vnGoMx4fanRwfV-xtL5W9xunCuhdjwg/edit#gid=53746632"
},
"columns": {
"mappingMode": "defineBelow",
"value": {
"row_number": "={{ $('Get row(s) in sheet').item.json.row_number }}",
"Include": "0",
"Date modified/added": "={{ $now }}",
"Result": "={{ $json.output }}"
},
"matchingColumns": [
"row_number"
],
"schema": [
{
"id": "Include",
"displayName": "Include",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Date modified/added",
"displayName": "Date modified/added",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Prompt",
"displayName": "Prompt",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": true
},
{
"id": "Result",
"displayName": "Result",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "row_number",
"displayName": "row_number",
"required": false,
"defaultMatch": false,
"display": true,
"type": "number",
"canBeUsedToMatch": true,
"readOnly": true,
"removed": false
}
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {}
},
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4.7,
"position": [
480,
-64
],
"id": "b0559cb9-51db-4e6a-8b4f-bffa394eb97e",
"name": "Update row in sheet",
"credentials": {
"googleSheetsOAuth2Api": {
"id": "i5ZDOao1fR8d2f3v",
"name": "Google Sheets account"
}
}
}
],
"connections": {
"AI Agent1": {
"main": [
[
{
"node": "Update row in sheet",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model1": {
"ai_languageModel": [
[
{
"node": "AI Agent1",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Get row(s) in sheet in Google Sheets": {
"ai_tool": [
[
{
"node": "AI Agent1",
"type": "ai_tool",
"index": 0
}
]
]
},
"When clicking ‘Execute workflow’": {
"main": [
[
{
"node": "Get row(s) in sheet",
"type": "main",
"index": 0
}
]
]
},
"Get row(s) in sheet": {
"main": [
[
{
"node": "AI Agent1",
"type": "main",
"index": 0
}
]
]
}
},
"pinData": {},
"meta": {
"templateCredsSetupCompleted": true,
"instanceId": "a256caaf927d8b6fecd66012f15459060ec2fca55c23cb3757c0092517d4e8b9"
}
}
Share the output returned by the last node
Information on your n8n setup
- n8n version:
- Database (default: SQLite):
- n8n EXECUTIONS_PROCESS setting (default: own, main):
- Running n8n via (Docker, npm, n8n cloud, desktop app):
- Operating system: