Skip to main content
The Code step runs Python in a sandboxed environment. Use it when no other step type fits — complex data transformations, custom logic, calling Python client libraries, or looping over arrays.

When to use it

How it works

Your code runs inside a function called run(ctx). The current workflow context is injected as ctx — a Python dict containing every upstream step’s output. Whatever run returns becomes this step’s output in ctx.

Inspector

Code step inspector with Configuration and Output tabs
The Code step inspector has two tabs:
  • Configuration — Draft your Python code directly in the provided editor. For an enhanced experience, click the purple Open IDE button to access a full-screen coding environment.
    • Here, you can write and edit your Python logic with greater visibility.
    • Specify any external Python packages your code requires—these will be installed into the sandboxed environment automatically.
    Code IDE
    • Here you can write your pythion code
    • Enter packages that needs to be installed in the sandbox
  • Output — After saving your code in the editor, this tab displays the structure of the data returned by your run function. You can reference these output fields as variables in downstream steps using the workflow context.
    Code IDE

Accessing context

The ctx dict contains all upstream step outputs keyed by step name:

Examples

Reshape an HTTP response

Call a third-party SDK

(Add stripe to the packages list in the inspector.)

Limits

Considerations

  • Don’t cache state between runs. Each run gets a fresh sandbox.
  • Let exceptions propagate. Caught-and-swallowed exceptions hide bugs. If you handle an error, return a structured {"failed": True, "reason": "..."} and branch on it with a Condition step.
  • Avoid heavy packages on the critical path. pandas and numpy add cold-start latency. For simple data shaping, write it without dependencies.