> ## Documentation Index
> Fetch the complete documentation index at: https://trickest.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Using Scripts

> Add a script node to a workflow, configure its arguments and inputs, run it, and create private scripts in the Library.

## Overview

A **script node** is a containerized environment that runs code you provide as part of a workflow. Scripts are useful when no built-in tool fits, when you need to glue tools together, or when you want to parse, filter, or reshape data between steps. For an introduction to what script nodes are and how they relate to other building blocks, see [Scripts](/docs/key-concepts/building-blocks/scripts) in Key Concepts.

This page covers the day-to-day use of scripts in the editor: how to add one, how to configure its arguments and inputs, how to run it, and how to create your own **private scripts** in the Library.

***

## Adding a Script Node

You can add a script node from the Workflow Editor in two ways: from the **Add node** menu (any time) and from the **Quick create** shortcuts (only on an empty canvas).

<Steps>
  <Step title="Open Add node">
    Click **Add node** in the top-right of the canvas. The node library panel opens with a search box and lists tools, scripts, and modules you can add.
  </Step>

  <Step title="Pick a script">
    Search by name (for example, `bash`, `python`, `go`, `node`) or by what the script does. Click an entry, or drag it onto the canvas, to add the script node.
  </Step>
</Steps>

On a new, empty canvas the editor also offers a **Quick create** shortcut block with one button per language: **Python**, **Bash**, **Go**, and **Node.js**. Clicking one drops a starter script of that language at the center of the canvas.

> **Note** Trickest supports four script languages: **Bash**, **Python**, **Go**, and **Node.js**.

***

## Configuring a Script Node

Double-click the script node on the canvas to open its **node modal**. The modal has two main areas:

* **Left panel: Inputs.** This panel is split into **Arguments**, **Files & Folders**, and **Connected Nodes**. Each section is described below.
* **Center panel: Code editor.** A read-write code editor showing the script source, with syntax highlighting for the script's language. While a node is running or while you are viewing a past run, the editor switches to read-only.

A console below the code editor shows live execution output when the node runs.

***

## Working with Script Arguments

Script arguments are CLI-style flags and values passed to the script when it runs. They are managed in the **Arguments** section of the Inputs panel.

### Detected Arguments

When you write argument-parsing code in the script (for example, Python `argparse` or `click`, Bash `case` or `getopts`, Go `flag`, Node `commander` or `yargs`), the editor detects the argument definitions automatically and lists them under **Arguments**. A small sparkles indicator on the right shows how many were detected, with a tooltip that reads *"N arguments detected from script"*.

Each detected argument shows:

* The flag (for example, `--target`, `-t`)
* A value field, or a toggle when the argument is boolean
* An optional description, surfaced as a tooltip on the flag

To set a value, type it directly into the value field next to the flag. For boolean arguments, flip the toggle.

> **Tip** Detected arguments stay visible even when no value is set, so you always see what the script supports. Setting an empty value (or toggling a boolean off) removes that argument from the run command.

### Custom Arguments

You can also pass arguments that are not detected from the script source. To add one:

<Steps>
  <Step title="Click Add argument">
    Click **Add argument** below the existing arguments. An inline row appears with a flag field and a value field.
  </Step>

  <Step title="Enter the flag and value">
    Type the flag (for example, `--verbose`) in the left field and the value in the right field. Press **Enter** to save, or **Esc** to cancel.
  </Step>
</Steps>

A custom flag with no value is saved as a boolean toggle. A row entered as a value with no flag is saved as a positional argument and passed in order to the script.

### Removing an Argument

Hover an argument row and click the small **x** on the right. Removing a detected argument clears its value but keeps the row visible. Removing a custom argument deletes it from the list.

***

## Connecting Inputs (Files and Folders)

Script nodes consume **file** and **folder** inputs, either added directly or connected from upstream nodes.

### Add Files Directly

The **Files & Folders** section of the Inputs panel lets you bring data in without an upstream node:

* Paste a public URL to a file
* Paste a folder URL (for example, a remote bucket path the platform supports)
* Upload a file from your machine
* Pick a file you previously uploaded from the storage browser

### Connect From an Upstream Node

