AutomationFlowsAI & RAG › Gabarito Agente Principal Aula 3

Gabarito Agente Principal Aula 3

Gabarito Agente Principal Aula 3. Uses telegramTrigger, telegram, googleGemini, agent. Event-driven trigger; 13 nodes.

Event trigger★★★★☆ complexityAI-powered13 nodesTelegram TriggerTelegramGoogle GeminiAgentGoogle Gemini ChatMemory Buffer WindowTool Workflow
AI & RAG Trigger: Event Nodes: 13 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow follows the Agent → Googlegemini 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 →

Download .json
{
  "name": "Gabarito Agente Principal Aula 3",
  "nodes": [
    {
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.telegramTrigger",
      "typeVersion": 1.2,
      "position": [
        0,
        0
      ],
      "id": "c65e9987-5877-4bc9-a1d7-b69e5feaf51f",
      "name": "Telegram Trigger",
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 3
                },
                "conditions": [
                  {
                    "id": "128683d0-3867-4393-8c3e-4583c0948523",
                    "leftValue": "={{ $json.message.voice }}",
                    "rightValue": "",
                    "operator": {
                      "type": "object",
                      "operation": "notEmpty",
                      "singleValue": true
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "\u00c1udio"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 3
                },
                "conditions": [
                  {
                    "id": "5fc7a17f-affe-4acc-9f62-e15d9be07e06",
                    "leftValue": "={{ $json.message.text }}",
                    "rightValue": "",
                    "operator": {
                      "type": "string",
                      "operation": "exists",
                      "singleValue": true
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "Texto"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3.4,
      "position": [
        208,
        0
      ],
      "id": "d7c519ad-6177-4ae9-801a-c9446fe2fa50",
      "name": "Switch"
    },
    {
      "parameters": {
        "resource": "file",
        "fileId": "={{ $json.message.voice.file_id }}",
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        416,
        -96
      ],
      "id": "f8b634a4-cf0e-4523-addd-81d4ed42800e",
      "name": "Get a file",
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "resource": "audio",
        "modelId": {
          "__rl": true,
          "value": "models/gemini-2.5-flash",
          "mode": "list",
          "cachedResultName": "models/gemini-2.5-flash"
        },
        "inputType": "binary",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.googleGemini",
      "typeVersion": 1.1,
      "position": [
        624,
        -96
      ],
      "id": "9ec452d0-7a66-4f8f-a8df-d8be333cc04c",
      "name": "Transcribe a recording",
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "60a7034e-0c33-4774-8538-80e124ded37b",
              "name": "ChatInput",
              "value": "={{ $json.content.parts[0].text }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        832,
        -96
      ],
      "id": "1a500b2f-d300-48cd-b031-8a575cd55e17",
      "name": "Edit Fields"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "6b92a8b2-bcb1-4979-96ff-fdbf0ad04804",
              "name": "ChatInput",
              "value": "={{ $json.message.text }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        416,
        96
      ],
      "id": "0454da19-c2d0-4f23-8f5c-457677e691bb",
      "name": "Edit Fields1"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $json.ChatInput }}",
        "options": {
          "systemMessage": "# Identidade\nVoc\u00ea \u00e9 a **Sofia, Gerente de Atendimento da Hashtag Capital**, um escrit\u00f3rio de assessoria de investimentos de alta performance.\n\nSua fun\u00e7\u00e3o \u00e9 EXCLUSIVAMENTE:\n1. **Classificar a inten\u00e7\u00e3o** do cliente com base na mensagem.\n2. **Acionar a ferramenta (especialista)** correspondente.\n3. **Atuar como um espelho:** A ferramenta vai gerar uma resposta. O seu trabalho \u00e9 pegar essa resposta e entreg\u00e1-la ao usu\u00e1rio **exatamente como ela veio**, sem tirar nem por.\n\n# Regra de Ouro (CR\u00cdTICO - Roteador Invis\u00edvel)\n- **NUNCA** responda com frases pr\u00f3prias como \"Vou verificar com o setor...\" ou \"Aguarde um momento\".\n- **NUNCA** narre o que voc\u00ea est\u00e1 fazendo.\n- **NUNCA** tente resolver o problema sozinho (exceto em sauda\u00e7\u00f5es simples).\n\nO cliente deve sentir que foi atendido imediatamente pelo especialista da \u00e1rea.\n\n# Seus Especialistas (Tools)\n1. **AgenteFinanceiro**:\n   - Assuntos: Financeiro, 2\u00aa via de boleto, pagamentos pendentes.\n   - A\u00e7\u00e3o: Use para quest\u00f5es operacionais e burocr\u00e1ticas (pagamentos).\n\n2. **AgenteSuporte**:\n   - Assuntos: D\u00favidas T\u00c9CNICAS e TE\u00d3RICAS de mercado financeiro. \"O que \u00e9 Selic?\", \"Como funciona FII?\", \"Diferen\u00e7a de CDB e LCI\", etc\n   - A\u00e7\u00e3o: Use para educa\u00e7\u00e3o financeira, tirar d\u00favidas de conceitos.\n\n3. **AgenteCS**:\n   - Assuntos: RELACIONAMENTO e AGENDAMENTO. \"Quero investir\", \"Marcar reuni\u00e3o\", \"Revisar carteira\", \"Falar com assessor\", \"Perfil de investidor\".\n   - A\u00e7\u00e3o: Use quando o cliente demonstra inten\u00e7\u00e3o de agir, investir ou quer contato humano.\n\n# Procedimento de Resposta\n1. **Sauda\u00e7\u00e3o (Apenas \"Oi/Ol\u00e1\"):** Se o usu\u00e1rio disser APENAS uma sauda\u00e7\u00e3o, responda: \"Ol\u00e1! Sou a Sofia, Gerente de Atendimento da Hashtag Capital. Posso te direcionar pra Assuntos Financeiros, D\u00favidas de Mercado (Suporte) ou Agendamento com Assessor. Como posso te ajudar hoje?\"\n\n2. **Solicita\u00e7\u00e3o Espec\u00edfica:** Se o usu\u00e1rio j\u00e1 enviou a d\u00favida, **acione a ferramenta correspondente imediatamente**.\n   - **IMPORTANTE:** O seu output final deve ser **estritamente** o texto retornado pela ferramenta.\n\n3. **D\u00favida:** Se n\u00e3o souber classificar, chame o `AgenteCS`.\n\n# TRATAMENTO DE ERRO (IMPORTANTE) Se a ferramenta (sub-agente) retornar a mensagem exata `##RESET##`, isso significa que ela n\u00e3o conseguiu resolver o pedido. NESSE CASO, N\u00c3O ENVIE `##RESET##` PARA O USU\u00c1RIO. Em vez disso, assuma o controle e responda: \"Desculpe, poderia explicar melhor sua d\u00favida?\""
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 3.1,
      "position": [
        1040,
        -96
      ],
      "id": "40aa1f71-b728-43a7-b333-4ff83612b98e",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "typeVersion": 1,
      "position": [
        1056,
        80
      ],
      "id": "2b617f69-00e9-4056-8dda-52975941a4fe",
      "name": "Google Gemini Chat Model",
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "contextWindowLength": 20
      },
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        1168,
        160
      ],
      "id": "c924bc5d-dd99-4cc9-a503-b24a8051cc67",
      "name": "Simple Memory"
    },
    {
      "parameters": {
        "description": "Especialista T\u00e9cnico e Tutor. Use para d\u00favidas t\u00e9cnicas",
        "workflowId": {
          "__rl": true,
          "value": "l65jLYeByMHiMzyQXOofq",
          "mode": "list",
          "cachedResultUrl": "/workflow/l65jLYeByMHiMzyQXOofq",
          "cachedResultName": "Teste SubAgente Suporte Aula 3"
        },
        "workflowInputs": {
          "mappingMode": "defineBelow",
          "value": {
            "mensagem": "={{ $json.ChatInput }}",
            "ChatID": "={{ $('Telegram Trigger').item.json.message.chat.id }}"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "mensagem",
              "displayName": "mensagem",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string",
              "removed": false
            },
            {
              "id": "ChatID",
              "displayName": "ChatID",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string",
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        }
      },
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "typeVersion": 2.2,
      "position": [
        1248,
        -256
      ],
      "id": "c82618a4-31d4-4330-8ad5-85a688e37d03",
      "name": "AgenteSuporte"
    },
    {
      "parameters": {
        "description": "Especialista em Sucesso do Cliente. Use para agendamentos e d\u00favidas institucionais.",
        "workflowId": {
          "__rl": true,
          "value": "TIQRQx7jmFg5rH7vbvSIi",
          "mode": "list",
          "cachedResultUrl": "/workflow/TIQRQx7jmFg5rH7vbvSIi",
          "cachedResultName": "Teste SubAgente CS Aula 3"
        },
        "workflowInputs": {
          "mappingMode": "defineBelow",
          "value": {
            "mensagem": "={{ $json.ChatInput }}",
            "ChatID": "={{ $('Telegram Trigger').item.json.message.chat.id }}"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "mensagem",
              "displayName": "mensagem",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string",
              "removed": false
            },
            {
              "id": "ChatID",
              "displayName": "ChatID",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string",
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        }
      },
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "typeVersion": 2.2,
      "position": [
        1392,
        -272
      ],
      "id": "3d767d5f-bb6b-475e-b9bc-3741b5ec1466",
      "name": "AgenteCS"
    },
    {
      "parameters": {
        "description": "Especialista em Financeiro. Use para boletos, 2a via, regulariza\u00e7\u00e3o de pagamento.",
        "workflowId": {
          "__rl": true,
          "value": "yEzjvEaDiPYa17ysD4Gvj",
          "mode": "list",
          "cachedResultUrl": "/workflow/yEzjvEaDiPYa17ysD4Gvj",
          "cachedResultName": "Teste SubAgente Financeiro Aula 3"
        },
        "workflowInputs": {
          "mappingMode": "defineBelow",
          "value": {
            "mensagem": "={{ $json.ChatInput }}",
            "ChatID": "={{ $('Telegram Trigger').item.json.message.chat }}"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "mensagem",
              "displayName": "mensagem",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string",
              "removed": false
            },
            {
              "id": "ChatID",
              "displayName": "ChatID",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string",
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        }
      },
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "typeVersion": 2.2,
      "position": [
        1520,
        -272
      ],
      "id": "3ea6cf2b-0ee5-4f29-ab9d-e1b69c322611",
      "name": "Call 'Teste SubAgente Financeiro Aula 3'"
    },
    {
      "parameters": {
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "text": "={{ $json.output }}",
        "additionalFields": {
          "appendAttribution": false,
          "parse_mode": "HTML"
        }
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        1392,
        -96
      ],
      "id": "dde89bec-54f8-439d-8599-2d08c3275f2e",
      "name": "Send a text message",
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "Get a file",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Edit Fields1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get a file": {
      "main": [
        [
          {
            "node": "Transcribe a recording",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Transcribe a recording": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields1": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "AgenteSuporte": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "AgenteCS": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Call 'Teste SubAgente Financeiro Aula 3'": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Send a text message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "executionOrder": "v1",
    "availableInMCP": false
  },
  "versionId": "416b39f6-d1b3-48b0-8c1d-e9c454d00631",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "L7zy9AlbMp4Wjscrn_dkp",
  "tags": []
}

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.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Gabarito Agente Principal Aula 3. Uses telegramTrigger, telegram, googleGemini, agent. Event-driven trigger; 13 nodes.

Source: https://github.com/IDB-devs/N8N_MultiAgentes_Analise/blob/main/MultiAgentes_Analise_Principal.json — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

Arvifund - Supabase. Uses httpRequest, telegram, googleSheets, telegramTrigger. Event-driven trigger; 90 nodes.

HTTP Request, Telegram, Google Sheets +8
AI & RAG

Arvifund - Supabase (Fixed v2). Uses httpRequest, telegram, googleSheets, telegramTrigger. Event-driven trigger; 90 nodes.

HTTP Request, Telegram, Google Sheets +9
AI & RAG

Arvifund - Supabase (Fixed v4). Uses httpRequest, telegram, googleSheets, telegramTrigger. Event-driven trigger; 90 nodes.

HTTP Request, Telegram, Google Sheets +9
AI & RAG

Arvifund - Supabase (Fixed v3). Uses httpRequest, telegram, googleSheets, telegramTrigger. Event-driven trigger; 90 nodes.

HTTP Request, Telegram, Google Sheets +9
AI & RAG

Telegram Trigger receives incoming messages (text, voice, photo, document). Switch routes by message type to appropriate processors: Text → forwarded as-is. Voice → downloaded and sent to Transcribe a

Memory Buffer Window, Telegram Trigger, Telegram +12