Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Python

Introduction

This document provides an overview of the integration between Automate and Python, explaining how Python codes can be executed to automate processes using Python library actions.

The integration enables users to execute Python scripts within Automate, facilitating automation of various tasks.

What is Python?

Use Python when a local script is the appropriate way to transform or prepare data. The selected Mate Agent must provide the required interpreter and dependencies.

Overview of Python: Python is a high-level programming language known for its simplicity and readability. It is widely used for various purposes including web development, data analysis, artificial intelligence, and automation.

Key Features:

  • Script Execution: Execute Python scripts to perform tasks.

  • Variable Assignment: Assign output of scripts to variables for further processing.

  • Flexibility: Supports both script file execution and direct entry of Python code.

Automate Integration with Python

Overview of Integration: Automate integrates with Python to execute scripts and automate various tasks within workflows.

Examples of Automated Tasks:

  • Running Python scripts to process data.

  • Automating repetitive tasks using Python code.

  • Integrating Python scripts into complex automation workflows.

Using the Integration

Python Open prepares a script from File Path or Manual Input in the code editor and assigns it to a variable. In the current Run form, Choose Script consumes that prepared variable and Assign value to variable receives the result. Direct file/code entry belongs to Open; it is not shown in the inspected Run form.

How To Use Actions

Open

Description: Prepare Python script for execution.

Purpose: Define or select Python script to be executed.

Usage:

  1. Define or select the file path of the Python script.

  2. Alternatively, write Python script using the built-in code editor.

  3. Assign the Python script data to a variable for input in the Run Python action.

Inputs:

  • File Path or Python Script

Outputs:

  • Python Script Data Variable

Current Python Open form: File Path or Manual Input, followed by the required script-variable assignment. The shown draft has not completed that assignment.
Current Python Open form: File Path or Manual Input, followed by the required script-variable assignment. The shown draft has not completed that assignment.
Current Python code editor showing an illustrative main function returning DOCS_PYTHON_OK. Code entry only; no execution result was recorded.
Current Python code editor showing an illustrative main function returning DOCS_PYTHON_OK. Code entry only; no execution result was recorded.

Run

Description: Execute Python script.

Purpose: Execute Python script and capture output.

Usage:

Select the script variable produced by Python Open in Choose Script. Select an output variable in Assign value to variable, then test the completed flow on the intended Mate Agent.

Inputs:

  • Script Variable

Outputs:

  • Output of the Python Script

Current Python Run form: Choose Script and Assign value to variable. Blank mandatory mappings explain the visible draft validation errors.
Current Python Run form: Choose Script and Assign value to variable. Blank mandatory mappings explain the visible draft validation errors.

Additional Tips

Use Cases

FAQ

Worked example: Open and Run a fixed Python response

Use the fixed response shown in the current editor to exercise the Open → Run mapping after confirming the installed action’s entry-point requirements. The screenshots were taken from an unsaved draft; they do not verify the interpreter or a successful Python execution.

1. In an isolated Hyperflow, add Python → Open. Choose manual code entry and open the code editor.

2. Enter the illustrative main function below. In Open → Assign value to variable, select the script-data variable offered by the installed action.

3. Add Python → Run. In Choose Script, select the variable returned by Open. Assign the Run result to a String variable named python_result.

4. Run the test once on the intended Mate Agent. Open the Run action values and inspect python_result.

5. Inspect whether the returned value contains DOCS_PYTHON_OK. Record the actual type and any response wrapper before mapping it downstream; do not infer success or its result shape from the editor screenshot.

6. If Run fails before producing text, record the selected Agent, action version and interpreter/dependency error. A script that works on your own computer does not confirm that runtime configuration.

Was this helpful?