Automation
The Automation and Network operations let a workflow do things outside Kitlig: run a script, call a command line tool, send a file to a server, read a value out of JSON. They sit in the Text tab of the operation list, under Automation and Network, and they work everywhere other operations do: the Sandbox, Batch, the Workflow canvas, the Assistant and connected MCP clients.
Warning
These operations run programs on your computer with your access to your files, and they send data over the network. A workflow someone else made can do anything you can. Read a workflow before you run it, the same way you'd read a script.
Who can run them
The first time you press Run on one of these, Kitlig asks Allow Automation operations? Answer Allow and it won't ask again. Answer Cancel and the job fails with nothing run, and you're asked again next time.
MCP clients and the Assistant are refused until you tick Let MCP clients and the assistant run these in Settings. Only that box changes this. Leave it off unless you trust the agent and everything it reads, because a prompt hidden in a web page or a file can ask an agent to run something.
Get Object From JSON touches neither programs nor the network, so it always runs.
Note
If Kitlig closes while one of these is running, it does not start it again when the project reopens. The job fails and asks you to run it again. A script or an upload that restarted on its own could do the same work twice.
Call Function
Call Function starts any program: a command line tool, a Python or Node interpreter, a render script's executable.
- Set Application to the program. Click Browse, or type a name that's on your PATH, such as
git. - Put each argument on its own line in Arguments. A line is one argument, spaces included, so you never quote anything.
- Connect files to Input Files if the program needs them.
Arguments can use {file1}, {file2} and so on for the connected files, {file} for the first one, and {project} for the project folder. If no argument names a file, the connected files go on the end, in order.
Kitlig starts the program directly, with no shell in between. Pipes, && and wildcards mean nothing here. On Windows that also means a .bat or .cmd won't start by itself: point Application at cmd.exe, then put /c and your script on their own lines in Arguments.
Run JavaScript and Run Python
Both take code in two ways: type it in Code, or connect a Text asset to Script File. A connected file wins.
Run JavaScript uses the Node.js Kitlig found, or its own built-in runtime when there isn't one.
Run Python uses the Python Kitlig found, unless you say otherwise:
- Python Environment is a venv or conda folder. Kitlig finds the python inside it and sets the folder up the way activating it would, so its packages load.
- Python Executable is one specific python program. It wins over Python Environment.
What every program gets and gives back
Standard Input is sent to the program as it starts. Working Folder is where it runs, the project folder by default. Environment Variables takes one NAME=value per line.
Three more variables are always set:
| Variable | Holds |
|---|---|
KITLIG_OUTPUT_DIR |
A folder for the program to write results into |
KITLIG_PROJECT_DIR |
The project folder |
KITLIG_INPUT_FILES |
The connected files, as a JSON list of paths |
The operation hands back:
- stdout, what the program printed, as a text file.
- stderr, its error output.
- exitCode, its exit code.
- file, everything it left in
KITLIG_OUTPUT_DIR, as project files of the right kind.
Output lines show in the job row while it runs. A non-zero exit code fails the job with the end of the error output as the message. Turn on Keep Going on a Non-Zero Exit Code if the code is an answer rather than a failure, and wire exitCode into a Branch.
The job stops at Timeout, ten minutes by default. Set it to 0 for no limit. Cancelling the job stops the program and anything it started.
Network operations
GET, POST, PUT and DELETE each call a URL. All four take Headers (Name: value per line, or a JSON object) and Query Parameters (name=value per line, or a JSON object).
POST and PUT send what you give them:
- Body Text alone goes as the body. Kitlig marks JSON as JSON and everything else as plain text, unless you set Content Type.
- One file on Files goes as the raw body.
- Text and files together, or several files, go as one multipart form. Form Field for Files and Form Field for Text name the fields. Turn on Always Send as a Form (multipart) to send a single file that way, which is what most upload forms expect.
The operation hands back response, status and responseHeaders. A text reply becomes a text file. A binary reply becomes a project file of the right kind, so an image lands with your images and wires into image inputs.
A 4xx or 5xx status fails the job. Turn on Keep Going on an Error Status to handle it yourself, by wiring status into a Branch.
Keeping tokens out of your files
What you type on an operation is saved: in the job's history, shown in the Inspector, and in the workflow file. So don't type a token into Headers. Set it as an environment variable before you start Kitlig, and refer to it:
Authorization: Bearer {{env:MY_API_TOKEN}}
Kitlig fills that in as it sends the request, so the token stays out of the project. {{env:NAME}} works in Headers and Query Parameters. Kitlig never writes headers, the query string or the body to its logs or the job row.
Get Object From JSON
Get Object From JSON reads one value out of JSON. Connect a file to JSON File, or type or wire text into JSON Text. A connected file wins.
Set Object Path with dots: data.items.0.url and data.items[0].url both find the first item's URL. Leave it empty to get the whole document. Text comes out bare, and numbers, lists and objects come out as JSON. A path that finds nothing fails the job, so a changed reply stops the workflow instead of feeding blank text downstream.
Chaining them in a workflow
Text outputs wire into any text field. To send a script's result to a server and read one value back:
- Drop Run Python, POST and Get Object From JSON on the canvas.
- Wire stdout into the pin beside Body Text.
- Wire response into the pin beside JSON Text.
- Set URL and Object Path, and press Run.
Workflows normally reuse a node's earlier result when nothing changed. Automation and Network nodes never do: running the graph runs the script and sends the request again every time.
Note
The Workflows Utility tab also has HTTP Request and Get JSON Object nodes. They predate these operations and stay inside the canvas. HTTP Request follows the same permission rules as the operations above. Get JSON Object never leaves the app, so it doesn't ask.