Code execution
The Code node performs calculations and data transformations with code. Use it when a step must follow explicit rules or return a defined data structure.
Before you start
This guide requires Python or TypeScript programming knowledge. If your task only needs to pass fields or format an answer, start with Map variables and expressions or Structured outputs and templates. Have a connected workflow and know the input fields your function must receive before writing code.
Connect and configure Code
Connect the input, Code, and output nodes.

Decide which values the code must receive and which values later nodes will need.
Open Code settings and select Python or TypeScript.

The function must use the syntax and return format appropriate for the selected language.
Write and run the function
Open the code editor and review the function.

Return useful values explicitly. Printed log messages help with diagnosis but are not a substitute for the returned result.
Run the code and inspect its result, exit code, logs, and error field.

A successful execution should return the expected value without an execution error.
Use the returned values
Insert the required Code result field into the downstream template.

Match the expression path to the actual returned object.
Run the complete workflow and inspect Output.

This checks that both code execution and the downstream reference produce the intended result.
Important behavior
Printed messages appear in logs. Return the values that later nodes need from the function.
If a later node reports a missing value, compare its reference with the fields under Code.result.
Last updated
Was this helpful?

