AI Node not using Tool Response for Answering

Trying to create a RAG Chatbot, but somehow AI Node isn’t using Tool response to form the reply at all

When checked in logs, it’s showing the following output in AI Agent (generally, there should be one more AI Model call after Pinecone Vector DB response, but somehow it’s sending response from Groq before the tool call (tried with 4o-mini, and 4.1-mini as well - and it’s stll the same)

Please share your workflow

(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.)

{
  "nodes": [
    {
      "parameters": {
        "toolDescription": "Use this tool to escalate the chat to human agent or when chat user wants to talk with human",
        "method": "POST",
        "url": "=https://chat.datacaptive.com/api/v1/accounts/{{ $('Switch').first().json.account_id }}/conversations/{{ $('Switch').first().json.conversation_id }}/assignments",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "api_access_token",
              "value": "uGpgSTU9TjgijPpxs5THKH9S"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "assignee_id",
              "value": "={{ $json.assignee_id }}"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequestTool",
      "typeVersion": 4.3,
      "position": [
        1680,
        -1488
      ],
      "id": "ebdc9659-7419-409d-a29b-ddc3455a3dd1",
      "name": "escalate_chat1"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "typeVersion": 1.2,
      "position": [
        2016,
        -1104
      ],
      "id": "c349dfd8-3182-45e5-b7c6-d08e981c7e10",
      "name": "Embeddings OpenAI2",
      "credentials": {
        "openAiApi": {
          "id": "f1zsMaki0s8Z0rBp",
          "name": "cold outreach"
        }
      }
    },
    {
      "parameters": {
        "sendTo": "[email protected]",
        "subject": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Subject', ``, 'string') }}",
        "emailType": "text",
        "message": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Message', ``, 'string') }}",
        "options": {
          "appendAttribution": false
        }
      },
      "type": "n8n-nodes-base.gmailTool",
      "typeVersion": 2.2,
      "position": [
        1808,
        -1488
      ],
      "id": "bf2a8bba-9c92-469e-9ef9-fe94e5f07762",
      "name": "internal_team_email1",
      "webhookId": "ee4373f8-abc9-415c-9197-beee5a6fa7fd",
      "credentials": {
        "gmailOAuth2": {
          "id": "i5IpQUiaHUnmBpQZ",
          "name": "amelia.williams - G Suite"
        }
      }
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $json.chatInput }}",
        "options": {
          "systemMessage": "=You are an AI assistant specialized in providing answers to user queries, collecting leads, and escalating to human agent when required. You primary task is to answer questions accuratly and precisely using Vector database, which contains relevant document (datacaptive_source_of_truth).\n\nOnly provide information that you retrive from the documents (or verified expert knowledge). If something is not included in the dataset or is unclear, clearly state that you do not have sufficicent information.\n\nStructure your responses:\n\n- Concise and to the point\n- Specific numbers and facts, when available\n- Clearly indicate which quarterly report (Q4 or Q4) the information comes from\n\nObjective:\nProvide users with reliable and quick details on DataCaptive Services using Vector Database"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 3.1,
      "position": [
        1616,
        -1712
      ],
      "id": "b5c19477-613b-42c7-882d-d8732d91046f",
      "name": "AI Agent1"
    },
    {
      "parameters": {
        "pineconeIndex": {
          "__rl": true,
          "value": "datacaptivechatbot",
          "mode": "list",
          "cachedResultName": "datacaptivechatbot"
        },
        "options": {
          "pineconeNamespace": "datacaptive_faqs"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
      "typeVersion": 1.3,
      "position": [
        1904,
        -1344
      ],
      "id": "40770c25-55ee-4836-b767-f178301bd6a6",
      "name": "Pinecone Vector Store2",
      "credentials": {
        "pineconeApi": {
          "id": "5RZn3AB32Lx0losC",
          "name": "PineconeApi account"
        }
      }
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "value": "gpt-4.1-mini",
          "mode": "list",
          "cachedResultName": "gpt-4.1-mini"
        },
        "builtInTools": {},
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.3,
      "position": [
        2224,
        -1312
      ],
      "id": "c306df86-712a-4c9d-844c-c97ec850faee",
      "name": "OpenAI Chat Model2",
      "credentials": {
        "openAiApi": {
          "id": "f1zsMaki0s8Z0rBp",
          "name": "cold outreach"
        }
      }
    },
    {
      "parameters": {
        "description": "Use this tool for ANY question about DataCaptive — services, pricing, contact details, WhatsApp, phone numbers, emails, or company info. The text returned by this tool IS the final answer. Copy it directly into your response. Do not say you lack information if this tool returns any text."
      },
      "type": "@n8n/n8n-nodes-langchain.toolVectorStore",
      "typeVersion": 1.1,
      "position": [
        2032,
        -1520
      ],
      "id": "ff5d20a7-563a-4aa6-bf0b-9cad52ce3f8e",
      "name": "datacaptive_source_of_truth1",
      "rewireOutputLogTo": "ai_tool"
    },
    {
      "parameters": {
        "options": {
          "responseMode": "streaming"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "typeVersion": 1.4,
      "position": [
        1392,
        -1712
      ],
      "id": "24c9ece3-a94f-4c99-8f09-ac16b4f96f52",
      "name": "When chat message received",
      "webhookId": "1de07b27-cf36-4723-a399-2aadd1bff896"
    },
    {
      "parameters": {
        "model": "openai/gpt-oss-120b",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatGroq",
      "typeVersion": 1,
      "position": [
        1488,
        -1504
      ],
      "id": "58e91dc4-413f-437d-a3bb-1af68a6dc6d3",
      "name": "Groq Chat Model",
      "credentials": {
        "groqApi": {
          "id": "QMvQ7K9jrPZeYrr7",
          "name": "Mohan - test"
        }
      }
    }
  ],
  "connections": {
    "escalate_chat1": {
      "ai_tool": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI2": {
      "ai_embedding": [
        [
          {
            "node": "Pinecone Vector Store2",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "internal_team_email1": {
      "ai_tool": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Pinecone Vector Store2": {
      "ai_vectorStore": [
        [
          {
            "node": "datacaptive_source_of_truth1",
            "type": "ai_vectorStore",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model2": {
      "ai_languageModel": [
        [
          {
            "node": "datacaptive_source_of_truth1",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "datacaptive_source_of_truth1": {
      "ai_tool": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "AI Agent1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Groq Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {
    "internal_team_email1": [
      {
        "id": "19d3097fe691c366",
        "threadId": "19d3097fe691c366",
        "labelIds": [
          "SENT"
        ]
      }
    ]
  },
  "meta": {
    "instanceId": "8d93ef0be34f9c124d5dd7b0d5c0ff15a59f0997cf7850da390ce35c4f4501b7"
  }
}

Share the output returned by the last node

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): Docker
  • Operating system:

Looking at your workflow — the main LLM for AI Agent1 is Groq Chat Model (openai/gpt-oss-120b), and Groq can be unreliable with tool invocation in n8n. The agent is supposed to call datacaptive_source_of_truth1, get the Pinecone results, and then form the answer. Instead it skips the tool call and responds directly from its own knowledge — which explains why you see no second LLM call after the tool in the logs.

Easiest fix: replace the Groq Chat Model in AI Agent1 with OpenAI Chat Model2 (gpt-4.1-mini). You already have that model in your workflow, and OpenAI handles tool calling much more consistently in n8n’s agent framework.

If you need to stay on Groq, add something explicit to the system prompt like “Before answering, you MUST call the datacaptive_source_of_truth1 tool first. Never respond without retrieving from it.” — but the OpenAI switch will be more reliable.

1 Like

Thanks Benjamin, tried with OpenAI gpt-4.1-mini, and 4o-mini as well

But somehow, it seemed to be the same with those as well

This has nothing to do with Groq.

GPTOSS is the issue. You will encounter the same issue even with GPTOSS from OpenRouter.

GPTOSS model is not reliable for tool use. You can consider GPT5-nano instead

1 Like

Hi @Mohan_Dhanwani I see the issue, consider the workflow below (Your workflow with tweaks):

I edited the System prompt + changed the pinecone vector node so that the vector database is not a choice it is a instruction. Try this let me know how this performs. (Do not change anything i have personally tweaked the models related to their use case. So just hop on your API keys + Set your pinecone database and Done!)

Let me know how this works.

Also instead of using Groq consider openrouter, it is better in really all the ways:

2 Likes

fair point @kjooleng — yeah GPTOSS specifically is the culprit, i was too broad blaming the whole Groq stack. @Mohan_Dhanwani the workflow Anshul shared above + the system prompt change should do it — key is forcing the vector store call explicitly and using a model that actually supports tool use reliably.

2 Likes

Thanks Anshul, tried this but still the same.

OpenAI Model gets executed twice, then it goes to Pinecone Vector DB…. waits for pinecone response (doesn’t trigger model for final iteration based on response) - and directly sends response that it had generated in 2nd iteration

(worked fine when I was checking on another instance, not sure why issue on this one)

1 Like

The two model calls before Pinecone happening in that order does sound off. A couple of things to check:

First — in Anshul’s shared workflow the pineconeIndex value is actually empty in the JSON. Make sure you’ve set your actual index name there, otherwise the retrieve-as-tool step might silently fail or behave unexpectedly.

Also worth trying: disable responseMode: streaming on the Chat Trigger temporarily. Streaming mode can sometimes interrupt the agent’s ReAct loop before the final synthesis call happens, especially with Agent typeVersion 3.1.

And since it worked on another instance — are the n8n versions the same on both? That’s the most likely culprit if the same config behaves differently.

1 Like

@Mohan_Dhanwani have you checked the output, i mean does that output include information stored in the pinecone database? Also make sure that the exact same model is being used to fetch the data, which was used back then to embed that for example text-embedding-3-small and also let me know the data being used, as sometimes this maybe something which might have happened.

1 Like

Thanks @Anshul_Namdev @Benjamin_Behrens , not sure what was wrong, created AI Agent in another workflow pretty much same setup (over here with gpt -5o-nano)

Made sure it worked there, then copy pasted in the old workflow.. updated prompt, and it started working properly on previous workflow as well

(now it’s using Pinecone with every single response :grinning_face_with_smiling_eyes: .. so working on optimizing the prompt)

1 Like

Glad it’s working now! :tada: Interesting — it sounds like there was some state or config issue in the old workflow instance that copying to a fresh one resolved. Good catch.

Now that Pinecone is being called consistently, the prompt optimization you mentioned should help — you can add something like “Use the vector database tool only when the user query requires company-specific information” to reduce unnecessary calls on simple questions. That’ll keep costs down without sacrificing accuracy.

1 Like

Thanks, yeah… optimizing for the same now :slight_smile:

I had similar issue with AI Agent not using tools although they were specifically put in system prompt. And yes, deleting the node and copying prompt anew did the trick - the same setup started to work

1 Like

@Mohan_Dhanwani Glad it helped, consider marking that as a solution for future references.

1 Like

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