Custom Node
Run your own Python to transform, validate, or enrich data. Must return JSON.
When to use
- You need logic the Model/Reply nodes can't do (math, parsing, scoring).
- You want to validate/clean model output before replying or calling APIs.
- You need to merge data from multiple nodes into a single structured result.
What it does
- Consumes upstream state (inputs from User Utterance / Model / APIs).
- Executes your Python logic.
- Emits a JSON object on
outputthat downstream nodes can read.
Fields
| Field | Description | Example |
|---|---|---|
| Node ID * | Unique identifier for this node in your flow. Used for connecting edges and referencing node output. | CustomNode_5 |
| Code | The main logic block written in JavaScript (Node.js syntax). This code runs when the flow reaches this node. | js\nconst user = state.user;\nif (user.age > 18) {\n return { status: 'adult' };\n} else {\n return { status: 'minor' };\n} |
- The code executes inside a sandboxed environment with access to
state,config, and any data passed from previous nodes.- Always return a JSON-serializable object (e.g.,
{ key: value }) so it can be passed to the next node.
Typical output path:
Replace
output fieldwith your actual returned JSON field.