Unify Logo Footer.svg
Unify Automations
Logo
Code

Code

Logo

3 mins READ

The Code node runs a custom script inside a sandbox when the built-in nodes don't cover what you need — a tricky transformation, a custom calculation, or a complex parsing step. It's an escape hatch: use it only for the part of your automation that genuinely requires custom code, and keep the rest in standard nodes.

Overview

Code supports several languages: PythonJavaScriptGroovyJavaC#, and Playwright (for browser automation). The node runs your script in an isolated environment, hands the result back to the next step as a data pill, and keeps no state between runs.

Inputs and Outputs

You declare the inputs the script needs — each becomes a variable available inside your script by name, including nested inputs. The script returns a result matching the output schema you declare, which downstream steps read as data pills. For scripts that produce files, the result also carries the output files the script generated.

Note: The output shape is for mapping convenience and is not strictly enforced. Make sure your script actually returns the keys you declared — a mismatch causes silent null values downstream.

Python Environment

Python runs on versions 3.8 through 3.13, defaulting to 3.12. Configure the environment three ways:

  • Quick-start — a default environment with common data packages pre-installed. Simple scripts just work.

  • Manual — pick the Python version and list the exact packages to install.

  • Environment template — a saved configuration that pins a version and a known set of packages for reuse across automations.

Execution Behavior

Scripts run in an isolated sandbox with no implicit access to the host or other scripts' state. For longer-running scripts, enable asynchronous execution — the automation pauses, the script runs independently, and the run resumes when it finishes. For performance, the platform briefly caches a registered script so re-running the same code within a short window skips re-registration.

Notes

The Code Node runs best when scripts are focused, the language version matches your code, and runtime behavior is validated before going live:

  • Keep scripts focused and bounded — long, heavy work is better split across steps or moved to async execution.

  • Match the Python version to your code — syntax from a newer version will fail on an older interpreter you selected.

  • Playwright scripts run browser automation in the sandbox; the browser is pre-installed, no additional setup is needed.

A well-written Code Node step is short, targeted, and tested against representative sample data before it enters production.