Início/Agentes & Fundamentos/Módulo 3.3

Agentes & Fundamentos · Módulo 3/6

Agente com outro workflow n8n como ferramenta

Workflow pronto para importar no n8n.

Descrição

_(sem descrição)_

Recursos baixados

Texto de 32-ai-agent-with-a-separate-n8n-workflow-as-a-tool-1.json

{
  "name": "First Sample",
  "nodes": [
    {
      "parameters": {
        "model": "gpt-4",
        "options": {}
      },
      "id": "f969167b-fa0d-41c0-a8ce-d34f3f1b34a9",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1,
      "position": [
        460,
        840
      ],
      "credentials": {
        "openAiApi": {
          "id": "y0AJhOYgMZwDjwTx",
          "name": "OpenAi account"
        }
      }
    },
    {
      "parameters": {},
      "id": "27f47d20-51ef-4bc6-8fff-895b19b7bf91",
      "name": "Wikipedia",
      "type": "@n8n/n8n-nodes-langchain.toolWikipedia",
      "typeVersion": 1,
      "position": [
        800,
        860
      ]
    },
    {
      "parameters": {},
      "id": "ef11b507-48b0-4cb9-b3d5-33178027fd6d",
      "name": "When chat message received",
      "type": "@n8n/n8n-nodes-langchain.manualChatTrigger",
      "typeVersion": 1.1,
      "position": [
        460,
        540
      ]
    },
    {
      "parameters": {
        "name": "WeatherTool",
        "description": "Use this tool to get the current weather data for a specific city. Input should be the name of the city. ",
        "workflowId": "hpSY1janE56lFPIV"
      },
      "id": "8c52d3f1-ec39-42c8-9655-41a95b4d87cd",
      "name": "Call n8n Workflow Tool",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "typeVersion": 1.1,
      "position": [
        960,
        840
      ]
    },
    {
      "parameters": {},
      "id": "13d43d7c-e0b5-40bf-8d08-6bda538b7ac1",
      "name": "Window Buffer Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.2,
      "position": [
        620,
        860
      ]
    },
    {
      "parameters": {
        "options": {}
      },
      "id": "142f3302-7ff3-4205-acd3-953c74737b0a",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.6,
      "position": [
        680,
        540
      ]
    }
  ],
  "pinData": {},
  "connections": {
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Wikipedia": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Call n8n Workflow Tool": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Window Buffer Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "8d8d1379-66e0-471a-9604-d0209f05b9e6",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "ae56acec072bc16273543d89bb011ed9ab6cf3dacd823d15e41231870330f72a"
  },
  "id": "ek7bBYG0oF0KirFk",
  "tags": []
}

Texto de 32-ai-agent-with-a-separate-n8n-workflow-as-a-tool-2.json

{
  "name": "Weather Data Workflow",
  "nodes": [
    {
      "parameters": {
        "format": "imperial",
        "cityName": "={{ $json.query }}"
      },
      "id": "597b43e7-adbb-4aba-a81e-67b8b264bc06",
      "name": "OpenWeatherMap",
      "type": "n8n-nodes-base.openWeatherMap",
      "typeVersion": 1,
      "position": [
        920,
        480
      ],
      "credentials": {
        "openWeatherMapApi": {
          "id": "BWBUla0sgZY1YSpK",
          "name": "OpenWeatherMap account"
        }
      }
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "539efdcc-6e80-4884-88ed-e8088af58e13",
              "name": "query",
              "value": "={{ $json.query }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "bab88e1e-0a77-4de2-bbf9-0ab81823af2c",
      "name": "Query",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        720,
        480
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "2214fda7-6d94-4ef8-9c1c-9c47c5f9c7e9",
              "name": "response",
              "value": "={{ $json.message.content }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "5aad1762-f462-46e9-8b76-a59f7c92caa8",
      "name": "Response",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1480,
        480
      ]
    },
    {
      "parameters": {},
      "id": "8c262314-3113-46bd-941e-9721d0c989ef",
      "name": "Execute Workflow Trigger",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "typeVersion": 1,
      "position": [
        480,
        480
      ]
    },
    {
      "parameters": {
        "modelId": {
          "__rl": true,
          "value": "gpt-4o-mini",
          "mode": "list",
          "cachedResultName": "GPT-4O-MINI"
        },
        "messages": {
          "values": [
            {
              "content": "=Please convert the input from openweathermap into plain English with a friendly tone. Also, use relevant emojis to make it prettier. make sure you remove the line breaks (for example = \\n\\n) here is the weather data for {{ $json.name }}:\n\n{{ $json.weather[0].description }}\n{{ JSON.stringify($json.main) }}\n\n\n"
            }
          ]
        },
        "options": {}
      },
      "id": "dbe09cab-eb5f-4d16-81b2-f35ca62c4180",
      "name": "OpenAI",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1.4,
      "position": [
        1120,
        480
      ],
      "credentials": {
        "openAiApi": {
          "id": "y0AJhOYgMZwDjwTx",
          "name": "OpenAi account"
        }
      }
    }
  ],
  "pinData": {},
  "connections": {
    "OpenWeatherMap": {
      "main": [
        [
          {
            "node": "OpenAI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Query": {
      "main": [
        [
          {
            "node": "OpenWeatherMap",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Execute Workflow Trigger": {
      "main": [
        [
          {
            "node": "Query",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI": {
      "main": [
        [
          {
            "node": "Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "0824be63-5344-41d9-abf4-f15c3b825f3d",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "ae56acec072bc16273543d89bb011ed9ab6cf3dacd823d15e41231870330f72a"
  },
  "id": "hpSY1janE56lFPIV",
  "tags": []
}
← Anterior
Agente de pesquisa com SerpAPI
Próximo →
Agente com banco vetorial Pinecone