The ai agent doesn't work when there are tools

The AI Agent does not work if there is at least 1 tool. Everything works without tools. And it doesn’t matter what kind of tool I connect. Even if it’s a simple calculator. Nothing depends on the text and language of the message.

Error message

The error occurs in the ai agent node. Open router in ‘openai/gpt-4o-mini’ mode.

Error: Provider returned error at Stream.iterator (/usr/local/lib/node_modules/n8n/node_modules/openai/streaming.js:40:35) at processTicksAndRejections (node:internal/process/task_queues:95:5) at ChatOpenAI._streamResponseChunks (/usr/local/lib/node_modules/n8n/node_modules/@langchain/openai/dist/chat_models.cjs:1256:26) at ChatOpenAI._streamIterator (/usr/local/lib/node_modules/n8n/node_modules/@langchain/core/dist/language_models/chat_models.cjs:100:34) at ChatOpenAI.transform (/usr/local/lib/node_modules/n8n/node_modules/@langchain/core/dist/runnables/base.cjs:402:9) at RunnableBinding.transform (/usr/local/lib/node_modules/n8n/node_modules/@langchain/core/dist/runnables/base.cjs:883:9) at ToolCallingAgentOutputParser.transform (/usr/local/lib/node_modules/n8n/node_modules/@langchain/core/dist/runnables/base.cjs:391:26) at RunnableSequence._streamIterator (/usr/local/lib/node_modules/n8n/node_modules/@langchain/core/dist/runnables/base.cjs:1320:30) at RunnableSequence.transform (/usr/local/lib/node_modules/n8n/node_modules/@langchain/core/dist/runnables/base.cjs:402:9) at wrapInputForTracing (/usr/local/lib/node_modules/n8n/node_modules/@langchain/core/dist/runnables/base.cjs:275:30) at pipeGeneratorWithSetup (/usr/local/lib/node_modules/n8n/node_modules/@langchain/core/dist/utils/stream.cjs:271:19) at RunnableLambda._transformStreamWithConfig (/usr/local/lib/node_modules/n8n/node_modules/@langchain/core/dist/runnables/base.cjs:296:26) at wrapInputForTracing (/usr/local/lib/node_modules/n8n/node_modules/@langchain/core/dist/runnables/base.cjs:275:30) at pipeGeneratorWithSetup (/usr/local/lib/node_modules/n8n/node_modules/@langchain/core/dist/utils/stream.cjs:271:19) at RunnableLambda._transformStreamWithConfig (/usr/local/lib/node_modules/n8n/node_modules/@langchain/core/dist/runnables/base.cjs:296:26) at RunnableSequence._streamIterator (/usr/local/lib/node_modules/n8n/node_modules/@langchain/core/dist/runnables/base.cjs:1320:30)

Workflow

Information on your n8n setup

  • n8n version: 1.86.1
  • Database: postgres
  • n8n EXECUTIONS_PROCESS setting (default: own, main): not specified in yml file. Is it important?
  • Running n8n via: docker compose on vps hosting
  • Operating system: Ubutnu 24.04

Your workflow works great.

My openrouter openai/gpt-4o-mini uses the calculator tool.

Just wanted to tell you, that this issue is not related to your workflow.

Can you share more detailed logs or error messages you are facing?

Thanks! I solved the problem by just changing the GPT model.

Errors occurred with openai/gpt-4o-mini, but not with openai/gpt-4o.

1 Like

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