> For the complete documentation index, see [llms.txt](https://docs.violetlabs.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.violetlabs.com/features/scripts.md).

# Scripts

Violet **Scripts** allow you to author and run code that can reference (and write to) your live Violet data.

<figure><img src="https://2091741164-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvrraExym8pNEUvBDoima%2Fuploads%2FldCQnOFdAXYPl2kCirq4%2FScriptDetail.png?alt=media&amp;token=5db169d7-29fc-4363-a93f-d603fc1cbe17" alt=""><figcaption></figcaption></figure>

## Overview

Use Scripts to size subsystems, analyze test results, compare data between applications, generate reports or execute external simulations and workflows.

Script outputs can be consumed or referenced elsewhere in Violet, for example in [Parameters](/features/parameters.md), [Requirements](/features/requirements.md) and [Verifications](/features/requirements/verifications.md).

Violet Scripts function as embedded Jupyter Notebooks and can contain 1 or more *code cells*. For a primer on Jupyter, we recommend you check out their how-to [here](https://jupyter-notebook.readthedocs.io/en/stable/notebook.html).

## Getting started

To get started, navigate to **Scripts** and click <img src="https://2091741164-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvrraExym8pNEUvBDoima%2Fuploads%2FaZ3muxr2GW3Lti623mHe%2FScreenshot%202025-02-03%20at%203.03.01%E2%80%AFPM.png?alt=media&amp;token=ea21aa20-9c21-40d6-b8c3-c7c88962e6cf" alt="" data-size="line">.

In the Inspector panel, select Settings. Provide a name and description (optional) for your script, and specify your language of choice: Python, Julia or MATLAB.

Next, let's test your skills. With Python selected, type `print('hello world')` in a code cell and click **Run All**. This will execute the script and display the output below the cell.

<figure><img src="https://2091741164-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvrraExym8pNEUvBDoima%2Fuploads%2FDhDwsiMYj6AQiU6VyUME%2FScreenshot%202026-07-27%20at%2012.06.53%E2%80%AFPM.png?alt=media&amp;token=e461ffa2-bf91-454b-952b-f86d2c4c6f31" alt="" width="563"><figcaption></figcaption></figure>

## Variables

Use Violet **Variables** to reference and consume your live Violet data. Variables will update automatically when the source data changes.&#x20;

Variables can reference data from [Integrations](/integrations/connect-your-data.md) (ie. live data from applications you've connected), [Parameters](/features/parameters.md), [Requirements](/features/requirements.md), [Verifications](/features/requirements/verifications.md) or other [Scripts](/features/scripts.md) outputs.

To create a Violet Variable, use the reserved syntax `Violet["variable_name"]` within your script, replacing `variable_name` with the name of your choice. Variable names must be unique within each script and can only contain letters, numbers and underscores.

In the **Inputs** panel, you will be prompted to link a property.

<figure><img src="https://2091741164-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvrraExym8pNEUvBDoima%2Fuploads%2FqvnLQ9Rv8lAZjeWgYiwc%2FVariable-link.png?alt=media&amp;token=26842831-2e5c-4c42-8573-b5e56a6450d2" alt="" width="563"><figcaption></figcaption></figure>

Use the search field to find and select the data of your choice, then click Run to see the updated results.

<figure><img src="https://2091741164-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvrraExym8pNEUvBDoima%2Fuploads%2FfUAVTbsuieDx8rrgmqjZ%2FVariable-output.png?alt=media&amp;token=a459d17e-abd3-4e03-b342-d69b6e1867d4" alt="" width="563"><figcaption></figcaption></figure>

## Auto-run

Setting a Script to **Auto-run** will trigger it to re-execute when the value of an input variable changes.

In the example below, a script variable is linked to a parameter. When the value of the parameter is updated, the script is automatically re-run, and the new results are shown:

{% embed url="<http://loom.com/share/64b842b256a64829b938181a906e137d>" %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.violetlabs.com/features/scripts.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
