Deepseek LLM infinite loop on tool usage

Describe the problem/error/question

Context

So Deepseek v3 has been release lately, and while n8n doesn’t provide a specific node for it, since deepseek uses openai’s sdk under the hood with the community we found out that we can use the OpenAI LLM node with a custom base url pointing to https://api.deepseek.com/v1
(see How to connect an http request or DeepSeek v3 as a chat model? - #8 by RoTour)

Problem

While everything works pretty fine, I found out that the tool usage with deepseek (deepseek-chat) specificaly quite unstable.
Most of the time (might work once or twice), especially when the tool does not provide the expected information, deepseek calls it as much as the Max_iterations allows it, before throwing “Agent stopped due to max iterations.”

My workflow (with a chat trigger)


(=> openAI nodes are all connected to deepseek)

What I tried so far

  • Improving the tools descriptions, widening its scope, narrowing it, nothing will do
  • Adding more iterations steps

Information on your n8n setup

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

It looks like your topic is missing some important information. Could you provide the following if applicable.

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

i have the same issue connecting deepseek with my vector store tool.

works fine with claude, and gpt

I’m also having this issue.

And even something as simple as using the Gmail tool to retrieve emails causes it to enter a loop.

Using the same workflow with 4o-mini works fine.

I am also facing the same issue. its very unstable and even when it works, what takes openAI model a fraction of a second take this model a lot more time (somtimes reaching max iterations and stops as mentioned above)

Same “Tool” Support for DeepSeek is looping and very slow

Hi guys,

This is a known Deepseek issue as stated here

The current version of the deepseek-chat model’s Function Calling capabilitity is unstable, which may result in looped calls or empty responses. We are actively working on a fix, and it is expected to be resolved in the next version.

Btw, n8n provides a dedicated DeepSeek node by now.

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