{
  "name": "AI agent that can scrape webpages",
  "nodes": [
    {
      "id": "02072c77-9eee-43bc-a046-bdc31bf1bc51",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -240,
        1280
      ],
      "parameters": {
        "width": 616,
        "height": 236,
        "content": "### Convert the query string into JSON, apply the limit for a page length"
      }
    },
    {
      "id": "31e7582c-9289-4bd3-b89d-c3d866754313",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        820,
        980
      ],
      "parameters": {
        "width": 491,
        "height": 285.7,
        "content": "## Send an error message:\n1. If query param was incorrect, return the instruction. AI Agent should pick up on this and adapt the query on the next iteration.\n2. If the query is OK and an error was dur"
      }
    },
    {
      "id": "0f3ec3c8-076a-4f22-a9ab-4623494914ff",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        820,
        1300
      ],
      "parameters": {
        "width": 1200,
        "height": 493,
        "content": "## Post-processing of the HTML page:\n1. Keep only <BODY> content\n2. Remove inline <SCRIPT> tag entirely, as well as: NOSCRIPT, IFRAME, OBJECT, EMBED, VIDEO, AUDIO, SVG, and HTML comments.\n3. In case q"
      }
    },
    {
      "id": "139733cc-7954-459e-9b55-15a3bde4d8b7",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -240,
        680
      ],
      "parameters": {
        "width": 617,
        "height": 503,
        "content": "## Example ReAct AI Agent\n1. Agent Prompt is default\n2. Check the description of the HTTP_Request_Tool, it guides the agent to provide a query string with several parameters instead of a JSON object"
      }
    },
    {
      "id": "2b5ee7e4-061d-4a17-8581-54e02086a49a",
      "name": "When chat message received",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -200,
        840
      ]
    },
    {
      "id": "adc5e4d7-bccf-4ee7-9464-5cbb7b1409ba",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        20,
        840
      ]
    },
    {
      "id": "10ccad7d-2c83-4fd9-beb9-a99e1c034947",
      "name": "OpenAI Chat Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        20,
        1040
      ]
    },
    {
      "id": "5d582c5f-35d3-4cdb-96ad-fa750be0b889",
      "name": "When Executed by Another Workflow",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "position": [
        -160,
        1340
      ]
    },
    {
      "id": "1f073e7d-2cdd-426e-8d05-287fdf20f564",
      "name": "QUERY_PARAMS",
      "type": "n8n-nodes-base.set",
      "position": [
        20,
        1340
      ]
    },
    {
      "id": "e9f627af-e935-478e-a2b1-b50ea57d14b1",
      "name": "CONFIG",
      "type": "n8n-nodes-base.set",
      "position": [
        200,
        1340
      ]
    },
    {
      "id": "0309fb92-6785-4e38-aaeb-05ee4b6a64e2",
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        440,
        1340
      ]
    },
    {
      "id": "9c8b9856-a403-405c-afd4-9e9fecaa5913",
      "name": "Is error?",
      "type": "n8n-nodes-base.if",
      "position": [
        620,
        1340
      ]
    },
    {
      "id": "d7275d78-2c59-4b8f-bb8e-481f73827fd5",
      "name": "Stringify error message",
      "type": "n8n-nodes-base.set",
      "position": [
        880,
        1120
      ]
    },
    {
      "id": "f7ca9e36-5edb-4573-a258-150c5bdcc644",
      "name": "Exctract HTML Body",
      "type": "n8n-nodes-base.set",
      "position": [
        900,
        1620
      ]
    },
    {
      "id": "9fef995b-d8ab-4d01-b2fb-01a605062fd1",
      "name": "Remove extra tags",
      "type": "n8n-nodes-base.set",
      "position": [
        1080,
        1620
      ]
    },
    {
      "id": "4897d31a-6425-4838-b934-95b1451cae61",
      "name": "Simplify?",
      "type": "n8n-nodes-base.if",
      "position": [
        1260,
        1620
      ]
    },
    {
      "id": "997c724c-ea8f-4536-a389-ac8429d57448",
      "name": "Simplify output",
      "type": "n8n-nodes-base.set",
      "position": [
        1440,
        1520
      ]
    },
    {
      "id": "440a8076-3901-42e2-a36a-bc47ff588dd4",
      "name": "Convert to Markdown",
      "type": "n8n-nodes-base.markdown",
      "position": [
        1620,
        1620
      ]
    },
    {
      "id": "a2fbeb5e-3e82-4777-bb61-3e475ffe2fc8",
      "name": "Send Page Content",
      "type": "n8n-nodes-base.set",
      "position": [
        1820,
        1620
      ]
    },
    {
      "id": "d367adfd-efd8-49e3-bed3-d65f23a60a9a",
      "name": "HTTP_Request_Tool",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [
        200,
        1040
      ]
    }
  ],
  "connections": {
    "CONFIG": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is error?": {
      "main": [
        [
          {
            "node": "Stringify error message",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Exctract HTML Body",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simplify?": {
      "main": [
        [
          {
            "node": "Simplify output",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Convert to Markdown",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "Is error?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "QUERY_PARAMS": {
      "main": [
        [
          {
            "node": "CONFIG",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simplify output": {
      "main": [
        [
          {
            "node": "Convert to Markdown",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP_Request_Tool": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Remove extra tags": {
      "main": [
        [
          {
            "node": "Simplify?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Exctract HTML Body": {
      "main": [
        [
          {
            "node": "Remove extra tags",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Convert to Markdown": {
      "main": [
        [
          {
            "node": "Send Page Content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When Executed by Another Workflow": {
      "main": [
        [
          {
            "node": "QUERY_PARAMS",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}