{
  "name": "Outscraper - AI Agent AI Scraper schema extraction",
  "nodes": [
    {
      "parameters": {},
      "id": "cc7a01d3-0439-4fdd-8a33-4d508c6b99ad",
      "name": "Manual Trigger",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        0,
        0
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "url",
              "name": "url",
              "type": "string",
              "value": "https://example.com/products"
            },
            {
              "id": "prompt",
              "name": "prompt",
              "type": "string",
              "value": "Extract all product cards with title, price, description, availability, and product URL."
            }
          ]
        },
        "options": {}
      },
      "id": "d7afa408-6cfe-4be3-9a2b-4c2ec3772b84",
      "name": "Set Page",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        224,
        0
      ]
    },
    {
      "parameters": {
        "resource": "aiScraper",
        "query": "={{$json.url}}",
        "prompt": "={{$json.prompt}}",
        "useSchema": true,
        "schemaFields": {
          "fields": [
            {
              "name": "products[]",
              "type": "object"
            },
            {
              "name": "products[].title",
              "required": true
            },
            {
              "name": "products[].price",
              "type": "number"
            },
            {
              "name": "products[].description"
            },
            {
              "name": "products[].availability"
            },
            {
              "name": "products[].url"
            }
          ]
        },
        "requestOptions": {}
      },
      "id": "b15b2dcf-fcf1-4e53-89fa-19f533be3cba",
      "name": "Outscraper - AI Scraper Products",
      "type": "n8n-nodes-outscraper.outscraper",
      "typeVersion": 2,
      "position": [
        464,
        0
      ],
      "credentials": {
        "outscraperApi": {
          "id": "8AvSJfwIww0gbyf7",
          "name": "Outscraper account"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "function findProducts(v){if(!v)return []; if(Array.isArray(v))return v.flatMap(findProducts); if(typeof v==='object'){if(Array.isArray(v.products))return v.products; for(const key of ['data','result','results','items']){const found=findProducts(v[key]); if(found.length)return found;}} return [];} const products=$input.all().flatMap(i=>findProducts(i.json)).map(p=>({title:p.title||'', price:p.price||null, description:p.description||'', availability:p.availability||'', url:p.url||p.link||''})); return [{json:{product_count:products.length, products}}];"
      },
      "id": "2f69f838-9ae7-42d6-80dd-688b3450e276",
      "name": "Normalize Products for Agent",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        704,
        0
      ]
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=Review this Outscraper AI Scraper extraction. Use the connected structured output parser and return only the requested JSON shape. Focus on extraction quality, pricing signals, anomalies, and how to improve the next schema. Input JSON: {{ JSON.stringify($json) }}",
        "hasOutputParser": true,
        "options": {
          "enableStreaming": false
        }
      },
      "id": "c2ddcce2-0c9f-4519-b572-eaad7d3317c0",
      "name": "AI Agent - Extraction QA",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 3.1,
      "position": [
        992,
        0
      ]
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "value": "gpt-5.4-mini",
          "mode": "list",
          "cachedResultName": "gpt-5.4-mini"
        },
        "builtInTools": {},
        "options": {}
      },
      "id": "04829c5d-5a12-45bb-89a7-4e821e96e0be",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.3,
      "position": [
        928,
        224
      ],
      "credentials": {
        "openAiApi": {
          "id": "cF6D8w13EQm9nSZt",
          "name": "OpenAI account"
        }
      }
    },
    {
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "{\n  \"type\": \"object\",\n  \"additionalProperties\": false,\n  \"required\": [\"catalog_summary\", \"price_range\", \"missing_fields\", \"anomalies\", \"recommended_follow_up_schema\", \"next_action\"],\n  \"properties\": {\n    \"catalog_summary\": { \"type\": \"string\" },\n    \"price_range\": {\n      \"type\": \"object\",\n      \"additionalProperties\": false,\n      \"required\": [\"min\", \"max\", \"currency\", \"confidence\"],\n      \"properties\": {\n        \"min\": { \"type\": \"number\" },\n        \"max\": { \"type\": \"number\" },\n        \"currency\": { \"type\": \"string\" },\n        \"confidence\": {\n          \"type\": \"string\",\n          \"enum\": [\"low\", \"medium\", \"high\"]\n        }\n      }\n    },\n    \"missing_fields\": {\n      \"type\": \"array\",\n      \"items\": { \"type\": \"string\" }\n    },\n    \"anomalies\": {\n      \"type\": \"array\",\n      \"items\": {\n        \"type\": \"object\",\n        \"additionalProperties\": false,\n        \"required\": [\"field\", \"problem\", \"example\"],\n        \"properties\": {\n          \"field\": { \"type\": \"string\" },\n          \"problem\": { \"type\": \"string\" },\n          \"example\": { \"type\": \"string\" }\n        }\n      }\n    },\n    \"recommended_follow_up_schema\": {\n      \"type\": \"object\",\n      \"additionalProperties\": false,\n      \"required\": [\"fields_to_add\", \"fields_to_remove\", \"notes\"],\n      \"properties\": {\n        \"fields_to_add\": {\n          \"type\": \"array\",\n          \"items\": { \"type\": \"string\" }\n        },\n        \"fields_to_remove\": {\n          \"type\": \"array\",\n          \"items\": { \"type\": \"string\" }\n        },\n        \"notes\": { \"type\": \"string\" }\n      }\n    },\n    \"next_action\": { \"type\": \"string\" }\n  }\n}"
      },
      "id": "65be17f4-61f0-4c2d-af09-79d51a0db23d",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "typeVersion": 1.3,
      "position": [
        1184,
        208
      ]
    }
  ],
  "pinData": {},
  "connections": {
    "Manual Trigger": {
      "main": [
        [
          {
            "node": "Set Page",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Page": {
      "main": [
        [
          {
            "node": "Outscraper - AI Scraper Products",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Outscraper - AI Scraper Products": {
      "main": [
        [
          {
            "node": "Normalize Products for Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize Products for Agent": {
      "main": [
        [
          {
            "node": "AI Agent - Extraction QA",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent - Extraction QA",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "AI Agent - Extraction QA",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1",
    "binaryMode": "separate"
  },
  "versionId": "dea83dc6-49ff-419f-82cc-8c2840bc265a",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "bd51ba3d599fc63602ae14309acd27ef3912f3068784a786f28ba05657ba8dbb"
  },
  "id": "7qU90Bagx4hNSsQl",
  "tags": []
}
