Languages
Every script in Waiso is written in one of five languages, and all five run in the same worker, in the same sandbox, with the same Inputs card, Output tab and triggers. What changes between them is how the entry point is written, how a parameter is declared and how the result is handed back. This page puts them side by side.
- Write the entry point each language expects
- Declare inputs and return a result in Python, TypeScript, JavaScript, C and C++
- Know which languages install packages and which do not
- Find where SQL fits
Five languages, one worker
Python runs on CPython, TypeScript and JavaScript run on Bun (TypeScript needs no build step), and C and C++ are compiled with gcc / g++ right before the run — the compiled binary is cached, so a second run of unchanged code skips the compiler. All of them run inside the same isolated sandbox, which has no network access: a script reaches data through its inputs, the project’s integrations, variables and state.
The language is chosen when the script is created and cannot change later — it decides the file’s extension, the runtime and the language server. A new script starts from a small Hello template in its language, which is the quickest way to see the conventions below in practice.
The same script in every language
A word counter with one text input. Paste any variant into a new script of that language and press Run: the Inputs card shows a text field filled with the default, the log prints the count, and the Output tab shows the result.
def main(text: str = "the quick brown fox"):
words = text.split()
print(f"{len(words)} words")
return {"words": len(words), "chars": len(text)}{
"words": 4,
"chars": 19
}Python
Define def main(...). Each parameter becomes an input, typed by its annotation (str, int, float, bool, lists, dicts, Literal…); the value main returns is the result, turned into JSON. Anything printed goes to the logs. main is called as a normal function, so keep it synchronous — call asyncio.run(...) inside it if you need async code.
TypeScript and JavaScript
Export a function named main — export async function main(...) is the template’s form, and a plain synchronous function works too; a returned promise is awaited. Parameters are matched by name, so main(text) receives the text input, and a missing optional input arrives as undefined, letting the JavaScript default apply. TypeScript types (and JavaScript defaults) type the inputs. Returning nothing gives null.
C and C++
A C or C++ script is an ordinary program with int main(int argc, char *argv[]). Inputs are declared with comment lines at the top — // @param name type = default, types string, int, float, bool, json or list — and read with the SDK: waiso_arg_str, waiso_arg_int, waiso_arg_double, waiso_arg_bool and waiso_arg_json in C (#include "waiso.h"), waiso::argStr, argInt, argDouble, argBool in C++ (#include "waiso.hpp"). The same values also arrive as argv, in declaration order. Hand the result back as JSON text with waiso_set_result(json) / waiso::setResult(json); stdout and stderr are the logs, and a non-zero exit code fails the run.
Side by side
| Language | Runs on | Entry point | Inputs | Result | Packages |
|---|---|---|---|---|---|
| Python | CPython 3.15 (3.14 beside it) | def main(...) | Parameters with type hints | Return value | From PyPI, detected from imports |
| TypeScript | Bun 1.4 (1.3 beside it) | export async function main(...) | Typed parameters | Return value | From npm, detected from imports |
| JavaScript | Bun 1.4 (1.3 beside it) | export async function main(...) | Parameters and their defaults | Return value | From npm, detected from imports |
| C | gcc 14 | int main(int argc, char *argv[]) | // @param lines + waiso_arg_* | waiso_set_result(json) | None — the C library, math.h and waiso.h |
| C++ | g++ 14 | int main(int argc, char *argv[]) | // @param lines + waiso::arg* | waiso::setResult(json) | None — the standard library and waiso.hpp |
The exact versions, and how a script moves to a newer one, are on Runtime versions. How packages are found, pinned and frozen at publish is on Dependencies. Any of the five can also import another script of its own language from the same project — see Reusing code: imports.
And SQL?
A script can also be PostgreSQL or MySQL. It runs against one of the project’s database connections, picked in the editor’s Connection menu (Choose a connection to run this query. until one is set). Its inputs are :name placeholders, optionally declared with -- @param name type = default. How connections are made, and the Workbench for exploring a database, are covered in Integrations and SQL Workbench.
Limits that apply to every language
- A run may take 5 minutes by default. Change it per script in the editor menu → Script settings → Timeout, up to the installation’s ceiling (1 hour unless your administrator raised it). A run that goes over fails with the
timeoutcode. - No network from user code, in any language. Data comes in through inputs and the SDK.
- C and C++ cannot install libraries: they are compiled with gcc’s defaults and linked with the math library and the Waiso SDK only.
- A C or C++ library imported by another script must not define
main.