{
  "name": "Telegram1",
  "nodes": [
    {
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.telegramTrigger",
      "typeVersion": 1.1,
      "position": [
        -380,
        -140
      ],
      "id": "f22ec3b0-9bf9-49df-a6f8-7ce994c597a0",
      "name": "Telegram Trigger",
      "webhookId": "e4508ddc-9ad9-426b-9e10-696c943cd59e",
      "credentials": {
        "telegramApi": {
          "id": "sJmCCl04cDyvxGEp",
          "name": "Telegram account 4"
        }
      }
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $json.message.text }}",
        "options": {
          "systemMessage": "=You are a helpful assistant\n\n# you have tools:\n\n## search_agent\nuse this tool to search the web, hackernews and wikipedia\n\n## calculator\nuse this tool to do math"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.7,
      "position": [
        -160,
        -140
      ],
      "id": "dba9d7e6-f700-49cd-9aeb-b7b1fc12dc97",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "value": "gpt-4o",
          "mode": "list",
          "cachedResultName": "gpt-4o"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        -300,
        140
      ],
      "id": "a1ba09a7-0f71-4ef9-b5cb-18e97c026474",
      "name": "OpenAI Chat Model",
      "credentials": {
        "openAiApi": {
          "id": "mto8GpgTDXNCXksO",
          "name": "YT Test"
        }
      }
    },
    {
      "parameters": {
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "text": "={{ $json.output }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        200,
        -140
      ],
      "id": "5dcf2881-5385-4333-80be-3bd5d8bed825",
      "name": "Telegram",
      "webhookId": "b4a16832-bacf-40e2-a13c-aa13502fa9c2",
      "credentials": {
        "telegramApi": {
          "id": "sJmCCl04cDyvxGEp",
          "name": "Telegram account 4"
        }
      }
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "contextWindowLength": 10
      },
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        -180,
        140
      ],
      "id": "5914e379-0ede-45f8-bd67-ba1dcfc7479d",
      "name": "Window Buffer Memory"
    },
    {
      "parameters": {
        "name": "search_agent",
        "description": "use this tool to surch the web, wikipedia, hackernews and up-to-date info.",
        "workflowId": {
          "__rl": true,
          "value": "wGzfejLZOL2pJrhK",
          "mode": "list",
          "cachedResultName": "Telgram1 Sub Workflow Surch"
        },
        "workflowInputs": {
          "mappingMode": "defineBelow",
          "value": {},
          "matchingColumns": [],
          "schema": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        }
      },
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "typeVersion": 2,
      "position": [
        140,
        160
      ],
      "id": "9cc6d2b1-e238-48b3-970b-112ab2220271",
      "name": "search_agent"
    },
    {
      "parameters": {},
      "type": "@n8n/n8n-nodes-langchain.toolCalculator",
      "typeVersion": 1,
      "position": [
        0,
        160
      ],
      "id": "ccd37989-6022-43a5-aa35-b8c6c56785d4",
      "name": "Calculator"
    }
  ],
  "pinData": {},
  "connections": {
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Telegram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Window Buffer Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "search_agent": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Calculator": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "5902cdec-947c-4915-9de5-e49f766b7720",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "89d6b5241e3d0c6b62682a09a72213abeeffd34a6110f442c15fc0b560f12919"
  },
  "id": "2td3Jh0u5LkWayxR",
  "tags": []
}