ScriptsGuide

Writing code

A script is one file with a main function. Its parameters become the Inputs card, whatever it returns becomes the result, and everything it prints streams into Logs. The editor puts all of that on one screen: inputs on the left, code in the middle, the run below it and a side panel on the right for the AI chat, history, dependencies, triggers, state and who uses the script.

What you will learn
  • Write main in Python, TypeScript, JavaScript, C and C++
  • Find your way around the editor: panels, side tabs and the bottom panel
  • Know what Save, Run and Publish each do — and what runs where
  • Use the keyboard shortcuts and focus mode

One screen for code and runs

Open any script from the Code page and the editor fills the window in three columns. On the left, the Inputs card — one field per parameter of main; a script with no parameters has no card. In the middle, the code, with completions and error marks from the language server, and under it the bottom panel with Output, Logs and, while there is something to report, Problems. On the right, the side panel and its tabs.

docs-demoCodehello.pySavePublish
Inputs
Configure the data for this run.
VisualJSON
namestringoptionalworld
hello.py
1def main(name: str = "world"):2    print(f"saying hello to {name}")3    return {"message": f"Hello, {name}!"}
Python 3.15LSP
OutputLogs1SuccessClearRun Ctrl ↵
{
  "message": "Hello, world!"
}
Inputs on the left, code in the middle, the run below it, the side panel on the right.
Side tabWhat it holds
AI chatThe editor assistant: questions and proposed changes
Run historyEvery run of this script; open one to see its code, inputs and result
Dependencies (Python)The packages the imports need — see Dependencies
TriggersThe API endpoint, schedules and event triggers — see Triggers
StateThe values the script keeps between runs — see State
Used byScripts that import it, flow steps, SDK calls and triggers — see Overview and usage

Write main()

Every language has the same contract: the platform calls main with the inputs, waits for it to finish and keeps what it returns. Python writes def main(...); TypeScript and JavaScript export async function main(...); C and C++ use the ordinary int main(int argc, char *argv[]), declare inputs with // @param lines, read them with waiso_arg_* (waiso::arg* in C++) and set the result with waiso_set_result (waiso::setResult). The same small script in all five:

word_count.py
def main(text: str = "the quick brown fox"):
    words = text.split()
    print(f"counted {len(words)} words")
    return {"words": len(words), "longest": max(words, key=len) if words else None}
Expected outputSuccessThe Python, TypeScript and JavaScript result with the default text; the C and C++ variants return only <code>{"words": 4}</code>
{
  "words": 4,
  "longest": "quick"
}

Parameters become the Inputs card

As soon as you give main a parameter, the Inputs card appears on the left with a typed field for it, and it is redrawn while you type. The type comes from the Python type hint, the TypeScript annotation, the default value (JavaScript) or the // @param name type = default line (C and C++). Fill the fields and press Run. The rules — required or optional, which field each type becomes, how the server checks a value — are in Script inputs.

Results and logs

The return value must be something JSON can hold: a dict or object, a list, text, a number, a boolean or nothing. The Output tab shows it, with JSON view and Table view, Copy JSON, Download JSON and Expand output. What you print or console.log goes to Logs as it happens. When a run fails, read Errors and results.

Save, Run and Publish

  1. Run the code on screen

    Run (or Ctrl+Enter, ⌘+Enter on a Mac) sends the code exactly as it is in the editor — saved or not — with the values in the Inputs card. It is disabled while a required input is empty.

  2. Save the draft

    Save (Ctrl+S) stores the code as the script’s draft. The button lights up only while there are unsaved changes. Unsaved edits are also kept in this browser: come back later and a banner offers Keep or Discard.

  3. Publish what you tested

    Publish opens a review of everything that changed since the last publish and, on confirm, makes the draft the version schedules, the API and flows run. It is disabled while there are unsaved changes or nothing new to publish.

The gear beside Publish, Configuration, holds Version history (browse and compare published versions), Triggers and Overview, the page for running the script without its code.

Panels, toolbar and shortcuts

  • Resize the Inputs card (220–480 px) and the side panel (280–640 px) by dragging the seam beside them; the code column never shrinks under 480 px. The widths are remembered for you in this browser.
  • Collapse the side panel to a rail of icons; each icon reopens it on its tab. On a first visit to a narrow screen it already starts collapsed, so the code keeps at least 600 px.
  • Focus mode — Ctrl+B hides the side panel and the bottom panel; press it again or click Show sidebar & panel.
  • Platform SDK in the toolbar opens ready-made snippets: upload and download files, run scripts and flows. Import library adds an import line for a package at the top of the file.
  • The badge at the foot of the code shows the runtime version and the language server’s state — see Runtime versions.
ShortcutDoes
Ctrl/⌘+EnterRun
Ctrl/⌘+SSave
Ctrl/⌘+BFocus mode
F12 or Ctrl/⌘+clickGo to definition
Ctrl/⌘+DSelect the next occurrence

Limits

  • A script has no network access: it cannot call the internet. Data comes from inputs, integrations, variables or state.
  • Only the language’s main is called; anything else at the top of the file runs first, as module code.
  • Without Scripts edit access, Save, Publish and Run are disabled and say why.