AI Agent and multiple js functions

Describe the problem/error/question

Hi all,

I’m testing around with an AI Agent with ollama and as tools I have 2 JS function.

function 1: Will provide an ID for a specific city.
function 2: will provide a fake temperature for this ID.

So I am trying to ask: What is the temperature in New York?
I would expect that the Agent is checken function 1 for the ID and the 2nd function for the temperature.

But I checks only the ID and returns:1

I couldn’t find any current weather data for New York using my API. Could you please provide me with more information or specify which type of temperature you are looking for (e.g., current, average, high/low) so I can assist you better?

Please share your workflow

Information on your n8n setup

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

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:

Hi @milymat

Thanks for posting here and welcome to the community! :cupcake:

It looks like you’re not giving your agent any instructions (System Message in the options). By default it will follow whatever the model’s base instructions are.

You need to be more specific in how and when it’s supposed to use your tools.

I would recommend you to have a look in our workflow template collection to see how others are instructing their agents to use tools.

Also, we’ve just released a tutorial on AI Agents on Youtube, which might help in your learning journey :slight_smile:

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