vellum.workflows.nodes.CodeExecutionNode
Used to execute arbitrary Python code within your workflow. Supports custom package dependencies and any Python or TypeScript runtimes.
Important: Your code file must contain a main() function with parameters that match the names of the node’s inputs. Without this function, you’ll get a NameError: name 'main' is not defined error.
Path to the Python script file to execute
The inputs for the custom script. Supports:
The runtime to use for the custom script
The packages to use for the custom script
The request options to use for the custom script
The result returned by the executed code, type depends on the node’s generic type parameter
The execution logs from the code run