Publishing workflows as tools (Server nodes)
To publish a workflow as a reusable node, you first need to decide which input and output parameters you want to make visible on the node. This usually isn’t every parameter in your workflow or the node would become too complex to use. You usually want to publish just a few input parameters and often only a single output. To publish a parameter, click the sun toggle (☀) while hovering the parameter name. After the parameter is published you can update the description for the input parameter. Click the input parameter label on the Node Input Uninstalling to expand it and enter a new description. This is essential if you want to use your tool in the Agent node and recommended if you are using the tool in another workflow: you will forget what your inputs do. Once you’ve published your inputs and outputs and added labels and descriptions, you can add your tool to a library to make it visible in the node menu and re-use it in other workflows.Published workflows always run securely on the server.
Publishing nodes with custom UI (Client nodes)
When you publish workflows as tools you don’t have any control over the input and output UI as these are set by the published parameters. You can also create nodes using arbitrary React code that will allow you to develop any custom user interface you like. This is particularly useful for building UI for interactions that need to take place in the browser rather than running on the server, such as painting masks, compositing images, editing audio and so on.Creating a custom UI node
Create aCode
node and open the node settings sidebar. Then enable the Custom UI toggle to show the code editor with example code.
You can make any change you like to the body of this React component, using inputs, setNodeOutputs
as props.
inputs
Inputs is an object matching your input parameters. For instance, if you have inputs to your code node called “images” and “myVariable”, you can
access these in your custom component using inputs.images
or inputs.myVariable
.
setNodeOutputs
This is a callback function that is used to update the output parameters. Like inputs, you update this by providing an object with keys and values.
For instance, to output a parameter called “result” with value “hello”, you would call setNodeOutputs({"result":"hello"})
Limitations
The component runs in an iFrame with no access to the parent DOM. You cannot use import statements and so are stuck with vanilla javascript. You can create multiple child components in the code editor, but must always return exactly one React component. Your component can use vanilla tailwind css, and the base classes from the Runchat editor are injected in so your component can respond to the current theme.Generating UI components
The easiest way to create custom components is to generate them automatically using an LLM. You can specify the LLM you want to use by selecting the model in theCode
node settings bar. Anthropic’s models tend to work the best.
The generate a component, enter plain english instructions into the code editor and then press Generate. The llm is provided with the following
system prompt to help generate components within the constraints of the sandbox. If you want to generate components using another code editor or chatbot (e.g. claude.ai)
you can reference the following system prompt - though note that this sytem prompt injects the actual values and node metadata from our component
and you will not have access to these if using a third party environment.