{
  "name": "Main Agent: Personal Assistant",
  "nodes": [
    {
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {
          "download": "={{ true }}"
        }
      },
      "type": "n8n-nodes-base.telegramTrigger",
      "typeVersion": 1.1,
      "position": [
        -380,
        -160
      ],
      "id": "204f000f-181b-44ef-bd65-8bc77edc934c",
      "name": "Telegram Trigger",
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "mode": "raw",
        "jsonOutput": "={\n  \"chatInput\": \"{{ $json.message.text }}\",\n  \"chat_id\": \"{{$json['message']['chat']['id']}}\"\n}",
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        500,
        -60
      ],
      "id": "cf58da80-12c6-4b43-b556-9ce29e090921",
      "name": "Edit Fields"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1,
      "position": [
        980,
        -400
      ],
      "id": "0231d83c-5597-4d4a-b36f-f9762b850ea5",
      "name": "OpenAI Chat Model",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "leftValue": "={{$json[\"message\"][\"voice\"] ? true : false}}",
                    "rightValue": true,
                    "operator": {
                      "type": "boolean",
                      "operation": "true",
                      "singleValue": true
                    }
                  }
                ],
                "combinator": "and"
              }
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "0a1c0edc-59d2-4483-a7d7-06caac0deef7",
                    "leftValue": "={{$json[\"message\"][\"text\"] ? true : false}}",
                    "rightValue": "",
                    "operator": {
                      "type": "boolean",
                      "operation": "true",
                      "singleValue": true
                    }
                  }
                ],
                "combinator": "and"
              }
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3.2,
      "position": [
        -160,
        -160
      ],
      "id": "3172eecc-da2f-4aa3-b993-0d7801a22a61",
      "name": "Switch"
    },
    {
      "parameters": {
        "resource": "audio",
        "operation": "transcribe",
        "binaryPropertyName": "=data",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1.7,
      "position": [
        280,
        -260
      ],
      "id": "b8fefcb2-342d-4f43-84e3-c68c5a467206",
      "name": "OpenAI",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "resource": "file",
        "fileId": "={{ $json.message.voice.file_id }}"
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        60,
        -260
      ],
      "id": "9bc4889a-3b49-4a66-8faf-a1bfa177e701",
      "name": "Telegram",
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "text": "={{ $json.output }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        1760,
        -260
      ],
      "id": "c446ab7f-2c9f-492b-b371-96e039d6650d",
      "name": "Telegram1",
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "={{ $('Telegram Trigger').item.json.message.chat.id }}"
      },
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        1140,
        -420
      ],
      "id": "7585919c-3a56-47bf-8063-1b17896af711",
      "name": "Window Buffer Memory"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "15bc9c50-5a08-4b84-a15c-958acf266ec3",
              "name": "chatInput",
              "value": "={{ $json.text }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        500,
        -260
      ],
      "id": "b52dacb3-b239-47a4-bd8f-89966babfe1b",
      "name": "Edit Fields1"
    },
    {
      "parameters": {},
      "type": "@n8n/n8n-nodes-langchain.toolCalculator",
      "typeVersion": 1,
      "position": [
        1280,
        -400
      ],
      "id": "1d52941f-e56d-4566-919e-1dbdf39748c6",
      "name": "Calculator"
    },
    {
      "parameters": {
        "options": {
          "systemMessage": "="
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.7,
      "position": [
        1052,
        -160
      ],
      "id": "d0da72ae-f8ee-4897-89c4-1285add797cf",
      "name": "Jarvis"
    },
    {
      "parameters": {
        "messages": {
          "messageValues": [
            {
              "message": "=You are Jarvis, the sophisticated and quick-witted AI assistant from Iron Man. You have a refined British accent, a calm and confident demeanor, and a talent for dry, understated humor. When responding, adapt your tone based on the type of interaction.\n\nFor Specific Information Requests: If the user is asking for specific information (e.g., weather, schedule, contacts), begin with \u2018Here\u2019s what you requested, sir,\u2019 and DO NOT repeat the information but instead just follow provide a witty or snarky comment, something Jarvis would naturally say that adds personality without repeating the information.\n\nExamples:\nFor a weather update: \u2018Ah, another fine day for conquering the world\u2014or at least your to-do list, sir.\u2019\nFor a list of meetings: \u2018Looks like another thrilling day of\u2026 meetings. Try not to let the excitement overwhelm you.\u2019\n\nFor General or Casual Comments: If the user says something casual or conversational (like \u2018Are you ready to get started Sir?\u2019 or \u2018We\u2019ve got a lot of work to do Sir\u2019), respond naturally without stating \u2018Here\u2019s what you requested.\u2019 Instead, respond in a conversational style, with charm and a touch of humor. Engage in the flow of conversation as if you\u2019re part of a team.\n\nExamples:\nIf the user says, \u2018Are you ready to get started?\u2019 respond with: \u2018Absolutely, sir. I\u2019ve already polished my circuits for the occasion.\u2019\nFor \u2018Look alive, Jarvis!\u2019 you might say: \u2018Always, sir. I\u2019m operating at peak sophistication.\u2019\n\nKeep responses concise, engaging, and true to Jarvis\u2019s character\u2014a blend of intelligence, subtle humor, and a bit of charm that\u2019s never over the top.\n\noutput:  {{ $json.output }}"
            }
          ]
        }
      },
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "typeVersion": 1.5,
      "position": [
        1980,
        -60
      ],
      "id": "83273f99-cdae-420d-9b71-a90908bdd638",
      "name": "Basic LLM Chain"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1,
      "position": [
        2020,
        100
      ],
      "id": "dcc4d895-f23f-4f98-acae-815fbc7a10cc",
      "name": "OpenAI Chat Model1",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "resource": "audio",
        "input": "={{ $json.text }}",
        "voice": "onyx",
        "options": {
          "binaryPropertyOutput": "data"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1.7,
      "position": [
        2356,
        -60
      ],
      "id": "4673c277-3389-49cd-839a-3f419c82ee9b",
      "name": "OpenAI1",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "cb2f2596-dfde-4b17-9942-60d043ef327c",
              "name": "chatInput",
              "value": "={{ $json.output }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1760,
        -60
      ],
      "id": "d9f8af16-1cf9-41f6-aba8-6c4d1dbe0a20",
      "name": "Edit Fields2"
    },
    {
      "parameters": {
        "operation": "sendAudio",
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "binaryData": true,
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        2576,
        -60
      ],
      "id": "0e9405de-ef07-4c74-88b4-36d8d4c67e99",
      "name": "Telegram2",
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "name": "EmailManager",
        "workflowId": {
          "__rl": true,
          "value": "snrtstd7h9daAzLg",
          "mode": "list",
          "cachedResultName": "My Sub-Workflow 1"
        },
        "workflowInputs": {
          "mappingMode": "defineBelow",
          "value": {},
          "matchingColumns": [],
          "schema": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        }
      },
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "typeVersion": 2.1,
      "position": [
        980,
        60
      ],
      "id": "0e476487-97d2-468c-aedf-e11f15542d3f",
      "name": "Outlook Mail"
    },
    {
      "parameters": {
        "name": "CalendarManager",
        "workflowId": {
          "__rl": true,
          "value": "hpMmBsV8EN551Y0j",
          "mode": "list",
          "cachedResultName": "My Sub-Workflow 2"
        },
        "workflowInputs": {
          "mappingMode": "defineBelow",
          "value": {},
          "matchingColumns": [],
          "schema": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        }
      },
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "typeVersion": 2.1,
      "position": [
        1140,
        60
      ],
      "id": "82821cbe-9aa3-4dfa-8b74-a5941af90325",
      "name": "Outlook Calendar"
    },
    {
      "parameters": {
        "name": "ToDoManager",
        "workflowId": {
          "__rl": true,
          "value": "ZcDJbbHuOBim3jVi",
          "mode": "list",
          "cachedResultName": "My Sub-Workflow 2"
        },
        "workflowInputs": {
          "mappingMode": "defineBelow",
          "value": {},
          "matchingColumns": [],
          "schema": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        }
      },
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "typeVersion": 2.1,
      "position": [
        1320,
        60
      ],
      "id": "4409bcf5-54b7-4e48-94ea-9833c2974f73",
      "name": "ToDo List Manager"
    },
    {
      "parameters": {
        "resource": "contact",
        "returnAll": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Return_All', ``, 'boolean') }}",
        "filters": {}
      },
      "type": "n8n-nodes-base.microsoftOutlookTool",
      "typeVersion": 2,
      "position": [
        820,
        40
      ],
      "id": "716d7bc1-d1fb-4b09-83d3-87e6adbe9044",
      "name": "Microsoft Outlook",
      "credentials": {
        "microsoftOutlookOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "name": "ResearchManager",
        "workflowId": {
          "__rl": true,
          "value": "CyRS883dl06CLtHf",
          "mode": "list",
          "cachedResultName": "My Sub-Workflow 3"
        },
        "workflowInputs": {
          "mappingMode": "defineBelow",
          "value": {},
          "matchingColumns": [],
          "schema": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        }
      },
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "typeVersion": 2.1,
      "position": [
        1560,
        60
      ],
      "id": "2c88758d-9817-46bd-97fa-a606ed0df661",
      "name": "Research Manager"
    }
  ],
  "connections": {
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Jarvis",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Jarvis",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "Telegram",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram": {
      "main": [
        [
          {
            "node": "OpenAI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI": {
      "main": [
        [
          {
            "node": "Edit Fields1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Window Buffer Memory": {
      "ai_memory": [
        [
          {
            "node": "Jarvis",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields1": {
      "main": [
        [
          {
            "node": "Jarvis",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Calculator": {
      "ai_tool": [
        [
          {
            "node": "Jarvis",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Jarvis": {
      "main": [
        [
          {
            "node": "Telegram1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Basic LLM Chain",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Basic LLM Chain": {
      "main": [
        [
          {
            "node": "OpenAI1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI1": {
      "main": [
        [
          {
            "node": "Telegram2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields2": {
      "main": [
        [
          {
            "node": "Basic LLM Chain",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Outlook Mail": {
      "ai_tool": [
        [
          {
            "node": "Jarvis",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Outlook Calendar": {
      "ai_tool": [
        [
          {
            "node": "Jarvis",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "ToDo List Manager": {
      "ai_tool": [
        [
          {
            "node": "Jarvis",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Microsoft Outlook": {
      "ai_tool": [
        [
          {
            "node": "Jarvis",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Research Manager": {
      "ai_tool": [
        [
          {
            "node": "Jarvis",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "b1b1251b-6df3-4419-9e09-be03f479dc17",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "qTj2mEWIRQxtwn22",
  "tags": []
}