How to Fix N8N Workflow Not Calling the Right Tool
Hi there! If you're watching this video, you probably have the same issue as me - the N8N workflow is not calling the right tool even though you've named it and created it.
Looking at my workflow, I have my AI agent, I have the tools agent, and I have literally one tool. My task is to receive an Upwork job description and then use it to generate an application copy with the tool "generate application copy".
But when I run this, it's not calling the tool! The tool's description is "Use this tool to generate an Upwork application copy." I've selected everything correctly, and this is the workflow here. It's already triggered by another flow. I'm accepting all data, but it just isn't working.
I just found out the problem for myself. It was a simple issue, but I'm going to show you how to fix this.
The first problem might be that you're calling too many agents. Here, I simplified it to calling one simple agent.
The other problem I was having was I used "defined below" and then I was putting the system message and also another system message. This was feeding in this text into the module every single time.
Make the tools clearer with the names and descriptions.
For the system message (which should be at the top but that's how it is), you need to dynamically get it from the chat trigger node.
If you use "define below," you have to pull that in. It's basically the same thing, but just use the automatic one.
You can use Gemini or GPT-4 Mini - both work well.
Make sure you have the name of your tool from the list (you can also use by ID).
Tell it clearly: "Use this tool to generate Upwork application copy. The input will be this and the output will be this."
When I run it now, it's running through and generating a response with ChatGPT. It's calling the tool right there and going back to the ChatGPT model to give us the answer.
The output here is "Here's a tailored application..." which is exactly what we want!
I deleted the previous chat and tested with a real Upwork job description. I copied the job description that mentioned building a workflow with N8N, GPT Cloud, etc.
When I pasted it into the chat with "Here is a job description," it went to the AI agent, called the tool, came back, and gave me a formatted application.
Q: Why wasn't my tool being called?
Q: How do I make sure my tool description is clear enough?
Q: Can I use different AI models for this?
I hope you enjoyed this! I know it's a simple thing to mess up, but since I was stuck on this for 30 minutes, I figured someone else might be too.
Let's build great things!