Workflow running enslessly

Hi, I have a workflow with an AI agent that feeds from Google Sheets. The agent is connected to an Openai node and a SerpAPI node, and is tasked with looking up a site domain and providing insight.
When I execute manually (for testing) the workflow runs endlessly, eating u tokens and not returning anything. I can’t figure out why this is.
I’m new to n8n, would love sone feedback.
Thanks.

Describe the problem/error/question

What is the error message (if any)?

Please share your workflow

{
  "nodes": [
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {
          "maxRetries": 5
        }
      },
      "id": "17d4326a-ee4c-4f40-b753-0574623a7e14",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        64,
        464
      ],
      "typeVersion": 1.2,
      "credentials": {
        "openAiApi": {
          "id": "NB9zscGqdry9a3YX",
          "name": "OpenAi account"
        }
      }
    },
    {
      "parameters": {
        "options": {}
      },
      "id": "ec73d7f7-3643-481d-ac42-2bbaccd5e89c",
      "name": "SerpAPI",
      "type": "@n8n/n8n-nodes-langchain.toolSerpApi",
      "position": [
        640,
        464
      ],
      "typeVersion": 1,
      "credentials": {
        "serpApi": {
          "id": "XtYNSIOEjTgnQnxV",
          "name": "Yuval's SerpAPI"
        }
      }
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=Someone from {{ $json['Company Domain'] }} visited my website, and I want you to help me qulify them as a potential lead.\n\nOur target customers are retailers, consumer goods brands, e-commerce websites and cunsumer goods manufacturers.\n\nTo qualify this lead, please research {{ $json['Company Domain'] }} and answer the following criteria:\n1. Is this a retailer, consumer goods brand, e-comerce store, consumer goods manufacturer?\n2. Is the company arge or small? How many employees? How much annual revenue?\n3. What other general information is there that may help me qualify them as a potential customer?",
        "options": {
          "maxIterations": 5
        }
      },
      "id": "fe98d8d1-be6d-49d0-bc8f-b382f210f8bf",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        336,
        0
      ],
      "typeVersion": 1.8,
      "alwaysOutputData": false,
      "executeOnce": false
    }
  ],
  "connections": {
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "SerpAPI": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        []
      ]
    }
  },
  "pinData": {},
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "9f71ebf2c4050f167cc4802f9e81b19ba5c495115b922167c6bcaaf6322a9ea0"
  }
}(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

The expectred output should be an AI reply based on the prompt.

Information on your n8n setup

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Hey!
You are missing an input/trigger node. The AI node is also referencing some input, which just isn’t given in your workflow.

You pretty much always need some kind of trigger which will trigger your workflow and provide the first input data of sorts.

Maybe step back a little bit and work through some basic tutorials to get the basic understanding of n8n :slight_smile:

This pasted workflow is not easy to work with. Make sure to put it in a codeblock. Also I guess the google sheet referenced is public and now accessible by anyone reading your post.

@fre-ben Yes the google sheet is readable, which is why I didn’t want ti share it.

It’s a small test sandbodbox for now so I don’t mind.

Either way, there is a functioning Google Sheet trigger there and it’s outputting what it should.

I see.

Still it’s hard to actually help without a proper formatted JSON, since it’s not possible to import into n8n this way. Sorry.

@fre-ben thanks. Really appreciate the effort.

Turns out it was just happening on test runs, which is a common issue.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.