Skip to content

Instantly share code, notes, and snippets.

@kasir-barati
Last active August 7, 2026 15:39
Show Gist options
  • Select an option

  • Save kasir-barati/cd7b3bd68ea6382e911ad097da344d47 to your computer and use it in GitHub Desktop.

Select an option

Save kasir-barati/cd7b3bd68ea6382e911ad097da344d47 to your computer and use it in GitHub Desktop.
Limitations of n8n AI Agents & Tools
{
"name": "Stock Portfolio Agent",
"nodes": [
{
"parameters": {
"rule": {
"interval": [
{
"field": "cronExpression",
"expression": "0 12 * * 1-5"
}
]
}
},
"type": "n8n-nodes-base.scheduleTrigger",
"typeVersion": 1.3,
"position": [
1040,
-192
],
"id": "c1166761-6f3b-4268-8559-cc13ecd2fee6",
"name": "Schedule Trigger1"
},
{
"parameters": {
"jsCode": "// Extract headers from first row of shares data\nconst firstRow = items[0].json;\nconst headers = Object.keys(firstRow).filter(k => \n !k.startsWith('n8n-') && k !== 'row_number'\n);\n\nreturn [{\n json: {\n headers,\n portfolioData: items.map(i => i.json),\n sheetName: 'shares'\n }\n}];"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1264,
-192
],
"id": "4bcbafa3-15ee-4374-96aa-c3ad675833db",
"name": "Extract Headers"
},
{
"parameters": {
"operation": "create",
"documentId": {
"__rl": true,
"value": "1dYZQzF6VPY9X47VCywv4MT1Wo9OpT39vhSBvpNn_Mbc",
"mode": "list",
"cachedResultName": "stock-portfolio",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1dYZQzF6VPY9X47VCywv4MT1Wo9OpT39vhSBvpNn_Mbc/edit?usp=drivesdk"
},
"title": "={{ DateTime.now().format('yyyy.MM.dd') }}",
"options": {}
},
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4.7,
"position": [
1264,
32
],
"id": "e8b461d5-70b5-4d75-ba30-723c6aafbda9",
"name": "Create sheet",
"credentials": {
"googleSheetsOAuth2Api": {
"id": "b7aCwM5d7t0oTzxp",
"name": "Google Sheets account"
}
}
},
{
"parameters": {
"promptType": "define",
"text": "I have created a new sheet for current date, it is just a duplicate of active portfolio. Thus you MUST:\n\n1. Get the stock price for my portfolio.\n2. Update the price of each stock for that day.\n2. Ensure the portfolio is 60% equity and 40% fixed income. If it is NOT update the current date's sheet.\n\nIMPORTANT:\n- Check the new sheet and make sure the rebalancing objective was achieved. For this you must compare the current date's sheet to the active portfolio sheet.\n- If you find any issue with rebalancing, update today's sheet to meet the objective.\n\nThen send a nice, neat plain text formatted email to node.js.developers.kh@gmail.com explaining the new rebalanced changes. Keep it short, and concise. Also add a direct link to the current date's sheet in the email or if you cannot figure out the link just add its title. Do NOT write \"Best regards, [Your Name]\".",
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.agent",
"typeVersion": 3.1,
"position": [
1712,
32
],
"id": "b5f4a73c-8e0b-41fc-9e68-cedabd1a7e47",
"name": "AI Agent"
},
{
"parameters": {
"model": {
"__rl": true,
"value": "gpt-4o-mini",
"mode": "list",
"cachedResultName": "gpt-4o-mini"
},
"builtInTools": {},
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"typeVersion": 1.3,
"position": [
1712,
208
],
"id": "61633d77-df1c-428c-96f0-7905b6ea80d4",
"name": "OpenAI Chat Model",
"credentials": {
"openAiApi": {
"id": "0h4kMjpTValhfJZv",
"name": "OpenAI account"
}
}
},
{
"parameters": {
"sessionIdType": "customKey",
"sessionKey": "={{ $('Schedule Trigger1').item.json.timestamp }}"
},
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"typeVersion": 1.4,
"position": [
1808,
352
],
"id": "7fbc0504-a316-4110-85e0-8550db211627",
"name": "Simple Memory"
},
{
"parameters": {
"options": {}
},
"type": "n8n-nodes-base.dateTimeTool",
"typeVersion": 2,
"position": [
1856,
480
],
"id": "81aeed14-e371-42ad-b667-59f44c425ad3",
"name": "Date & Time"
},
{
"parameters": {
"documentId": {
"__rl": true,
"value": "1dYZQzF6VPY9X47VCywv4MT1Wo9OpT39vhSBvpNn_Mbc",
"mode": "list",
"cachedResultName": "stock-portfolio",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1dYZQzF6VPY9X47VCywv4MT1Wo9OpT39vhSBvpNn_Mbc/edit?usp=drivesdk"
},
"sheetName": {
"__rl": true,
"value": "={{ $('Create sheet').item.json.title }}",
"mode": "name"
},
"options": {}
},
"type": "n8n-nodes-base.googleSheetsTool",
"typeVersion": 4.7,
"position": [
2096,
416
],
"id": "82d21eac-a669-4c8c-8b58-ce1b9e90341f",
"name": "Get current date's sheet",
"credentials": {
"googleSheetsOAuth2Api": {
"id": "b7aCwM5d7t0oTzxp",
"name": "Google Sheets account"
}
}
},
{
"parameters": {
"jsCode": "// Prepare header row for new sheet\nconst extractHeaderOutput = $('Extract Headers').first().json\n\nconst rows = extractHeaderOutput.portfolioData.map((row) => {\n const keys = Object.keys(row);\n const values = Object.values(row);\n // [{ \"row_number\": 2 }, { \"stock\": \"GOOGL\" }, ...]\n const listOfKeyValues = keys.map((key, index) => ({\n [String(key)]: values[index]\n }));\n // [{ \"row_number\": 2, \"stock\": \"GOOGL\", ... }]\n const result = Object.assign({}, ...listOfKeyValues);\n\n return result;\n})\n\n\nreturn rows.map(row => ({ json: row }));"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1488,
-192
],
"id": "ec22222c-b45e-4450-a7b8-958cffd9c3b3",
"name": "Duplicate sheet"
},
{
"parameters": {
"documentId": {
"__rl": true,
"value": "1dYZQzF6VPY9X47VCywv4MT1Wo9OpT39vhSBvpNn_Mbc",
"mode": "list",
"cachedResultName": "stock-portfolio",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1dYZQzF6VPY9X47VCywv4MT1Wo9OpT39vhSBvpNn_Mbc/edit?usp=drivesdk"
},
"sheetName": {
"__rl": true,
"value": "gid=0",
"mode": "list",
"cachedResultName": "shares",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1dYZQzF6VPY9X47VCywv4MT1Wo9OpT39vhSBvpNn_Mbc/edit#gid=0"
},
"options": {}
},
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4.7,
"position": [
1056,
32
],
"id": "55579d29-70fe-40dd-a8e1-f5fb04599969",
"name": "Get shares sheet",
"credentials": {
"googleSheetsOAuth2Api": {
"id": "b7aCwM5d7t0oTzxp",
"name": "Google Sheets account"
}
}
},
{
"parameters": {
"documentId": {
"__rl": true,
"value": "1dYZQzF6VPY9X47VCywv4MT1Wo9OpT39vhSBvpNn_Mbc",
"mode": "list",
"cachedResultName": "stock-portfolio",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1dYZQzF6VPY9X47VCywv4MT1Wo9OpT39vhSBvpNn_Mbc/edit?usp=drivesdk"
},
"sheetName": {
"__rl": true,
"value": "={{ $('Extract Headers').item.json.sheetName }}",
"mode": "name"
},
"options": {}
},
"type": "n8n-nodes-base.googleSheetsTool",
"typeVersion": 4.7,
"position": [
1968,
464
],
"id": "6cd4c0ac-2975-4f30-8995-6f2cd46fd113",
"name": "Get active portfolio",
"credentials": {
"googleSheetsOAuth2Api": {
"id": "b7aCwM5d7t0oTzxp",
"name": "Google Sheets account"
}
}
},
{
"parameters": {
"operation": "update",
"documentId": {
"__rl": true,
"value": "1dYZQzF6VPY9X47VCywv4MT1Wo9OpT39vhSBvpNn_Mbc",
"mode": "list",
"cachedResultName": "stock-portfolio",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1dYZQzF6VPY9X47VCywv4MT1Wo9OpT39vhSBvpNn_Mbc/edit?usp=drivesdk"
},
"sheetName": {
"__rl": true,
"mode": "name",
"value": "={{ $('Create sheet').item.json.title }}"
},
"columns": {
"mappingMode": "defineBelow",
"value": {
"timestamp": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('timestamp', ``, 'string') }}",
"equity ratio": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('equity_ratio', ``, 'string') }}",
"fixed income ratio": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('fixed_income_ratio', ``, 'string') }}",
"price": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('price', ``, 'string') }}",
"toolCallId": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('toolCallId', ``, 'string') }}",
"stock": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('stock__using_to_match_', ``, 'string') }}"
},
"matchingColumns": [
"stock"
],
"schema": [
{
"id": "timestamp",
"displayName": "timestamp",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "stock",
"displayName": "stock",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "quantity",
"displayName": "quantity",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": true
},
{
"id": "equity ratio",
"displayName": "equity ratio",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "fixed income ratio",
"displayName": "fixed income ratio",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "price",
"displayName": "price",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "toolCallId",
"displayName": "toolCallId",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "id",
"displayName": "id",
"required": false,
"defaultMatch": true,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": true
},
{
"id": "row_number",
"displayName": "row_number",
"required": false,
"defaultMatch": false,
"display": true,
"type": "number",
"canBeUsedToMatch": true,
"readOnly": true,
"removed": true
}
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {}
},
"type": "n8n-nodes-base.googleSheetsTool",
"typeVersion": 4.7,
"position": [
2336,
288
],
"id": "f7209bfd-29b3-47ac-b232-8bcea86e4aa3",
"name": "Update current date's sheet",
"credentials": {
"googleSheetsOAuth2Api": {
"id": "b7aCwM5d7t0oTzxp",
"name": "Google Sheets account"
}
}
},
{
"parameters": {
"symbols": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Ticker', ``, 'string') }}",
"filters": {
"latest": true
}
},
"type": "n8n-nodes-base.marketstackTool",
"typeVersion": 1,
"position": [
2224,
352
],
"id": "fe6b7e81-86a3-4d6d-9a2d-d2cecfb195e6",
"name": "Get many EoD stock price",
"credentials": {
"marketstackApi": {
"id": "uykspUJ9pFnekPFQ",
"name": "Marketstack account"
}
}
},
{
"parameters": {
"sendTo": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('To', ``, 'string') }}",
"subject": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Subject', ``, 'string') }}",
"emailType": "text",
"message": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Message', ``, 'string') }}",
"options": {}
},
"type": "n8n-nodes-base.gmailTool",
"typeVersion": 2.2,
"position": [
2464,
240
],
"id": "ba4a561f-5d9b-47ee-9e2f-109f0ef7bbb4",
"name": "Send a message in Gmail",
"webhookId": "c148dc83-95f2-46e3-8bdc-5ca8d675ee20",
"credentials": {
"gmailOAuth2": {
"id": "XrOrzOjj0JityTJB",
"name": "Gmail account"
}
}
},
{
"parameters": {
"operation": "append",
"documentId": {
"__rl": true,
"value": "1dYZQzF6VPY9X47VCywv4MT1Wo9OpT39vhSBvpNn_Mbc",
"mode": "list",
"cachedResultName": "stock-portfolio",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1dYZQzF6VPY9X47VCywv4MT1Wo9OpT39vhSBvpNn_Mbc/edit?usp=drivesdk"
},
"sheetName": {
"__rl": true,
"value": "={{ $('Create sheet').item.json.title }}",
"mode": "name"
},
"columns": {
"mappingMode": "autoMapInputData",
"value": {},
"matchingColumns": [],
"schema": [
{
"id": "timestamp",
"displayName": "timestamp",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "stock",
"displayName": "stock",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "quantity",
"displayName": "quantity",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "equity ratio",
"displayName": "equity ratio",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "fixed income ratio",
"displayName": "fixed income ratio",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "price",
"displayName": "price",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
}
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {}
},
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4.7,
"position": [
1488,
32
],
"id": "21fc3209-023d-4b5e-8852-fcc32a9686bd",
"name": "Dupplicate sheet",
"credentials": {
"googleSheetsOAuth2Api": {
"id": "b7aCwM5d7t0oTzxp",
"name": "Google Sheets account"
}
}
},
{
"parameters": {
"content": "## Issues\n\n1. The LLM cannot update the Google Sheet when you pick **Map Automatically** option in the \"Update current date's sheet\" tool!\n2. The gpt-4.1 is way too SLOW.\n\n## TODO\n\nTest it again, I changed the \"Update current date's sheet\" tool from **Map Automatically** to **Map Each Column Manually**.",
"height": 272,
"width": 704,
"color": 2
},
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
1664,
-272
],
"id": "f726bbee-2d65-48e7-a240-9bcf0317e986",
"name": "Sticky Note"
}
],
"pinData": {},
"connections": {
"Schedule Trigger1": {
"main": [
[
{
"node": "Get shares sheet",
"type": "main",
"index": 0
}
]
]
},
"Extract Headers": {
"main": [
[
{
"node": "Create sheet",
"type": "main",
"index": 0
}
]
]
},
"Create sheet": {
"main": [
[
{
"node": "Duplicate sheet",
"type": "main",
"index": 0
}
]
]
},
"AI Agent": {
"main": [
[]
]
},
"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
}
]
]
},
"Date & Time": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Get current date's sheet": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Duplicate sheet": {
"main": [
[
{
"node": "Dupplicate sheet",
"type": "main",
"index": 0
}
]
]
},
"Get shares sheet": {
"main": [
[
{
"node": "Extract Headers",
"type": "main",
"index": 0
}
]
]
},
"Get active portfolio": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Update current date's sheet": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Get many EoD stock price": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Send a message in Gmail": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Dupplicate sheet": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1",
"binaryMode": "separate",
"availableInMCP": false
},
"versionId": "ec1a193f-fa49-424f-a91a-71aa335fa0e2",
"meta": {
"templateCredsSetupCompleted": true,
"instanceId": "d7f40ac67c918c6b77c1db2f31baa37e504a493b4a22e372f2a513b7bf0ca5a9"
},
"nodeGroups": [],
"id": "6bsOs8ssUv4uxhna",
"tags": []
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment