Python FaaS
In on-premises deployments of IBM® Concert Workflows®, you can use the built-in Python and Python CLI function-as-a-service (FaaS) action blocks to run and manage Python code in your workflows.
- For IBM Concert Workflows®, the FaaS integration, including the Python FaaS and Ansible FaaS blocks, is not available in deployments on FIPS-enabled environments.
- The default Python execution environment image is
3.14.5-alpine3.23, which is built on top of thedocker.io/python:3.14.5-alpine3.23base image.
Python block
You can use the Python FaaS block to run and manage Python code in your workflows. Python is one of the most popular programming languages that is used across different industries and use cases. You can easily include Python scripts and programs in your workflows and pass parameters to them by using the workflow editor.
To use this block in your workflow, complete these steps:
- In the workflow editor, in the integration list, open the FaaS folder.
- Drag the Python block onto the desired location in your workflow.
- Optional: In the object editor, in the Code variable, click the edit icon and enter your Python code in the editor.
To pass data from the Python code back out into your workflow, use the
printcommand or any other command that outputs to stdout. The values that you print are assigned to the block'sresultvariable. - Optional: In the parameters variable, pass data from the workflow to your Python script.
The properties that you add in the parameters object automatically become variables within the Python code. For example, if you declared a workflow variable called
$msg, you can pass it to the Python script by adding a property calledmsgin the parameters object, then giving the property a value, such as Hello, World. - Optional: Run a cached version of the Python code by setting the fullBuild parameter's value to
true.
Python CLI block
The Python CLI block allows for Python command-line scripts to be executed within the workflow environment. Python is the supported programming language and the main difference is that the input is always text-based. While the Python block executes the content like a Python interpreter, the Python CLI block runs the code as it is run through the command-line interface.
To use this block in your workflow, complete these steps:
- Drag the Python CLI action block from the FaaS folder onto your chosen workflow location.
- In the Code variable, specify whether you want to use const or expression input.
- In the object editor, for the Code variable, click the edit icon and enter Python code in the code editor. For example, you might enter these Python commands:
import sys print("Here are my CLI arguments!") print(sys.argv)Note: The Python CLI code input limit is 2097000 bytes (roughly 1.99 MB). - Optional: In the CLI parameters variable, pass data from the workflow to the Python script.
- Optional: Run a cached version of the Python code by setting the fullBuild parameter's value to
true.Note: Set this property totruebefore publishing to production. Set it tofalseduring debugging or when frequent changes to the code are being made.
Data is passed out of the Python CLI block as if it is run via the command-line interface. Anything that is printed appears in the $result property of the block when you run your workflow.