Share

How to return variables from a Python Runtime in Orchestrator workflow

by Mayank Goyal · 8 Dec 2025

Running Python polyglot code as an Action (not in a Scriptable Task) is the correct and supported way to return structured outputs likeย Propertiesย into an Aria Automation Orchestrator workflow.

Version tested: Aria Automation Orchestrator 8.18.1

Background

When working with polyglot runtimes (Python, Node.js, PowerShell) in Aria Automation Orchestrator, it is natural to try running the code directly inside a Scriptable Task. However, Scriptable Tasks execution seems to does not host the polyglot container or its handler(context, inputs) contract. This difference is exactly what explained why a Python script returning a Properties object worked in an Action but produced empty output when used inside a Scriptable Task.โ€‹

Flowchart of a Python output test in Aria Automation Orchestrator, showing a decision node and a scriptable task with the variable 'outputs' indicating a type of 'Properties'.

The working pattern

In the successful setup, the Python logic is implemented as a dedicated Action with a Python runtime and a Properties return type. The action code follows the expected handler signature and returns a JSONโ€‘serializable dictionary:โ€‹

import json

def handler(context, inputs):
    jsonOut = json.dumps(inputs, separators=(',', ':'))
    print("Inputs were {0}".format(jsonOut))
    print("Context is: {0}".format(context))

    myToken = context["getToken"]()
    outputs = {
        "status": "done",
        "token": myToken
    }
    print("outputs: {0}".format(outputs))
    return outputs
Screenshot of a workflow in Aria Automation Orchestrator showcasing a Python output test, including action elements like Decision and Scriptable Task, with 'outputs' variable displaying 'Properties'.

The Action is defined with annotations that select the Python runtime and declare the output type as Properties. In the workflow schema, this Action is dropped as an action element (testAction in the screenshot), and its output is bound to a workflow variable named outputs of type Properties. The subsequent Scriptable Task sees outputs as a JavaScript object and can read outputs.status and outputs.token directly.โ€‹

โ€‹

Screenshot showing the execution of a Python output test in a workflow with a decision element, an action, and a scriptable task, highlighting logs that display output values such as status and token.

Why Scriptable Task alone fails

Possible cause could be that the Scriptable Task does not know about the handler(context, inputs) contract and does not automatically serialize the returned value back into a workflow output. As a result, returning a Python dictionary from such adโ€‘hoc execution yields no bound output, which matches the โ€œempty outputโ€ behaviour that was observed before switching to an Action and this behavior is consistent with other supported types as well:

  • โ€‹String
  • Number
  • Boolean
  • Date
  • Composite Type

The screenshot shows the correct and recommended design pattern: build all Python logic as Actions and use Scriptable Tasks only as orchestrating JavaScript glue. In practice, this looks like:โ€‹โ€‹

  • Define a Python Action with @runtime python:โ€ฆ and @outputType Properties (or another supported type).โ€‹
  • Implement the logic in handler(context, inputs) and return basic types or dictionaries/lists composed of basic types so that Orchestrator can serialize them.โ€‹
  • Place that Action element on the workflow schema, bind its output to a Properties variable, and consume it in followโ€‘up Scriptable Tasks or as workflow outputs.โ€‹โ€‹

This pattern ensures the data coming from Polyglot runtimes are passable across tasks inside workflow or a across workflows.


Discover more from Cloud Blogger

Subscribe to get the latest posts sent to your email.

You may also like