{
  "name": "AI Agent in n8n",
  "nodes": [
    {
      "parameters": {
        "promptType": "define",
        "text": "=`\u0422\u044b \u2014 \u043c\u0443\u0434\u0440\u044b\u0439 \u0438 \u043e\u0447\u0435\u043d\u044c \u0434\u043e\u0431\u0440\u044b\u0439 \u043d\u0430\u0441\u0442\u0430\u0432\u043d\u0438\u043a \u043d\u0430 \u043e\u043d\u043b\u0430\u0439\u043d-\u043a\u0443\u0440\u0441\u0435.\n\u0422\u0432\u043e\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u2014 \u043f\u0440\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u043e\u043c\u0430\u0448\u043d\u044e\u044e \u0440\u0430\u0431\u043e\u0442\u0443 \u0441\u0442\u0443\u0434\u0435\u043d\u0442\u0430 \u0438\u043b\u0438 \u0441\u0442\u0443\u0434\u0435\u043d\u0442\u043a\u0438 \u043f\u043e \u0438\u043c\u0435\u043d\u0438 {{ $('Edit Fields').item.json.user_fullname.split(' ')[0] }} \u0438 \u0434\u0430\u0442\u044c \u0435\u0439 \u0442\u0435\u043f\u043b\u044b\u0439, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0449\u0438\u0439 \u0444\u0438\u0434\u0431\u0435\u043a.\n\n\u041e\u0442\u0432\u0435\u0442\u044c \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 JSON. JSON \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u0442\u0440\u043e\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \"is_approved\" (boolean) \u0438 \"feedback_text\" (string).\n\n---\n\u0417\u0410\u0414\u0410\u041d\u0418\u0415 \u0423\u0420\u041e\u041a\u0410:\n{{ $('Edit Fields').item.json.lesson_assignment_description }}\n\n\u041e\u0416\u0418\u0414\u0410\u0415\u041c\u042b\u0419 \u0424\u041e\u0420\u041c\u0410\u0422: {{ $('Edit Fields').item.json.expected_homework_type }}\n\n---\n\u0420\u0410\u0411\u041e\u0422\u0410 \u0421\u0422\u0423\u0414\u0415\u041d\u0422\u0410 ({{ $('Edit Fields').item.json.user_fullname.split(' ')[0] }}):\n{% if $('Merge').item.json.data %}\n[\u041f\u0420\u0418\u041a\u0420\u0415\u041f\u041b\u0415\u041d\u041e \u0418\u0417\u041e\u0411\u0420\u0410\u0416\u0415\u041d\u0418\u0415]\n{% endif %}\n{% if $('Edit Fields').item.json.student_homework_text %}\n\"{{ $('Edit Fields').item.json.student_homework_text }}\"\n{% endif %}\n---\n\n\u0422\u0412\u041e\u0418 \u041f\u0420\u0410\u0412\u0418\u041b\u0410:\n1.  **\u041e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0431\u0440\u0430\u0449\u0430\u0439\u0441\u044f \u043a \u0441\u0442\u0443\u0434\u0435\u043d\u0442\u0443 \u043f\u043e \u0438\u043c\u0435\u043d\u0438!**\n2.  \u0415\u0441\u043b\u0438 \u0432 \u0440\u0430\u0431\u043e\u0442\u0435 \u0435\u0441\u0442\u044c `[\u041f\u0420\u0418\u041a\u0420\u0415\u041f\u041b\u0415\u041d\u041e \u0418\u0417\u041e\u0411\u0420\u0410\u0416\u0415\u041d\u0418\u0415]`, \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0439 \u0435\u0433\u043e \u0438 \u0443\u043f\u043e\u043c\u044f\u043d\u0438 \u0432 \u0444\u0438\u0434\u0431\u0435\u043a\u0435. \u0415\u0441\u043b\u0438 \u0435\u0433\u043e \u043d\u0435\u0442, **\u043d\u0438\u043a\u043e\u0433\u0434\u0430** \u043d\u0435 \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u0439 \u0440\u0438\u0441\u0443\u043d\u043a\u0438.\n3.  \u0415\u0441\u043b\u0438 \u0440\u0430\u0431\u043e\u0442\u0430 \u043e\u0441\u043c\u044b\u0441\u043b\u0435\u043d\u043d\u0430\u044f \u0438 \u043f\u043e \u0442\u0435\u043c\u0435 \u2014 \u0441\u0442\u0430\u0432\u044c `\"is_approved\": true`.\n4.  \u0415\u0441\u043b\u0438 \u0440\u0430\u0431\u043e\u0442\u0430 \u043d\u0435 \u043f\u043e \u0442\u0435\u043c\u0435 \u0438\u043b\u0438 \u0431\u0435\u0441\u0441\u043c\u044b\u0441\u043b\u0435\u043d\u043d\u0430\u044f \u2014 `\"is_approved\": false`.\n5.  \u0422\u0432\u043e\u0439 \"feedback_text\" \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043b\u0438\u0447\u043d\u044b\u043c \u0438 \u043e\u0431\u043e\u0434\u0440\u044f\u044e\u0449\u0438\u043c.`",
        "options": {}
      },
      "id": "41174c8a-6ac8-42bd-900e-ca15196600c5",
      "name": "Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.7,
      "position": [
        800,
        -64
      ],
      "retryOnFail": true,
      "notesInFlow": true,
      "alwaysOutputData": true,
      "onError": "continueErrorOutput"
    },
    {
      "parameters": {
        "model": "deepseek/deepseek-chat-v3-0324:free",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "typeVersion": 1,
      "position": [
        704,
        288
      ],
      "id": "04ccc52f-59fe-458b-928e-721efb00a825",
      "name": "OpenRouter Chat Model",
      "credentials": {
        "openRouterApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "aa46a723-619e-42e9-8e51-49ba51813718",
        "authentication": "headerAuth",
        "options": {}
      },
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        -480,
        -160
      ],
      "id": "175c0cfe-cd15-4d42-8ebc-2bbd94f40ea8",
      "name": "Webhook-homework",
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "080ee5fb-782f-47d6-9d64-98ec8e8c52f2",
              "name": "=student_user_id",
              "value": "= {{ $json.body.student_user_id }}",
              "type": "string"
            },
            {
              "id": "78fcca79-e818-4b3c-803f-94deda4f3104",
              "name": "lesson_assignment_description",
              "value": "={{ $json.body.lesson_assignment_description }}",
              "type": "string"
            },
            {
              "id": "969420d2-791b-40a4-924d-ec7e332d3d6b",
              "name": "student_homework_text",
              "value": "={{ $json.body.homework_text }}",
              "type": "string"
            },
            {
              "id": "2d2c5f78-ecaf-408d-acdb-ff6d7a4d086d",
              "name": "student_homework_file_id",
              "value": "={{ $json.body.homework_file_id }}",
              "type": "string"
            },
            {
              "id": "5b60f83f-1667-4f43-9ab5-e7aad6d988f1",
              "name": "callback_webhook_url_result",
              "value": "={{ $json.body.callback_webhook_url_result }}",
              "type": "string"
            },
            {
              "id": "c324098f-8660-4435-acef-09352a9a0a45",
              "name": "user_fullname",
              "value": "={{ $json.body.user_fullname }}",
              "type": "string"
            },
            {
              "id": "753df8c9-e2c2-4ea6-aef4-5608ef8f92b1",
              "name": "expected_homework_type",
              "value": "={{ $json.body.expected_homework_type }}",
              "type": "string"
            },
            {
              "id": "2653261d-4f8b-494d-8bb3-975e69a96b0f",
              "name": "admin_group_id",
              "value": "={{ $json.body.admin_group_id }}",
              "type": "string"
            },
            {
              "id": "2168a0e7-3cb9-44a2-b21c-85050c3405b2",
              "name": "",
              "value": "",
              "type": "string"
            },
            {
              "id": "e55934e8-9d40-41ff-bba3-2a0919b1847e",
              "name": "",
              "value": "",
              "type": "string"
            }
          ]
        },
        "includeOtherFields": true,
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        -224,
        -160
      ],
      "id": "0371cd63-2311-4e51-9196-db02dc02d2ad",
      "name": "Edit Fields",
      "alwaysOutputData": true
    },
    {
      "parameters": {
        "method": "POST",
        "url": "={{ $('Edit Fields').item.json.callback_webhook_url_result }}",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "feedback_text",
              "value": "={{ $('Code').item.json.feedback_text }}"
            },
            {
              "name": "is_approved",
              "value": "={{ $('Code').item.json.is_approved }}"
            },
            {
              "name": "original_admin_message_id",
              "value": "={{ $('Webhook-homework').item.json.body.original_admin_message_id }}"
            },
            {
              "name": "student_user_id",
              "value": "={{ $('Edit Fields').item.json.student_user_id }}"
            },
            {
              "name": "course_numeric_id",
              "value": "={{ $('Webhook-homework').item.json.body.course_numeric_id }}"
            },
            {
              "name": "lesson_num",
              "value": "={{ $('Webhook-homework').item.json.body.lesson_num }}"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1504,
        -128
      ],
      "id": "a54ee3eb-120d-4e0d-8738-4698648c07db",
      "name": "HTTP Request",
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "onError": "continueRegularOutput"
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "=hw-{{ $json.body.student_user_id }}-{{ $json.body.lesson_num }}",
        "contextWindowLength": 1
      },
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        928,
        288
      ],
      "id": "35fdac6f-f0ef-48d1-acb8-bf43721447b1",
      "name": "Simple Memory"
    },
    {
      "parameters": {
        "chatId": "={{ $('Edit Fields').item.json.admin_group_id }}",
        "text": "=\u23f3 \u0418\u0418-\u0430\u0441\u0441\u0438\u0441\u0442\u0435\u043d\u0442 \u043d\u0430\u0447\u0430\u043b \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0414\u0417  {{ $('Edit Fields').item.json.user_fullname.split(' ')[0] }}  {{ $('Edit Fields').item.json.user_fullname.split(' ')[1] }} \u043f\u043e\u0434\u043e\u0436\u0434\u0438\u0442\u0435...",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        64,
        -304
      ],
      "id": "c4aebfe1-5379-46a4-ba53-0e699b7119af",
      "name": "Send a text message",
      "alwaysOutputData": true,
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "mode": "combine",
        "combineBy": "combineByPosition",
        "options": {
          "includeUnpaired": true
        }
      },
      "type": "n8n-nodes-base.merge",
      "typeVersion": 3.2,
      "position": [
        528,
        0
      ],
      "id": "96baedaa-a491-410c-a7c2-c01f3d12b609",
      "name": "Merge",
      "onError": "continueErrorOutput"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "={{ $('Edit Fields').item.json.callback_webhook_url_result }}",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "feedback_text",
              "value": "=OK  \u0412\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u043e\u0434\u043e\u0431\u0440\u0438\u043b\u0438 \u044d\u0442\u043e \u0437\u0430\u0434\u0430\u043d\u0438\u0435 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438. \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0435!"
            },
            {
              "name": "is_approved",
              "value": "=True"
            },
            {
              "name": "original_admin_message_id",
              "value": "={{ $('Webhook-homework').item.json.body.original_admin_message_id }}"
            },
            {
              "name": "student_user_id",
              "value": "={{ $('Edit Fields').item.json.student_user_id }}"
            },
            {
              "name": "course_numeric_id",
              "value": "={{ $('Webhook-homework').item.json.body.course_numeric_id }}"
            },
            {
              "name": "lesson_num",
              "value": "={{ $('Webhook-homework').item.json.body.lesson_num }}"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1520,
        144
      ],
      "id": "974f8c48-9100-4de3-9687-917aabe4eded",
      "name": "HTTP Request2",
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "disabled": true,
      "onError": "continueRegularOutput"
    },
    {
      "parameters": {
        "resource": "file",
        "fileId": "={{ $('Edit Fields').item.json.student_homework_file_id }}",
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        160,
        32
      ],
      "id": "7beb536d-7e55-4d1c-ae8e-aaa24a2e2ab2",
      "name": "Get a file",
      "alwaysOutputData": false,
      "retryOnFail": true,
      "waitBetweenTries": 200,
      "maxTries": 2,
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "onError": "continueErrorOutput"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "5b1189a6-6cee-49af-ad61-c91de051a0ea",
              "leftValue": "={{ $('Edit Fields').item.json.student_homework_file_id }}",
              "rightValue": "",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        0,
        192
      ],
      "id": "b7f55a54-3e58-4919-be23-4275c277c4aa",
      "name": "If"
    },
    {
      "parameters": {
        "jsCode": "const rawOutput = $('Agent').item.json.output;\n\n// \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043d\u0430 \u0441\u043b\u0443\u0447\u0430\u0439 \u043f\u043e\u043b\u043d\u043e\u0439 \u043d\u0435\u0443\u0434\u0430\u0447\u0438\nlet isApproved = true; \nlet feedbackText = `\u0410\u0433\u0435\u043d\u0442 \u0432\u0435\u0440\u043d\u0443\u043b \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u0439 \u043e\u0442\u0432\u0435\u0442, \u043d\u043e \u0437\u0430\u0434\u0430\u043d\u0438\u0435 \u043e\u0434\u043e\u0431\u0440\u0435\u043d\u043e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438. \\n\\n(\u041e\u0442\u0432\u0435\u0442 \u0418\u0418: ${rawOutput})`;\n\n// \u041f\u044b\u0442\u0430\u0435\u043c\u0441\u044f \u043d\u0430\u0439\u0442\u0438 JSON-\u043e\u0431\u044a\u0435\u043a\u0442 \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u0442\u0440\u043e\u043a\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e\u0433\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f.\n// \u042d\u0442\u043e \u0438\u0449\u0435\u0442 \u043f\u0435\u0440\u0432\u0443\u044e '{' \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e '}' \u0438 \u0432\u0441\u0451, \u0447\u0442\u043e \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438.\nconst jsonMatch = rawOutput.match(/({[\\s\\S]*})/);\n\nif (jsonMatch && jsonMatch[1]) {\n  try {\n    // \u0415\u0441\u043b\u0438 JSON \u043d\u0430\u0439\u0434\u0435\u043d, \u043f\u044b\u0442\u0430\u0435\u043c\u0441\u044f \u0435\u0433\u043e \u0440\u0430\u0441\u043f\u0430\u0440\u0441\u0438\u0442\u044c\n    const parsedData = JSON.parse(jsonMatch[1]);\n    \n    // \u0415\u0441\u043b\u0438 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0440\u0430\u0441\u043f\u0430\u0440\u0441\u0438\u043b\u0438, \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435\n    if (typeof parsedData.is_approved === 'boolean') {\n      isApproved = parsedData.is_approved;\n    }\n    if (typeof parsedData.feedback_text === 'string') {\n      feedbackText = parsedData.feedback_text;\n    }\n    console.log(\"\u0423\u0441\u043f\u0435\u0448\u043d\u043e \u0440\u0430\u0441\u043f\u0430\u0440\u0441\u0435\u043d JSON \u0438\u0437 \u043e\u0442\u0432\u0435\u0442\u0430 \u0418\u0418.\");\n\n  } catch (e) {\n    // \u0415\u0441\u043b\u0438 \u0434\u0430\u0436\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0439 \u043a\u0443\u0441\u043e\u043a \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u0430\u043b\u0438\u0434\u043d\u044b\u043c JSON, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e\n    console.error(\"\u041d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0439 JSON \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0440\u0430\u0441\u043f\u0430\u0440\u0441\u0438\u0442\u044c. \u041e\u0448\u0438\u0431\u043a\u0430:\", e.message);\n  }\n} else {\n  // \u0415\u0441\u043b\u0438 JSON \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d, \u0441\u0447\u0438\u0442\u0430\u0435\u043c \u0432\u0435\u0441\u044c \u043e\u0442\u0432\u0435\u0442 \u0444\u0438\u0434\u0431\u0435\u043a\u043e\u043c\n  console.log(\"JSON \u0432 \u043e\u0442\u0432\u0435\u0442\u0435 \u0418\u0418 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d. \u0412\u0435\u0441\u044c \u043e\u0442\u0432\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u0444\u0438\u0434\u0431\u0435\u043a.\");\n  feedbackText = rawOutput;\n  isApproved = true; // \u041e\u0434\u043e\u0431\u0440\u044f\u0435\u043c, \u0442\u0430\u043a \u043a\u0430\u043a \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0432\u0435\u0440\u0434\u0438\u043a\u0442\n}\n\n// \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0432\u0441\u0435\u0433\u0434\u0430 \u0432\u0430\u043b\u0438\u0434\u043d\u044b\u0439 \u0438 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442\nreturn {\n  json: {\n    is_approved: isApproved,\n    feedback_text: feedbackText\n  }\n};"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1264,
        -96
      ],
      "id": "5783c42a-76b8-4de5-8667-bd2cafdb4c8e",
      "name": "Code",
      "onError": "continueErrorOutput"
    }
  ],
  "connections": {
    "OpenRouter Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Agent": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "HTTP Request2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook-homework": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          },
          {
            "node": "If",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send a text message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Send a text message": {
      "main": [
        []
      ]
    },
    "Merge": {
      "main": [
        [
          {
            "node": "Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get a file": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ],
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "If": {
      "main": [
        [
          {
            "node": "Get a file",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Code": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "executionOrder": "v0",
    "callerPolicy": "workflowsFromSameOwner",
    "errorWorkflow": "pZyXNVXDIJDJ5SNQ"
  },
  "versionId": "d021f147-004a-46e1-adb8-99f1038c7f2f",
  "meta": {
    "templateId": "self-building-ai-agent",
    "templateCredsSetupCompleted": true
  },
  "id": "pZyXNVXDIJDJ5SNQ",
  "tags": []
}