> For the complete documentation index, see [llms.txt](https://university.mindstudio.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://university.mindstudio.ai/building-ai-agents/blocks-reference/run-script-block.md).

# Run Script Block

Execute a Workflow Script from the Automations Canvas.

## Overview

The **Run Script** block runs a Workflow Script file and maps its inputs and outputs to workflow variables. It acts as the connection point between a script written in the Script Editor and the broader workflow on the Automations Canvas.

See [Workflow Scripts](/building-ai-agents/workflow-scripts.md) to get started.

## Configuration

### Source Code

Select the Workflow Script file you want to run from the dropdown. Source code that will be executed when the Agent runs.

### Parameters

#### Input Variables

Map workflow variables to the script's input parameters. Each row shows the parameter name and the workflow variable to assign to it.

<table><thead><tr><th width="203.83203125">Field</th><th>Description</th></tr></thead><tbody><tr><td>Parameter name</td><td>The input parameter defined in the script (e.g., <code>topic</code>)</td></tr><tr><td>Variable</td><td>The workflow variable whose value will be passed in (e.g., <code>{{topic}}</code>)</td></tr></tbody></table>

{% hint style="info" %}
Assign values to the launch variables of the selected script.
{% endhint %}

#### Output Variables

Map the script's return values to workflow variables so they can be used by following blocks.

<table><thead><tr><th width="206.19921875">Field</th><th>Description</th></tr></thead><tbody><tr><td>Return key</td><td>The key from the script's return object (e.g., <code>summary</code>)</td></tr><tr><td>Variable</td><td>The workflow variable to store the value in (e.g., <code>{{summary}}</code>)</td></tr></tbody></table>

{% hint style="info" %}
Map the return values of the script to workflow variables.
{% endhint %}


---

# 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://university.mindstudio.ai/building-ai-agents/blocks-reference/run-script-block.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.
