Code Node
The Code Node executes custom Python scripts within your workflow.
Overview
Use Code Nodes when you need:
- Custom data transformations
- Complex logic not available in other nodes
- Integration with Python libraries
- Data parsing or formatting
Configuration
Python Code
Write your Python script in the code editor:
# Access input variables
user_input = inputs.get("text", "")
# Process data
result = user_input.upper()
# Return output
return {"processed_text": result}
Input Variables
Define which variables are passed to your script.
Available Features
- Standard Python libraries
- JSON parsing
- String manipulation
- Mathematical operations
- Regular expressions
Output
Return a dictionary that becomes available to downstream nodes.
Best Practices
- Handle edge cases and empty inputs
- Keep scripts focused and simple
- Use descriptive variable names
- Add comments for complex logic