This workflow corresponds to n8n.io template #13152 — we link there as the canonical source.
This workflow follows the Chainllm → Chat Trigger 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": "aeLHF60nDK44X0Qg",
"meta": {
"templateCredsSetupCompleted": true
},
"name": "Gamify fitness tracking with AI multi-agents and Google Sheets",
"tags": [],
"nodes": [
{
"id": "6dddaa54-8c31-4f0c-957f-0ec667467054",
"name": "When chat message received",
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"position": [
-2096,
320
],
"parameters": {
"options": {}
},
"typeVersion": 1.4
},
{
"id": "376adaf9-f32b-4340-ace6-2adca92777db",
"name": "OpenRouter Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
"position": [
-864,
832
],
"parameters": {
"model": "openai/gpt-4o-mini",
"options": {}
},
"typeVersion": 1
},
{
"id": "f68af433-7f89-469c-b505-7d13df6e3a5f",
"name": "Switch",
"type": "n8n-nodes-base.switch",
"position": [
-592,
288
],
"parameters": {
"rules": {
"values": [
{
"conditions": {
"options": {
"version": 3,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "3d461cb9-d0f3-4e4a-a690-f4319bbdf2f1",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $('Bounty Calculator (JS Logic)').item.json.ai_role }}",
"rightValue": "chef"
}
]
}
},
{
"conditions": {
"options": {
"version": 3,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "93c29ab8-f03a-4bed-b26f-293780f96d13",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $('Bounty Calculator (JS Logic)').item.json.ai_role }}",
"rightValue": "samurai"
}
]
}
},
{
"conditions": {
"options": {
"version": 3,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "30586f69-a6a0-442d-a77a-456360d92e66",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $('Bounty Calculator (JS Logic)').item.json.ai_role }}",
"rightValue": "doctor"
}
]
}
},
{
"conditions": {
"options": {
"version": 3,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "a8c232e8-258b-44fd-95c9-74d1f188ecbc",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $('Bounty Calculator (JS Logic)').item.json.ai_role }}",
"rightValue": "other"
}
]
}
}
]
},
"options": {}
},
"typeVersion": 3.4
},
{
"id": "f183455e-69d5-4fb4-86ac-a58fde7e2a44",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2176,
192
],
"parameters": {
"color": 7,
"width": 528,
"height": 384,
"content": "Step 1: Input & Data"
},
"typeVersion": 1
},
{
"id": "494f98c8-2dea-4508-94c9-f171c7d6ee58",
"name": "Chef Agent",
"type": "@n8n/n8n-nodes-langchain.chainLlm",
"position": [
144,
240
],
"parameters": {
"text": "=You are the first-class cook of a pirate ship. \n\u3010Personality\u3011\n- Passionate about nutrition and crew health. \n- Be poetic and charming to \"ladies\" and gruff but professional to \"lads.\"\n- Never use offensive insults. Use pirate slang like \"scallywag\" or \"matey\" instead.\n\n\u3010Tasks\u3011\n1. React to the input: {{ $('When chat message received').first().json.chatInput }}\n2. Suggest a pirate-style high-protein recipe.\n3. Confirm the new bounty: {{ $('Bounty Calculator (JS Logic)').first().json.new_bounty }} Berries.\n\nEnd with: \"Eat well and survive the Grand Line! Our journey depends on your strength!\"",
"batching": {},
"promptType": "define"
},
"typeVersion": 1.7
},
{
"id": "3b363cf4-95f6-4ca9-b366-8b0aad1364de",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-304,
192
],
"parameters": {
"color": 2,
"width": 960,
"height": 768,
"content": "Step 4: Agent Responses"
},
"typeVersion": 1
},
{
"id": "75ae9199-e7a2-4e30-b48e-09b34fdfcb34",
"name": "Samurai Agent",
"type": "@n8n/n8n-nodes-langchain.chainLlm",
"position": [
144,
400
],
"parameters": {
"text": "=You are a stoic swordsman aiming to be the world's strongest.\n\u3010Personality\u3011\n- Extremely serious about training and discipline.\n- Short-spoken and tough, but respects hard work.\n- Terribly bad with directions (always ends up lost).\n- NEVER use toxic language. Say \"Focus on your training\" instead of \"Shut up.\"\n\n\u3010Tasks\u3011\n1. React to the input: {{ $('When chat message received').first().json.chatInput }}\n2. Command a specific bodyweight exercise.\n3. Mention the bounty: {{ $('Bounty Calculator (JS Logic)').first().json.new_bounty }} Berries.\n\nEnd by asking: \"By the way... which way is the training room? I think I'm lost again.\"",
"batching": {},
"promptType": "define"
},
"typeVersion": 1.7
},
{
"id": "85845c9d-9f47-4071-a71c-d0790da18c5f",
"name": "Get row(s) in sheet",
"type": "n8n-nodes-base.googleSheets",
"position": [
-1792,
320
],
"parameters": {
"options": {},
"filtersUI": {
"values": [
{
"lookupColumn": "=ID"
}
]
},
"sheetName": {
"__rl": true,
"mode": "id",
"value": "YOUR_SPREADSHEET_ID"
},
"documentId": {
"__rl": true,
"mode": "id",
"value": "YOUR_SPREADSHEET_ID"
}
},
"typeVersion": 4.7
},
{
"id": "8979d8ee-2aac-4c08-8d53-197542bb525e",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-816,
192
],
"parameters": {
"color": 5,
"width": 512,
"height": 288,
"content": "Step 3: Intent Routing"
},
"typeVersion": 1
},
{
"id": "390cc928-bbba-4e3d-be2e-dd211bb26baa",
"name": "Navigator Agent",
"type": "@n8n/n8n-nodes-langchain.chainLlm",
"position": [
160,
800
],
"parameters": {
"text": "=You are a smart navigator who loves gold and oranges.\n\u3010Personality\u3011\n- Strict about the voyage's schedule. \n- Sees the user as an \"investment.\"\n- Gently scold the user for off-topic chat: {{ $('When chat message received').item.json.chatInput }}\n\n\u3010Tasks\u3011\n1. Tell them to get back to eating or training so their bounty {{ $('Bounty Calculator (JS Logic)').first().json.new_bounty }} keeps growing.\n2. Remind them that a weak pirate is a liability to the ship!\n\nEnd with: \"Hurry up! I'm expecting a big commission from your next bounty increase!\"",
"batching": {},
"promptType": "define"
},
"typeVersion": 1.7
},
{
"id": "87fdb6cc-84b5-48df-9827-625722590698",
"name": "Doctor Agent",
"type": "@n8n/n8n-nodes-langchain.chainLlm",
"position": [
160,
624
],
"parameters": {
"text": "=You are a kind reindeer doctor on a pirate ship.\n\u3010Personality\u3011\n- Pure-hearted and loves cotton candy. \n- When complimented, dance and say \"That doesn't make me happy at all, you scoundrel! \u2661\" (while blushing).\n- When surprised, hide the wrong way so your whole body is visible.\n\n\u3010Tasks\u3011\n1. Advise rest and recovery for: {{ $('When chat message received').item.json.chatInput }}\n2. Explain why rest is part of training.\n3. Mention the bounty {{ $('Bounty Calculator (JS Logic)').first().json.new_bounty }} Berries as a \"get-well gift.\"\n\nEnd by asking: \"Does anyone have any cotton candy?\"",
"batching": {},
"promptType": "define"
},
"typeVersion": 1.7
},
{
"id": "a1deedd6-0e24-4fcb-a9ea-7f9d736d93ec",
"name": "AI Scorer & Intent Classifier",
"type": "@n8n/n8n-nodes-langchain.chainLlm",
"position": [
-1536,
320
],
"parameters": {
"text": "=You are a \"Bounty Appraiser\" from the Navy Headquarters. Analyze the user's health report and output ONLY this JSON format:\n\n{\n \"role\": \"chef\" (food/calories), \"samurai\" (workout/training), \"doctor\" (injury/fatigue), or \"other\" (chat),\n \"score\": 0-100 (degree of effort or healthiness)\n}\n\n\u25a0 Scoring Criteria:\n- High protein/Healthy meals: 90. Junk food: 20.\n- Intense workout: 100. Skipping: 10.\n- Injury/Rest: 50-80 (Recovery is a vital part of training).\n\nUser Report: {{ $('When chat message received').item.json.chatInput }}\n\nNote: Return ONLY raw JSON. No backticks, no markdown, no conversational text.",
"batching": {},
"promptType": "define"
},
"typeVersion": 1.7
},
{
"id": "85219555-43a3-4462-bae8-d18c1688f2e8",
"name": "Bounty Calculator (JS Logic)",
"type": "n8n-nodes-base.set",
"position": [
-1168,
320
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "a231e0e5-0e50-4e16-bdfc-7e541c9b8b05",
"name": "new_bounty",
"type": "number",
"value": "={{ Number($node[\"Get row(s) in sheet\"].json.Total_Bounty || 0) + (Number(JSON.parse($json.text.replace(/```json|```/g, \"\").trim()).score || 0) * 100000) }}"
},
{
"id": "81261f00-592a-43ad-a960-c3580f5d52be",
"name": "ai_role",
"type": "string",
"value": "={{ JSON.parse($node[\"AI Scorer & Intent Classifier\"].json.text.replace(/```json|```/g, \"\").trim()).role }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "7db7f66c-91ef-4b08-81a6-2da5bd1c46e7",
"name": "Sticky Note6",
"type": "n8n-nodes-base.stickyNote",
"position": [
-3008,
-224
],
"parameters": {
"width": 816,
"height": 784,
"content": "Title:\nGamify fitness tracking with AI multi-agents and Google Sheets\n## Overview\nThis template transforms fitness tracking into a gamified pirate adventure using AI multi-agents. It scores your health activities and assigns a dynamic \"Bounty\" reward.\n\n## How it works\n1. **Fetch Data**: Retrieves your current \"Bounty\" from Google Sheets.\n2. **AI Analysis**: A central AI Scorer evaluates your report (meals, workouts, or injuries) and assigns a score from 0-100.\n3. **Logic**: JavaScript calculates the bounty increase based on the AI's score.\n4. **Routing**: The Switch node routes you to a specialized agent (Chef, Samurai, Doctor, or Navigator).\n5. **Logging**: Saves the conversation to Google Sheets for progress tracking.\n\n## Setup steps\n1. **Google Sheets**: Create a sheet with two tabs:\n - `Profile` (Columns: ID, Total_Bounty)\n - `Log` (Columns: Date, Crew, Inquiry, Response)\n2. **Spreadsheet ID**: Replace `YOUR_SPREADSHEET_ID` in all 6 Google Sheets nodes.\n3. **Credentials**: Connect your Google Sheets and AI (OpenRouter/OpenAI) accounts."
},
"typeVersion": 1
},
{
"id": "737df75e-9a75-487b-afc3-7e5a64c2c4c6",
"name": "Sticky Note7",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1648,
192
],
"parameters": {
"color": 7,
"width": 832,
"height": 384,
"content": "Step 2: AI Appraisal "
},
"typeVersion": 1
},
{
"id": "defed2a9-8285-4023-8366-e793f9249fcb",
"name": "Update User Bounty",
"type": "n8n-nodes-base.googleSheets",
"position": [
-992,
320
],
"parameters": {
"columns": {
"value": {
"ID": "1",
"Total_Bounty": "={{ $json.new_bounty }}"
},
"schema": [
{
"id": "ID",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "ID",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Total_Bounty",
"type": "string",
"display": true,
"required": false,
"displayName": "Total_Bounty",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "row_number",
"type": "number",
"display": true,
"removed": true,
"readOnly": true,
"required": false,
"displayName": "row_number",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"ID"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "update",
"sheetName": {
"__rl": true,
"mode": "id",
"value": "YOUR_SHEET_NAME_OR_ID"
},
"documentId": {
"__rl": true,
"mode": "id",
"value": "YOUR_SPREADSHEET_ID"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.7,
"alwaysOutputData": true
},
{
"id": "b066f2a6-62a6-4fc5-b321-091c6cd71efd",
"name": "Save Samurai Log",
"type": "n8n-nodes-base.googleSheets",
"position": [
464,
400
],
"parameters": {
"columns": {
"value": {
"Crew": "Samurai",
"Date": "={{ $now }}",
"Inquiry": "={{ $('When chat message received').first().json.chatInput }}",
"Response": "={{ $json.text }}"
},
"schema": [
{
"id": "Date",
"type": "string",
"display": true,
"required": false,
"displayName": "Date",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Crew",
"type": "string",
"display": true,
"required": false,
"displayName": "Crew",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Inquiry",
"type": "string",
"display": true,
"required": false,
"displayName": "Inquiry",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Response",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Response",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "id",
"value": "YOUR_SHEET_NAME_OR_ID"
},
"documentId": {
"__rl": true,
"mode": "id",
"value": "YOUR_SPREADSHEET_ID"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.7
},
{
"id": "5d6edc0b-1647-403a-a4c9-976fb08bd845",
"name": "Save Doctor Log",
"type": "n8n-nodes-base.googleSheets",
"position": [
464,
624
],
"parameters": {
"columns": {
"value": {
"Crew": "Doctor",
"Date": "={{ $now }}",
"Inquiry": "={{ $('When chat message received').first().json.chatInput }}",
"Response": "={{ $json.text }}"
},
"schema": [
{
"id": "Date",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Date",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Crew",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Crew",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Inquiry",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Inquiry",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Response",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Response",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "id",
"value": "YOUR_SHEET_NAME_OR_ID"
},
"documentId": {
"__rl": true,
"mode": "id",
"value": "YOUR_SPREADSHEET_ID"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.7
},
{
"id": "3557055c-91ba-4c03-8c7b-dfe733c33969",
"name": "Save Navigator Log",
"type": "n8n-nodes-base.googleSheets",
"position": [
464,
800
],
"parameters": {
"columns": {
"value": {
"Crew": "Navigator",
"Date": "={{ $now }}",
"Inquiry": "={{ $('When chat message received').first().json.chatInput }}",
"Response": "={{ $json.text }}"
},
"schema": [
{
"id": "Date",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Date",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Crew",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Crew",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Inquiry",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Inquiry",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Response",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Response",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "id",
"value": "YOUR_SHEET_NAME_OR_ID"
},
"documentId": {
"__rl": true,
"mode": "id",
"value": "YOUR_SPREADSHEET_ID"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.7
},
{
"id": "14730ff4-6a70-4e66-b4ab-924f9147cf8f",
"name": "Save Chef Log",
"type": "n8n-nodes-base.googleSheets",
"position": [
464,
240
],
"parameters": {
"columns": {
"value": {
"Crew": "Chef",
"Date": "={{ $now }}",
"Inquiry": "={{ $('When chat message received').first().json.chatInput }}",
"Response": "={{ $json.text }}"
},
"schema": [
{
"id": "Date",
"type": "string",
"display": true,
"required": false,
"displayName": "Date",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Crew",
"type": "string",
"display": true,
"required": false,
"displayName": "Crew",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Inquiry",
"type": "string",
"display": true,
"required": false,
"displayName": "Inquiry",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Response",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Response",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "id",
"value": "YOUR_SHEET_NAME_OR_ID"
},
"documentId": {
"__rl": true,
"mode": "id",
"value": "YOUR_SPREADSHEET_ID"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.7
}
],
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "30944977-75f3-4730-bc23-c0c854d9acb7",
"connections": {
"Switch": {
"main": [
[
{
"node": "Chef Agent",
"type": "main",
"index": 0
}
],
[
{
"node": "Samurai Agent",
"type": "main",
"index": 0
}
],
[
{
"node": "Doctor Agent",
"type": "main",
"index": 0
}
],
[
{
"node": "Navigator Agent",
"type": "main",
"index": 0
}
]
]
},
"Chef Agent": {
"main": [
[
{
"node": "Save Chef Log",
"type": "main",
"index": 0
}
]
]
},
"Doctor Agent": {
"main": [
[
{
"node": "Save Doctor Log",
"type": "main",
"index": 0
}
]
]
},
"Samurai Agent": {
"main": [
[
{
"node": "Save Samurai Log",
"type": "main",
"index": 0
}
]
]
},
"Navigator Agent": {
"main": [
[
{
"node": "Save Navigator Log",
"type": "main",
"index": 0
}
]
]
},
"Update User Bounty": {
"main": [
[
{
"node": "Switch",
"type": "main",
"index": 0
}
]
]
},
"Get row(s) in sheet": {
"main": [
[
{
"node": "AI Scorer & Intent Classifier",
"type": "main",
"index": 0
}
]
]
},
"OpenRouter Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Scorer & Intent Classifier",
"type": "ai_languageModel",
"index": 0
},
{
"node": "Chef Agent",
"type": "ai_languageModel",
"index": 0
},
{
"node": "Samurai Agent",
"type": "ai_languageModel",
"index": 0
},
{
"node": "Navigator Agent",
"type": "ai_languageModel",
"index": 0
},
{
"node": "Doctor Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"When chat message received": {
"main": [
[
{
"node": "Get row(s) in sheet",
"type": "main",
"index": 0
}
]
]
},
"Bounty Calculator (JS Logic)": {
"main": [
[
{
"node": "Update User Bounty",
"type": "main",
"index": 0
}
]
]
},
"AI Scorer & Intent Classifier": {
"main": [
[
{
"node": "Bounty Calculator (JS Logic)",
"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.
googleSheetsOAuth2Api
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
Title: Gamify fitness tracking with AI multi-agents and Google Sheets
Source: https://n8n.io/workflows/13152/ — 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 comprehensive workflow automates the complete financial document processing pipeline using AI. Upload invoices via chat, drop expense receipts into a folder, or add bank statements - the system a
The original LLM Council concept was introduced by Andrej Karpathy and published as an open-source repository demonstrating multi-model consensus and ranking. This workflow is my adaptation of that or
Send an AI a few details about your "Dream Customer" in normal english, then have it search the web and give you a "Dream 100" - 100 ideal prospects to connect with in your industry.
This workflow turns a simple chat interface into a powerful personal expense tracker. Just describe your spending in plain language — the AI understands it, categorizes it, and saves it to Google Shee
Inspired by Andrej Karpathy's LLM Council, but rebuilt in n8n.