{
  "name": "n8n-3-2: c4ai — Local Supabase",
  "nodes": [
    {
      "parameters": {},
      "id": "89388797-ed90-4256-836f-f38e7439b7c4",
      "name": "When clicking ‘Test workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        20,
        755
      ]
    },
    {
      "parameters": {
        "url": "https://ai.pydantic.dev/sitemap.xml",
        "options": {}
      },
      "id": "1b6574bc-c5f8-4f44-9b60-2b735adf1de4",
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        240,
        755
      ]
    },
    {
      "parameters": {
        "options": {}
      },
      "id": "4ddb61a9-f8fd-415a-88b2-8bee44eefd72",
      "name": "XML",
      "type": "n8n-nodes-base.xml",
      "typeVersion": 1,
      "position": [
        460,
        755
      ]
    },
    {
      "parameters": {
        "fieldToSplitOut": "urlset.url",
        "options": {}
      },
      "id": "be6b31f9-3771-41c5-89a5-e7e8fe899d39",
      "name": "Split Out",
      "type": "n8n-nodes-base.splitOut",
      "typeVersion": 1,
      "position": [
        680,
        755
      ]
    },
    {
      "parameters": {
        "options": {}
      },
      "id": "880fa981-cc34-4247-9458-7a34abaac3cf",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 3,
      "position": [
        900,
        755
      ]
    },
    {
      "parameters": {},
      "id": "25089cd2-69b0-4c0f-bcdf-9fa667b36d6c",
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        1300,
        940
      ],
      "webhookId": "9af87c5e-b07f-48dc-9ca8-61b471a24cad"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "http://crawl4ai:11235/crawl",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "urls",
              "value": "={{ $json.loc }}"
            },
            {
              "name": "priority",
              "value": "10"
            }
          ]
        },
        "options": {}
      },
      "id": "c14fbbdf-87b0-40f8-b2de-7b26010d5de4",
      "name": "HTTP Request1",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1080,
        940
      ],
      "credentials": {
        "httpHeaderAuth": {
          "id": "YOokxKz8tNhDV7dQ",
          "name": "Crawl4Ai Local"
        }
      }
    },
    {
      "parameters": {
        "url": "=http://crawl4ai:11235/task/{{ $json.task_id }}",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "options": {
          "timeout": 5000
        }
      },
      "id": "937ba300-004c-45e2-9738-f143f18a7a85",
      "name": "HTTP Request2",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1520,
        940
      ],
      "retryOnFail": true,
      "waitBetweenTries": 5000,
      "credentials": {
        "httpHeaderAuth": {
          "id": "YOokxKz8tNhDV7dQ",
          "name": "Crawl4Ai Local"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "9d90c1ce-590e-40a5-ae8c-d92326032975",
              "leftValue": "={{ $json.status }}",
              "rightValue": "completed",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "9a4417bb-6ace-44cf-b93a-c374c4170e8d",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        1740,
        940
      ]
    },
    {
      "parameters": {
        "jsonMode": "expressionData",
        "jsonData": "={{ $json.result.markdown }}",
        "options": {
          "metadata": {
            "metadataValues": [
              {
                "name": "page",
                "value": "={{ $json.result.url }}"
              }
            ]
          }
        }
      },
      "id": "d927e686-6547-4e9e-997e-6fbf8244f5c7",
      "name": "Default Data Loader",
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "typeVersion": 1,
      "position": [
        2380,
        1320
      ]
    },
    {
      "parameters": {
        "chunkSize": 5000
      },
      "id": "940e0c87-b52f-48fa-aaf5-d046c3995921",
      "name": "Character Text Splitter",
      "type": "@n8n/n8n-nodes-langchain.textSplitterCharacterTextSplitter",
      "typeVersion": 1,
      "position": [
        2520,
        1480
      ]
    },
    {
      "parameters": {
        "options": {}
      },
      "id": "f2eae081-fc30-4121-9be7-09f637384e3f",
      "name": "Embeddings OpenAI",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "typeVersion": 1.1,
      "position": [
        2220,
        1440
      ],
      "credentials": {
        "openAiApi": {
          "id": "qKk5wVYPDLRt63R9",
          "name": "OpenAi account"
        }
      }
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "f2bcdb54-e1fe-4670-99aa-6eec973bf5f1",
              "name": "task_id",
              "value": "={{ $('HTTP Request1').item.json.task_id }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "a775e67b-82c2-44fe-b4fd-92da621a2626",
      "name": "Edit Fields",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1960,
        1060
      ]
    },
    {
      "parameters": {
        "options": {}
      },
      "id": "22ec2434-a04a-4f78-9b59-74c5c2ffa47a",
      "name": "When chat message received",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "typeVersion": 1.1,
      "position": [
        20,
        -80
      ],
      "webhookId": "0949763f-f3f7-46bf-8676-c050d92e6966"
    },
    {
      "parameters": {
        "options": {}
      },
      "id": "d4fd84f0-ebea-4906-b58c-0b678ea0ddbc",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1,
      "position": [
        240,
        140
      ],
      "credentials": {
        "openAiApi": {
          "id": "qKk5wVYPDLRt63R9",
          "name": "OpenAi account"
        }
      }
    },
    {
      "parameters": {},
      "id": "6b82ea13-183b-4818-b1e8-365119fe0ac2",
      "name": "Postgres Chat Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryPostgresChat",
      "typeVersion": 1.3,
      "position": [
        360,
        140
      ],
      "credentials": {
        "postgres": {
          "id": "lt4hahOcPE1uaTY5",
          "name": "Postgres account"
        }
      }
    },
    {
      "parameters": {
        "name": "pydantic_ai_docs",
        "description": "Retrieves data related to Pydantic AI using their documentation."
      },
      "id": "5636c5fe-71a5-48d6-b79a-e2a81a70bf66",
      "name": "Vector Store Tool",
      "type": "@n8n/n8n-nodes-langchain.toolVectorStore",
      "typeVersion": 1,
      "position": [
        480,
        142.5
      ]
    },
    {
      "parameters": {
        "options": {}
      },
      "id": "4efb3d64-52e3-43cc-a0b5-7ad3c6b3dbff",
      "name": "Embeddings OpenAI1",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "typeVersion": 1.1,
      "position": [
        464,
        540
      ],
      "credentials": {
        "openAiApi": {
          "id": "qKk5wVYPDLRt63R9",
          "name": "OpenAi account"
        }
      }
    },
    {
      "parameters": {
        "options": {}
      },
      "id": "3642f101-40db-4b8e-99fc-05e0ff429e29",
      "name": "OpenAI Chat Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1,
      "position": [
        672,
        340
      ],
      "credentials": {
        "openAiApi": {
          "id": "qKk5wVYPDLRt63R9",
          "name": "OpenAi account"
        }
      }
    },
    {
      "parameters": {
        "mode": "insert",
        "tableName": {
          "__rl": true,
          "value": "documents",
          "mode": "list",
          "cachedResultName": "documents"
        },
        "options": {
          "queryName": "match_documents"
        }
      },
      "id": "71d59b10-d129-4c07-8fee-bb60b238a18e",
      "name": "Supabase Vector Store",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreSupabase",
      "typeVersion": 1,
      "position": [
        2300,
        1100
      ],
      "credentials": {
        "supabaseApi": {
          "id": "hUk8rE7m5raNaYML",
          "name": "Supabase account"
        }
      }
    },
    {
      "parameters": {
        "options": {}
      },
      "id": "fb501a71-c1bf-4349-aa24-24521af59dc3",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.7,
      "position": [
        272,
        -80
      ]
    },
    {
      "parameters": {
        "tableName": {
          "__rl": true,
          "value": "documents",
          "mode": "list",
          "cachedResultName": "documents"
        },
        "options": {
          "queryName": "match_documents"
        }
      },
      "id": "480dbf63-4295-4554-9be5-a42e942df44a",
      "name": "Supabase Vector Store1",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreSupabase",
      "typeVersion": 1,
      "position": [
        376,
        342.5
      ],
      "credentials": {
        "supabaseApi": {
          "id": "hUk8rE7m5raNaYML",
          "name": "Supabase account"
        }
      }
    },
    {
      "parameters": {
        "content": "# n8n + Агент Crawl4AI\n\n## Автор: [Коул Медин](https://www.youtube.com/@ColeMedin)\n\nЭтот AI-агент демонстрирует, как использовать развёрнутый через Docker инструмент Crawl4AI — мощный веб-скрейпер с открытым исходным кодом — прямо внутри n8n.\n\nПеред началом работы убедитесь, что Crawl4AI уже развёрнут в Docker-контейнере по [инструкциям из документации](https://docs.crawl4ai.com/core/docker-deployment/).\n\n## Как использовать этот процесс\n\n1. Запустите нижний workflow, нажав «Test workflow». Это загрузит всю документацию Pydantic AI в базу данных Supabase для RAG.\n\n2. Общайтесь с агентом через кнопку «Chat» — он сможет отвечать на вопросы по документации Pydantic AI!\n\n## Расширьте workflow!\n\nЭто лишь отправная точка, показывающая, как интегрировать Crawl4AI и n8n. Используйте эту основу и документацию Crawl4AI для создания любых RAG AI-агентов. Возможности такого подхода безграничны!",
        "height": 613.6610941618816,
        "width": 589.875,
        "color": 6
      },
      "id": "b5ec6832-c333-4f96-a52c-39d1ac50b441",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        860,
        -100
      ]
    }
  ],
  "pinData": {},
  "connections": {
    "When clicking ‘Test workflow’": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "XML",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "XML": {
      "main": [
        [
          {
            "node": "Split Out",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "HTTP Request1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "HTTP Request2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request1": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request2": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If": {
      "main": [
        [
          {
            "node": "Supabase Vector Store",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Default Data Loader": {
      "ai_document": [
        [
          {
            "node": "Supabase Vector Store",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "Character Text Splitter": {
      "ai_textSplitter": [
        [
          {
            "node": "Default Data Loader",
            "type": "ai_textSplitter",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI": {
      "ai_embedding": [
        [
          {
            "node": "Supabase Vector Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Postgres Chat Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Vector Store Tool": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI1": {
      "ai_embedding": [
        [
          {
            "node": "Supabase Vector Store1",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Vector Store Tool",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Supabase Vector Store": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Supabase Vector Store1": {
      "ai_vectorStore": [
        [
          {
            "node": "Vector Store Tool",
            "type": "ai_vectorStore",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "2d4526d7e2b7123bfb0e1996caa47744a7651d73096bbc7220a5e9657d119dfc"
  },
  "tags": [],
  "id": "iWPU8UIUuBy6TkFW",
  "versionId": "45a0ec5f-806c-4310-8df3-78e8d4ecacde"
}
