> 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-function-block.md).

# Run Function Block

Execute custom JavaScript or Python code in a workflow

The **Run Function Block** empowers your workflows with the ability to execute advanced, custom logic, enabling deeper integration and greater flexibility. This block ensures workflows remain adaptable to your most specific needs. This block is ideal for performing complex calculations, integrating with external APIs, or processing data dynamically.

{% embed url="<https://youtu.be/3bgTOhacFAk>" %}

## **Configurations**

### **Function**

Select the Function you want to execute or create a new one.

* **Select a Function**: Use the dropdown menu to choose an existing custom function from Explorer.
* **New Function**: Click the **New\...** button to create a new function in either JavaScript or Python. New Functions are automatically added to the Functions folder in your Explorer.
* Clicking **Browse community functions...** to import functions submitted by members of the MindStudio community into your project.

**Note:** Community functions are not maintained by MindStudio. It’s essential that you test our any community functions before incorporating them into your workflows. For updates to the function, you’ll need to reach out to the creator of the function.

### Additional Configurations

All Functions are custom coded and will have different configurations depending on the function that is selected for use in this block.


---

# 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-function-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.