To use the output of another node as a script input, drag a connection from the upstream node's output handle onto the script node. The script's modal switches to **connect mode** and shows the available inputs. Pick the input you want the upstream output to feed into; the connection is established and the upstream node appears under **Connected Nodes**.

To remove a connection, open the script modal and click the disconnect action on the corresponding **Connected Nodes** entry.

For folder outputs and distributed inputs, the connect-mode picker may also offer a **distribution choice** (for example, "aggregate" vs. "continue"); pick the behavior you want and the connection is wired accordingly. For more on distribution, see [Distributing and Scaling Jobs](./distributing-and-scaling-jobs).

***

## Running a Script Node

Script nodes execute the same way as tool nodes:

* Click **Run** in the node modal to run the script on its own. The platform builds the command (script invocation plus the configured arguments and inputs) and runs it on a machine from the chosen fleet. The console shows live output and the **Outputs** section lists files and folders the script produced.
* Click **Execute** in the top-right of the canvas to run the whole workflow, including this script node, end to end. See [Executing and Scheduling Workflows](./executing-and-scheduling-workflows).

> **Note** The Trickest platform writes script outputs to a fixed conventional location inside the container (for example, `/hive/out/`). Output files written there are made available to downstream nodes when the script finishes.

***

## Private Scripts in the Library

A **private script** is a script you save to the Library so you (and your workspace) can reuse it across workflows like any other Library item. Private scripts live alongside public scripts, but only members of your vault can see and use them.

> **Note** Private scripts require the **Private Tooling** feature, available on Enterprise plans. If your account does not have the feature, the **Create Script** page shows an upgrade gate explaining what private scripts unlock.

### Creating a Private Script

<Steps>
  <Step title="Open the Library">
    From the sidebar, open **Library**. Filter to **Scripts** with **Visibility: Private** to see only your private scripts.
  </Step>

  <Step title="Open the Create menu">
    Click **+ Create** in the top-right and choose **Script**. The Create Script page opens.
  </Step>

  <Step title="Fill out the script">
    Enter a **Name** (lowercase letters, numbers, and hyphens only) and choose a **Language** (Bash, Python, Go, or Node.js). A starter template is loaded into the code editor on the right; replace it with your script. Optionally fill in a **Description**, and expand **More** to add a **Source URL** or **Docs URL**.
  </Step>

  <Step title="Save the script">
    Click **Create Script** in the top-right. You are returned to the Library, filtered to your private scripts, and the new script appears there. You can also press `Cmd+S` (or `Ctrl+S`) at any time to save.
  </Step>
</Steps>

### Editing or Deleting a Private Script

To edit, open the script in the Library and click **Edit**; the same editor reopens with the existing source loaded. The submit button reads **Save Changes** when editing.

To delete, click **Delete** in the script editor's top-right and confirm in the dialog. Deleting a script affects any workflows that use it, so check uses first.

### Using a Private Script in a Workflow

After it is saved, a private script behaves like any other Library item:

<Steps>
  <Step title="Open a workflow">
    Open the workflow you want to use the script in.
  </Step>

  <Step title="Add the script as a node">
    Click **Add node**, search by the script's name, and add it to the canvas. The node modal looks the same as for any script node: code on the right, Inputs on the left.
  </Step>

  <Step title="Configure and run">
    Set arguments, connect inputs, and run the node (or run the workflow). Edits made inside the workflow's script node only affect that workflow's copy; to update the canonical version, open the script in the Library and edit it there.
  </Step>
</Steps>

***

## Next Steps

<CardGroup cols={2}>
  <Card title="Building and Debugging a Workflow" icon="code" href="./building-and-debugging-a-workflow">
    Add nodes, connect them, and run and debug workflows.
  </Card>

  <Card title="Distributing and Scaling Jobs" icon="diagram-project" href="./distributing-and-scaling-jobs">
    Split file and folder inputs into many parallel jobs.
  </Card>

  <Card title="Scripts (Key Concepts)" icon="code-branch" href="/docs/key-concepts/building-blocks/scripts">
    Understand what script nodes are and how they relate to workflows and the Library.
  </Card>
</CardGroup>
