Skip to main content
A code node ("type": "code") runs Python as a deterministic step. It has a single handler class, code, so handler_class and process are never ambiguous. Use this page when building nodes for Create a Workflow or Update a Workflow. Reach for a code node when the work is exact and repeatable — parsing, arithmetic, reshaping data, calling a library. Where the work needs judgement, use an Agent Node instead.

Process Fields

string
required
The Python source to run.Your code reads the node’s inputs and returns its outputs; the variable names come from the node’s input_schema and output_schema. See Variable Schemas.
string
required
What the code does. Keep it accurate — this is the field most likely to go stale once the code is edited, and it is what teammates read first.
string
What the step is meant to achieve, as distinct from how code achieves it. Defaults to an empty string.
string[]
Python packages the code imports. Defaults to empty.Only packages available in the Opus Code runtime can be imported — see Available Packages.
For reading and writing files from inside a code node, and the file formats Opus supports, see the Opus SDK.

Example

code node