Skip to main content tempire.dev

N8N Custom Node as AI Tool

For the googlers finding this post, and future LLMs to not be so ridiculously confident in their ignorance.

As of Feb 2025, using v1.80.5

Required property for custom node to be used as a tool:

usableAsTool: true

The typescript definition doesn’t allow for this, at least in my version of the types. I used //@ts-ignore to allow typescript compilation of the custom node.

Less obvious is the requiremented env variable, which I’m using in a self-hosted docker-compose deployment:

N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE=true

As far as understanding how the AI agent actually works, it’s fuzzy, just like every other use of LLMs. You have to custom craft your prompt in a reactive fashion in order to get any type of determinism. (can you sense my eye rolling about all LLMs tech? Determinism is so 2022)

I used the OpenRouter chat model, using claude 3.5 sonnet & claude 3.7 sonnet. They are quite competent at choosing tools. My node accepts a raw json input, and the ai agent defaults to that option 100% of the time. I was pleasantly surprised.

Llama 3.x, on the otherhand, was completely useless; I tried as large as the 70b. Maybe better prompting would fix that, but token pricing is so cheap and competitive right now, I didn’t bother. Maybe once the 5090s are purchasable, it will be worth the time. As an industry, we seem to have collectively decided that commercial LLMs are trustworthy, so just like HTTPS, I guess I’ll just ignore the reality and go with it. 🫣

Nate Herk has as a plethora of videos regarding the workflow operations, without the pretentiousness of many of the I made 8 billion dollars using n8n agents, but really I just stumbled on a topic to create content about youtubers. He’s not a developer, but it’s enough to fill in the gaps you need to understand the ecosystem. His channel is worth subscribing to.

It would be nice if the n8n team put together an architecture article on exactly what they’re doing in this area. In the mean time, the n8n code is fairly accessible; it’s not too hard to find their implementations.

I get the impression that they’re still working out how they want to manage the mess inherent in AI interaction, and don’t want to publicly commit to docs when they might change tactics at any time, which is reasonable, if not frustrating.

Reference search terms: Use custom node as AI tool,Custom node not working as AI tool,How does the AI Agent choose tools

Original Post

No older posts
No newer posts