How to define AI-powered Extra Workflow Inputs in AI tools?

Describe the question

I need to pass to the tool some data from the AI Agent. Like, “task name” and “task tags” to create a task via Custom Workflow Tool.

So I don’t know what to refer to in the Extra Inputs. Because this data is coming from the Agent response. In Flowise, these inputs are defined separately as variables like $task_name, and then I can use them. What should I write here?

  • n8n version: 1.42.1
2 Likes

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:

Short answer: In the tool description.

If the tool function and params are described well enough, the AI model will generate the parameters on its own and pass it to the tool as “query”. I’ve noticed a common misunderstanding that “Extra Workflow Inputs” are required to make the Agent use the tool but that’s not really true.

Demo

1 Like

hi @Jim_Le

Sorry, couldn’t apply this scheme for Custom Workflow Tools as was in my post. There’s no code window. And when you have several parameters to pass (not 1 like in your example), you can’t just use the “query” parameter - it is single, while there are several parameters.

1 Like

Ah ok. If you can provide a small example, that would help.

I’ve attached an alternate version of the previous example but with the custom workflow tool. Also I’ve just noticed that you can specify input schema now to custom workflow tools which makes it a lot easier.

Edit: The input schema doesn’t show up in the preview but does if you import it into the n8n.

1 Like

@Jim_Le

Thank you. But still can’t understand how to pass parameters

Please see the example. Here I want to add a task. And for that AI Agent must extract “task name” and “task tags” from the request and pass it to the Tool. Please see the expected input in the Set node. And I don’t understand how to put in the Tool this data.

1 Like

Ok so some observations.

  • Your prompt was task-oriented and not goal-oriented, which may have been why the AI failed to recognise that you wanted to create a task in notion. My advice is don’t tell the AI “how to do it” (eg. what params to pass) but instead prefer “what to do” (eg. create a task in notion).
    There’s a certain degree of trust you have to give if working with AI Agents!
  • Recommend upgrading to the latest version of n8n to get input schema option for workflow code tool.

Demo


1 Like

Super interesting topic, thanks for all that !
I also understand that this new agent would need, for my usage at least, some parameters for binaries also provided from the previous agent node !

Without that I can’t use the custom tools the way I wanted…

@Jim_Le Thank you for reviewing this.

I’m on latest, 1.42.1. The 1.44.1 version is “next”.
Can’t figure out how to set the input schema. There’s no such a setting in the Tool. The documentation just mentions it but doesn’t show how to find this.

I copied your example and applied your request. I get this:

So, the solution is in direct prompting. You need to add to your Tool description something like this:

Send the data as a stringified JSON for future parsing:
{
  "task": <task name>,
  "tags": <tag list (important, urgent), comma separated>
}

The whole process is here:

2 Likes

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