Bucle de retroalimentación de múltiples agentes
Este es unContent Creation, Multimodal AIflujo de automatización del dominio deautomatización que contiene 13 nodos.Utiliza principalmente nodos como If, Set, Code, ManualTrigger, SplitInBatches. Optimización iterativa de contenido basada en el sistema de retroalimentación multiagente de GPT-4
- •Clave de API de OpenAI
Nodos utilizados (13)
Categoría
{
"id": "rdQbhY9lEyDizxvy",
"meta": {
"instanceId": "205780d3749915e5b72849aad8492ed96140f3a3cf0d7f077a27e6df51ded409",
"templateCredsSetupCompleted": true
},
"name": "Multi-Agent Feedback Loops",
"tags": [
{
"id": "o58aq7CrdbXQHYA0",
"name": "template",
"createdAt": "2025-06-14T10:20:41.387Z",
"updatedAt": "2025-06-14T10:20:41.387Z"
}
],
"nodes": [
{
"id": "74337855-c422-4186-9510-ce899d67e39f",
"name": "Agente de IA",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
-1180,
240
],
"parameters": {
"text": "=Product: {{$json[\"productDescription\"]}}",
"options": {
"systemMessage": "You are a creative branding agent. Based on this product description, generate 3 distinct name + tagline options.\n\nReturn your output in this format:\n[\n { \"name\": \"Name1\", \"tagline\": \"Tagline1\" },\n { \"name\": \"Name2\", \"tagline\": \"Tagline2\" },\n { \"name\": \"Name3\", \"tagline\": \"Tagline3\" }\n]\n"
},
"promptType": "define"
},
"typeVersion": 2
},
{
"id": "e056b2fa-3e6f-4fa7-b908-dba91d01ec61",
"name": "Bucle sobre elementos",
"type": "n8n-nodes-base.splitInBatches",
"position": [
-780,
240
],
"parameters": {
"options": {
"reset": true
}
},
"typeVersion": 3
},
{
"id": "f7c4971f-1ea8-4448-ab73-35d945d76604",
"name": "Si",
"type": "n8n-nodes-base.if",
"position": [
-360,
360
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "or",
"conditions": [
{
"id": "595ebd64-59de-470c-9827-24d204db58f9",
"operator": {
"type": "number",
"operation": "equals"
},
"leftValue": "={{ $json.turn }}",
"rightValue": 5
},
{
"id": "fb2ec186-4676-4e91-85b1-af7ce745b203",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.done }}",
"rightValue": "Yes"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "b8c57f43-6f23-4e05-81c0-6c1db0264f18",
"name": "Agente Crítico",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
-120,
420
],
"parameters": {
"text": "=Ideas:\n{{JSON.stringify($('Edit Fields').item.json.ideas)}}",
"options": {
"systemMessage": "You are a critical branding analyst. For each name + tagline below, provide a short flaw summary and a suggestion for improvement."
},
"promptType": "define"
},
"typeVersion": 2
},
{
"id": "cdcab121-8082-4295-aa7f-475bde50414e",
"name": "Agente de Refinamiento",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
320,
520
],
"parameters": {
"text": "=**Original Ideas:** {{ JSON.stringify($('Edit Fields').item.json.ideas) }}\n\n**Critics Feedback:** {{ $json.output }}",
"options": {
"systemMessage": "You are a refiner. Use the original ideas and the critic’s feedback to create 3 improved name + tagline combinations.\n\nBe concise, clever, and impactful.\n\nReturn your output in this format:\n[\n { \"name\": \"Name1\", \"tagline\": \"Tagline1\" },\n { \"name\": \"Name2\", \"tagline\": \"Tagline2\" },\n { \"name\": \"Name3\", \"tagline\": \"Tagline3\" }\n]\n"
},
"promptType": "define"
},
"typeVersion": 2
},
{
"id": "9a63dab8-269c-4073-bdf5-8661fcbfdc82",
"name": "Editar campos",
"type": "n8n-nodes-base.set",
"position": [
-560,
360
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "1c6c6fc2-96de-469a-b30f-7ffae52c9847",
"name": "ideas",
"type": "array",
"value": "={{ $json.output }}"
},
{
"id": "1a857aee-ae3f-4e81-a09c-a9e83edd9b98",
"name": "turn",
"type": "number",
"value": "={{ $json.turn || 1}}"
},
{
"id": "d310985b-59a3-44b8-aa5a-e77f2b352ae4",
"name": "done",
"type": "string",
"value": "={{ $json.done || \"No\"}}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "cdf532b0-6dd9-43e6-a1b2-76edb177e9fa",
"name": "Código",
"type": "n8n-nodes-base.code",
"position": [
1180,
880
],
"parameters": {
"jsCode": "const ideas = $json.output.ideas || [];\nconst currentTurn = $json.output.turn ?? 0;\nconst currentDone = $json.output.done || \"No\";\n\nconst nextTurn = currentTurn + 1;\n\nreturn [\n {\n json: {\n ideas,\n turn: nextTurn,\n done: currentDone\n }\n }\n];\n"
},
"typeVersion": 2
},
{
"id": "6d853089-99d1-4ee9-bd80-34ebcc2fd5a3",
"name": "Editar campos1",
"type": "n8n-nodes-base.set",
"position": [
1400,
880
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "21a77915-3d73-450d-bc9c-f655471a3b56",
"name": "output",
"type": "array",
"value": "={{ $json.ideas }}"
},
{
"id": "6dee88ae-c3f3-464a-a3cc-179bd28b7c5e",
"name": "turn",
"type": "number",
"value": "={{ $json.turn }}"
},
{
"id": "2f2caa57-797c-4fa3-9126-da46777a2b63",
"name": "done",
"type": "string",
"value": "={{ $json.done }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "3702b8fc-61e2-4d01-aa10-0ddb5bff48c7",
"name": "OpenAI Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
-100,
800
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-mini",
"cachedResultName": "gpt-4.1-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "oPvbzpxkrzwKpKeY",
"name": "OpenAi account"
}
},
"typeVersion": 1.2
},
{
"id": "17809998-4a9c-41d9-984e-c17cc24e7769",
"name": "Analizador de Salida Estructurada",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
880,
820
],
"parameters": {
"jsonSchemaExample": "{\n\t\"ideas\": [\n { \"name\": \"EnterpriseMind\", \"tagline\": \"Harness AI to transform your business ideas into reality.\" },\n { \"name\": \"InnoLogix\", \"tagline\": \"Capture and evolve your entrepreneurial ideas with AI-powered journaling.\" },\n { \"name\": \"VentureScript\", \"tagline\": \"Document and accelerate your startup journey with intelligent AI journaling.\" }],\n \"done\": \"Yes\",\n \"turn\": 2\n}"
},
"typeVersion": 1.2
},
{
"id": "b47e29f2-bd26-4e9f-813f-2983b1841d33",
"name": "Al hacer clic en 'Ejecutar flujo de trabajo'",
"type": "n8n-nodes-base.manualTrigger",
"position": [
-1360,
240
],
"parameters": {},
"typeVersion": 1
},
{
"id": "7d996197-5542-4d89-8c58-ced050c7fffc",
"name": "Nota adhesiva",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1920,
120
],
"parameters": {
"color": 5,
"width": 3920,
"height": 1160,
"content": "# ⚙️ Setup Guide\n## This is a workflow for user's customization.\n### 🧑💻 Author: [Sebastian/OptiLever](www.linkedin.com/in/sebastian-9ab9b9242)\n\n### 🚀 Prerequisite:\n\n**1. Connect to Openai API account.**\n\n\n---\n\n### 🚀 Steps to Connect:\n\n\n1. **Edit Fields Node Setup (Initial)**\n- Locate the **\"Edit Fields\"** node at the beginning of the workflow.\n- **Edit the following fields:**\n- Ensure the input field **\"ideas\"** is set as an array.\n- Add a field **\"turn\"** to track the number of loop iterations (default value: 1).\n- Add a field **\"done\"** to track if the evaluation is complete (default value: false).\n\n\n\n2. **Critic Agent Setup**\n- Configure the **\"Critic Agent\"** node to analyze the input and provide feedback.\n- Ensure the output is structured to include suggestions for improvements.\n\n\n\n3. **Refiner Agent Setup**\n- Configure the **\"Refiner Agent\"** node to use the original input and critic feedback.\n- Ensure the output is an improved version of the input (e.g., three improved names and taglines).\n\n\n\n4. **Evaluation Agent Setup**\n- Configure the **\"Evaluation Agent\"** node to rank the refined outputs.\n- Ensure the output includes a **\"done\"** field indicating if the result is satisfactory.\n\n\n\n5. **Edit Fields Node Setup (Final)**\n- Ensure the final **\"Edit Fields\"** node matches the structure of the initial input.\n- This ensures the loop can process the data correctly in each iteration.\n\n\n\n6. **If Node Setup**\n- Configure the **\"If\"** node to check if **\"turn\"** exceeds a threshold (e.g., 5) or if **\"done\"** is true.\n- If true, exit the loop and proceed to the next step in the workflow.\n\n\n\n7. **Optional: Additional AI Agents**\n- Add additional AI agents after the loop to further process the final output.\n\n\n---\n\n\n"
},
"typeVersion": 1
},
{
"id": "d64015c8-17f1-4fcc-a12f-f29d2ac0aa75",
"name": "Agente de evaluación",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
700,
640
],
"parameters": {
"text": "=**Results To Examine:** {{ $json.output }}\n\n**Turns Through Loop:** {{ $('Edit Fields').item.json.turn }}",
"options": {
"systemMessage": "You are an evaluator. Rank the 3 improved name ideas and taglines. Recommend if the names and taglines are so awesome that it would make anyone want to purchase from this company, or further improvement is needed (Yes/No). Output a JSON that follows this format:\n{\n\t\"ideas\": [\n { \"name\": \"EnterpriseMind\", \"tagline\": \"Harness AI to transform your business ideas into reality.\" },\n { \"name\": \"InnoLogix\", \"tagline\": \"Capture and evolve your entrepreneurial ideas with AI-powered journaling.\" },\n { \"name\": \"VentureScript\", \"tagline\": \"Document and accelerate your startup journey with intelligent AI journaling.\" }],\n \"done\": \"Yes\",\n \"turn\": 2\n}"
},
"promptType": "define",
"hasOutputParser": true
},
"typeVersion": 2
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "40c2c451-49fd-4266-94e1-3b66cabf6ebc",
"connections": {
"f7c4971f-1ea8-4448-ab73-35d945d76604": {
"main": [
[],
[
{
"node": "b8c57f43-6f23-4e05-81c0-6c1db0264f18",
"type": "main",
"index": 0
}
]
]
},
"cdf532b0-6dd9-43e6-a1b2-76edb177e9fa": {
"main": [
[
{
"node": "6d853089-99d1-4ee9-bd80-34ebcc2fd5a3",
"type": "main",
"index": 0
}
]
]
},
"74337855-c422-4186-9510-ce899d67e39f": {
"main": [
[
{
"node": "e056b2fa-3e6f-4fa7-b908-dba91d01ec61",
"type": "main",
"index": 0
}
]
]
},
"9a63dab8-269c-4073-bdf5-8661fcbfdc82": {
"main": [
[
{
"node": "f7c4971f-1ea8-4448-ab73-35d945d76604",
"type": "main",
"index": 0
}
]
]
},
"b8c57f43-6f23-4e05-81c0-6c1db0264f18": {
"main": [
[
{
"node": "cdcab121-8082-4295-aa7f-475bde50414e",
"type": "main",
"index": 0
}
]
]
},
"6d853089-99d1-4ee9-bd80-34ebcc2fd5a3": {
"main": [
[
{
"node": "e056b2fa-3e6f-4fa7-b908-dba91d01ec61",
"type": "main",
"index": 0
}
]
]
},
"cdcab121-8082-4295-aa7f-475bde50414e": {
"main": [
[
{
"node": "d64015c8-17f1-4fcc-a12f-f29d2ac0aa75",
"type": "main",
"index": 0
}
]
]
},
"e056b2fa-3e6f-4fa7-b908-dba91d01ec61": {
"main": [
[],
[
{
"node": "9a63dab8-269c-4073-bdf5-8661fcbfdc82",
"type": "main",
"index": 0
}
]
]
},
"d64015c8-17f1-4fcc-a12f-f29d2ac0aa75": {
"main": [
[
{
"node": "cdf532b0-6dd9-43e6-a1b2-76edb177e9fa",
"type": "main",
"index": 0
}
]
]
},
"3702b8fc-61e2-4d01-aa10-0ddb5bff48c7": {
"ai_languageModel": [
[
{
"node": "74337855-c422-4186-9510-ce899d67e39f",
"type": "ai_languageModel",
"index": 0
},
{
"node": "b8c57f43-6f23-4e05-81c0-6c1db0264f18",
"type": "ai_languageModel",
"index": 0
},
{
"node": "cdcab121-8082-4295-aa7f-475bde50414e",
"type": "ai_languageModel",
"index": 0
},
{
"node": "d64015c8-17f1-4fcc-a12f-f29d2ac0aa75",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"17809998-4a9c-41d9-984e-c17cc24e7769": {
"ai_outputParser": [
[
{
"node": "d64015c8-17f1-4fcc-a12f-f29d2ac0aa75",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"b47e29f2-bd26-4e9f-813f-2983b1841d33": {
"main": [
[
{
"node": "74337855-c422-4186-9510-ce899d67e39f",
"type": "main",
"index": 0
}
]
]
}
}
}¿Cómo usar este flujo de trabajo?
Copie el código de configuración JSON de arriba, cree un nuevo flujo de trabajo en su instancia de n8n y seleccione "Importar desde JSON", pegue la configuración y luego modifique la configuración de credenciales según sea necesario.
¿En qué escenarios es adecuado este flujo de trabajo?
Intermedio - Creación de contenido, IA Multimodal
¿Es de pago?
Este flujo de trabajo es completamente gratuito, puede importarlo y usarlo directamente. Sin embargo, tenga en cuenta que los servicios de terceros utilizados en el flujo de trabajo (como la API de OpenAI) pueden requerir un pago por su cuenta.
Flujos de trabajo relacionados recomendados
Sebastian/OptiLever
@lewxiangangCompartir este flujo de trabajo