Skip to main content
The Serverless Function node runs your own code. Pick a runtime, define named inputs that map data from upstream nodes, and write a function body. Whatever you return becomes the node’s result, which downstream nodes reference as {{code-id.result}}.

Inputs

Function Inputs is a list of name + value pairs. The value is usually a reference like {{sheets-1.values}}. In JavaScript, inputs are available on the inputs object (inputs.data); in Python, each input becomes a function argument with its name (data).

JavaScript

Runs in QuickJS and starts in milliseconds, so it’s the right choice for quick data transformations. Pure JavaScript only: no npm packages, no network access, and a 3 second execution limit. console.log output is captured as stdout.
// Input "data" mapped from {{sheets-1.values}}
const emails = inputs.data
  .filter(row => row.status === 'active')
  .map(row => row.email);
return { emails, count: emails.length };

Python

Runs in a Modal sandbox with installable pip packages and optional GPUs. Use it for heavy computation, ML workloads, or anything that needs libraries.
FieldWhat it does
Function BodyPython code; return a JSON-serializable value
Requirementspip packages to install, one per line
HardwareGPU Type (CPU only, T4, L4, A10G, A100 40GB, A100 80GB, H100), GPU Count (1-8), CPU Cores (0.25-16), Memory (256 MB-64 GB)
Timeout (seconds)Up to 3600, default 300
RegionAuto (nearest), US East, US West, EU West, EU Central
# Input "data" mapped from an upstream node
import pandas as pd  # add "pandas" to Requirements
df = pd.DataFrame(data)
return {"mean": df["price"].mean(), "rows": len(df)}
Need values to persist between runs (counters, seen IDs)? Connect a State Manager node to get a mutable state parameter that saves automatically.

Next steps