节点与集成

Custom Code Tool

Use the Custom Code Tool node to write code that an agent1 can run.

On this page, you'll find the node parameters for the Custom Code Tool node and links to more resources.

Node parameters

Description

Give your custom code a description. This tells the agent when to use this tool. For example:

Call this tool to get a random color. The input should be a string with comma separated names of colors to exclude.

Language

You can use JavaScript or Python.

JavaScript / Python box

Write the code here.

You can access the tool input using query. For example, to take the input string and lowercase it:

js
let myString = query;
return myString.toLowerCase();

Templates and examples

Browse Custom Code Tool node documentation integration templates or search all templates

Related resources

Refer to LangChain's documentation on tools for more information about tools in LangChain.

View n8n's Advanced AI documentation.

Footnotes

  1. AI agents are artificial intelligence systems capable of responding to requests, making decisions, and performing real-world tasks for users. They use large language models (LLMs) to interpret user input and make decisions about how to best process requests using the information and resources they have available.

    Back

官方原文和授权

本页来自 N8N 英文官方网站固定快照,并转换成 xueai 静态页面。内容以 N8N 持续更新的官方页面为准。

来源、授权与修改

本站保留许可证、固定提交号、社区作者和修改说明,不代表 n8n 对本站背书。

查看许可证查看来源和修改说明