Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Node as an AI tool #12593

Closed
ihor-sokoliuk opened this issue Jan 14, 2025 · 9 comments
Closed

Custom Node as an AI tool #12593

ihor-sokoliuk opened this issue Jan 14, 2025 · 9 comments
Labels
in linear Issue or PR has been created in Linear for internal review

Comments

@ihor-sokoliuk
Copy link

Bug Description

I am working on a custom node that an AI tool would need to use. It’s a SearXNG tool:
https://www.npmjs.com/package/n8n-nodes-searxng
Analog to SerpApi. It performs a search request.

I can see the node in the list of AI tools after adding a usableAsTool: true to the node source code (like in NocoDB standard tool).

I can add the NocoDB as a tool and it works perfectly fine, but not the custom SearXNG node.

Once I run a test on the workflow, it fails after the trigger with the error:

Unrecognized node type: n8n-nodes-searxng.searxngTool
Error: Unrecognized node type: n8n-nodes-searxng.searxngTool
    at LazyPackageDirectoryLoader.getNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/DirectoryLoader.js:160:15)
    at LoadNodesAndCredentials.getNode (/usr/local/lib/node_modules/n8n/dist/load-nodes-and-credentials.js:272:23)
    at NodeTypes.getByNameAndVersion (/usr/local/lib/node_modules/n8n/dist/node-types.js:36:51)
    at new Workflow (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Workflow.js:56:39)
    at TestWebhooks.toWorkflow (/usr/local/lib/node_modules/n8n/dist/webhooks/test-webhooks.js:290:16)
    at TestWebhooks.needsWebhook (/usr/local/lib/node_modules/n8n/dist/webhooks/test-webhooks.js:169:31)
    at WorkflowExecutionService.executeManually (/usr/local/lib/node_modules/n8n/dist/workflows/workflow-execution.service.js:114:58)
    at WorkflowsController.runManually (/usr/local/lib/node_modules/n8n/dist/workflows/workflows.controller.js:293:16)
    at handler (/usr/local/lib/node_modules/n8n/dist/decorators/controller.registry.js:93:24)
    at /usr/local/lib/node_modules/n8n/dist/response-helper.js:110:26

To Reproduce

  1. Install community node n8n-nodes-searxng over n8n Web UI
  2. Add AI Agent (Tool Agent)
  3. Click on Tools plus button
  4. Find and add SearXNG tool
  5. Define credentials for it
  6. Run the workflow
    image

Expected behavior

AI Agent node works and calls the SearXNG tool.

Operating System

Official Docker Image (n8nio/n8n:next)

n8n Version

1.74.1

Node.js Version

20.18.0

Database

SQLite (default)

Execution mode

main (default)

@Joffcom
Copy link
Member

Joffcom commented Jan 14, 2025

Hey @ihor-sokoliuk,

We have created an internal ticket to look into this which we will be tracking as "N8N-8101"

@Joffcom Joffcom added the in linear Issue or PR has been created in Linear for internal review label Jan 14, 2025
@netroy
Copy link
Member

netroy commented Jan 14, 2025

This is intentional. We have a check here to only allow core nodes as Tools for now, until we are certain that the feature is mature enough to allow custom nodes as well.

Considering that a lot of the AI related interfaces in the engine aren't stable enough yet, If we start allowing custom nodes as tool now, we'd have to maintain backward compatibility for all those nodes.

@ihor-sokoliuk
Copy link
Author

@netroy Thank you for your prompt response!

Can I track the progress somewhere? So that I would know when I can try this new feature

@netroy
Copy link
Member

netroy commented Jan 14, 2025

We are in the middle of re-architecting some of the AI nodes support code, but there is no clear ETA that I can share with you.
However the good news is that this work is also blocking some important upcoming features, so hopefully we can share an update with you and the community soon.

In the meanwhile, if you want to still use the SearXNG node as tool, you could fork the repo, remove the check for I linked above, and build a custom image from that.
Let me know if you would like to try that option, until start supporting tools support for custom nodes.

@netroy
Copy link
Member

netroy commented Jan 14, 2025

I've triggered a custom docker build on my fork here.
Once the job finishes, you should be able to use ghcr.io/netroy/n8n:custom-nodes-as-tools as the docker image.

@ihor-sokoliuk
Copy link
Author

@netroy Wow! It works like a charm!

image

I planned to fork and adjust the logic but you made it first.

I will keep using this docker image.

Thank you so much!

@hyroescom
Copy link

@ihor-sokoliuk Is that also allow to create custom nodes as Model? I want to create custom model that will enable prompt caching for Anthropic AI. It's super easy but I can't create node for that on current n8n.

@netroy
Copy link
Member

netroy commented Feb 12, 2025

@hyroescom This issue is about using existing nodes as tools on AI agents. What you are asking for is a custom model nodes. These are completely unrelated things.
You should already be able to create custom models, since there are no checks in code to clock those.
However if that does not work, please open a feature request on community.n8n.io instead.

@netroy
Copy link
Member

netroy commented Feb 12, 2025

@ihor-sokoliuk just FYI, I've also been testing a simple wrapper over the existing SearXNG tool from langchain for over a month now. Just opened a PR, in case you want to give it a try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in linear Issue or PR has been created in Linear for internal review
Projects
None yet
Development

No branches or pull requests

4 participants