Code editor
Run Python 3.13 inside your automation and pass whatever your script prints to downstream Steps.
- Use it to
- Run calculations, data reshaping, or signature checks in Python 3.13
- Find it
- Tools → Data → Dev tools → Code editor (t then c)
- Cost
- 1 Step credit per execution
- Limits
- Python 3.13 (stdlib, numpy, pandas) · Isolated sandbox (no network)
- Output
- {{ N.result.output }} (last line), {{ N.result.executionOutput }}, {{ N.result.stderr }}
- Instead
- Inline pipes ({{ 1.email | trim | lower }}) or Change Fields
Runs Python 3.13 with the standard library, numpy, and pandas. The
editor checks syntax as you type and flags unclosed brackets, indentation
errors, and bare return statements.
Setting it up
Add the step
Press t then c, or open Tools → Data → Dev tools → Code editor.
Write your Python
Reference earlier steps with unquoted {{ }} placeholders on their own.
Print what the next step needs
Print your result with json.dumps(). The step ignores return values.
Run the automation to see the result
Open the step’s Executions tab to inspect the parsed output.
Reading data from earlier steps
Each {{ }} reference arrives as a typed Python value: JSON objects become dict, arrays become list, and true / false / null become True / False / None. Apostrophes (such as O'Brien) need no escaping.
- Place {{ }} unquoted on the right side of an assignment.
- Use {{ 3.$full_result }} to read a whole Step output as one dict.
- Applies to Step tokens, {{ $var.KEY }}, and {{ $secret.KEY }}.
- Never place {{ }} inside quotes: print("Hello {{ 2.name }}") fails.
- Assign the token to a Python variable first, then format it.
- Standard Python doubled braces in f-strings work normally.
customer_name = {{ 2.customer_name }}
order_total = {{ 2.total }}
products = {{ 3.$full_result }}
# Rejected: print("Hello {{ 2.customer_name }}")
print(f"Hello {customer_name}")See Variable Reference Syntax.
Available libraries
The sandbox includes Python 3.13’s standard library plus pinned numpy and pandas. Ask support before relying on unlisted packages.
Data libraries (numpy & pandas)
| Library | Version | Best For |
|---|---|---|
| numpy | 2.5.1 | Numeric arrays and vector math |
| pandas | 2.3.3 | Tables, grouping, joins, and aggregation |
import numpy as np
import pandas as pdWhat it passes on
A return inside a function does not publish output, and a top-level return is a syntax error. Print your final dictionary on the last line of stdout with json.dumps():
import json
print(json.dumps({
"final_total": final_total,
"discount_applied": discount,
}))Print valid JSON, not Python objects. print(my_dict) outputs single
quotes, True, and None. Always serialize with json.dumps().
| Reference | Returns | Notes |
|---|---|---|
{{ 4.result.output.final_total }} | Parsed JSON from last line | Preferred path. Aliases {{ 4.final_total }} and {{ 4.output.final_total }} also resolve here. |
{{ 4.result.executionOutput }} | Raw stdout and stderr | Includes debug print() lines up to stream limits. |
{{ 4.result.stderr }} | Standard error text | Last 20,000 characters of stderr, kept separate from stdout and never parsed as JSON (omitted when empty). |
{{ 4.$full_result }} | Full execution wrapper | Returns the result wrapper object. |
{{ 4.item.final_total }} / {{ 4.results.0.final_total }} | Looping Code Step output | Read the aligned item (item) or index (results.0) (loop syntax). |
Limits
Sandbox limits
| Limit | Value & Behavior |
|---|---|
| Run time | 150 seconds default. Exceeding the timeout stops the script and fails the Step. |
| Output kept | Up to 100,000 characters of stdout and 20,000 of stderr (256 KiB per-stream cap). Truncating the final stdout line fails with CODE_OUTPUT_TOO_LARGE; non-JSON final lines omit result.output with a warning. |
| Memory | Bounded by sandbox capacity. Process large datasets in batches. |
| Network | None. Opening sockets (AF_INET / AF_INET6) fails with PermissionError. |
| Concurrency | Isolated workers. Queued bursts wait at 0 Step credits for up to 15 minutes. |
Examples to copy
Work out a total
import json
order_total = {{ 2.total }}
discount = order_total * 0.1 if order_total > 100 else 0
final_total = order_total - discount
print(json.dumps({
"final_total": round(final_total, 2),
"discount_applied": round(discount, 2),
}))Each example prints JSON on the final line, so downstream Steps read {{ 4.result.output }} directly without Parse JSON.
- Run
- Open Test & Debug on the Code editor Step and click Run step
- You should see
- The Output tab shows result.success: true and your printed JSON object parsed under result.output.
What’s Next?
- 👉 Parse JSON →: expose fields when another Step returns JSON as text.
- Helper Functions: use a ready-made conversion instead of maintaining code.
- AI Data Transform: reshape unstructured content without code.