---
name: codeengine-lithops
title: Running jobs with Lithops framework
description: Lithops is an open source framework that designed to massively scale your Python applications. Lithops provides a simple push to the IBM Cloud&reg; Code Engine experience so that you can focus on your Python code, while Lithops focuses on the deployment of your code at massive scale while monitoring executions, obtaining results, and much more. Lithops enables native Python integration with Code Engine by using the Lithops API. For more information about Lithops, see Lithops quick start guide.
last-updated: 2025-06-03
---

> ## Documentation Index
> The table of contents for this documentation set is at https://cloud.ibm.com/docs/codeengine?format=markdown
> The index for all IBM Cloud docs is at: https://cloud.ibm.com/docs/llms.txt
> Use these files to discover more information as needed.

# Running jobs with Lithops framework
{: #lithops}

Lithops is an open source framework that designed to massively scale your Python applications. Lithops provides a simple push to the IBM Cloud&reg; Code Engine experience so that you can focus on your Python code, while Lithops focuses on the deployment of your code at massive scale while monitoring executions, obtaining results, and much more. Lithops enables native Python integration with Code Engine by using the Lithops API. For more information about Lithops, see [Lithops quick start guide](https://github.com/lithops-cloud/lithops#quick-start){: external}.
{: shortdesc}

## Running your first flow by using the Lithops framework
{: #first-lithops}

Before you can run jobs that reference the Lithops framework, you must first install Lithops and set up a storage backend.

Before you begin

- Install [Code Engine CLI](https://cloud.ibm.com/docs/codeengine?topic=codeengine-install-cli&format=markdown).
- [Create and work](https://cloud.ibm.com/docs/codeengine?topic=codeengine-manage-project&format=markdown) with a Code Engine project.
- [Find and set your `kubeconfig` environment variable](https://cloud.ibm.com/docs/codeengine?topic=codeengine-kubernetes&format=markdown).

### Installing Lithops
{: #install-lithops}

1. Install [Lithops](https://github.com/lithops-cloud/lithops#quick-start){: external}.
2. Create the [Lithops configuration file](https://github.com/lithops-cloud/lithops/tree/master/config#lithops-configuration){: external}.
3. Install [Docker (community edition) version](https://docs.docker.com/get-started/get-docker/){: external}. 
4. Log in to Docker.

    ```txt
    docker login
    ```
    {: pre}

### Setting up a storage backend for Lithops
{: #storage-lithops}

Select a [supported storage backend](https://github.com/lithops-cloud/lithops/tree/master/config#compute-and-storage-backends); for example, IBM Cloud Object Storage. 

To set up IBM Cloud Object Storage, 

1. Create an [IBM Cloud Object Storage account](https://www.ibm.com/products/cloud-object-storage).
2. Create a bucket in the region that you want to use.
3. In the side navigation, click **Endpoints** to find your API endpoint. You must copy both the public and private endpoints of the region where you created your bucket.
4. Create the credentials to access to your IBM Cloud Object Storage account. **Choose one option**

#### Option 1 (API key) for Lithops
{: #option1-storage}

1. From the IBM Cloud Object Storage navigation, click **Service Credentials**.
2. Click **New credential +** and provide a name and select a role.
3. Click **Add** to generate service credential.
4. Click **View credentials** and copy the `apikey` value.
5. Edit your `lithops` config file and add the following keys.

    ```yaml
    lithops:
        storage_backend: ibm_cos

    ibm_cos:
        endpoint   : <REGION_ENDPOINT>  
        private_endpoint : <PRIVATE_REGION_ENDPOINT>
        api_key    : <API_KEY>
    ```
    {: pre}

#### Option 2 (IBM Cloud Object Storage HMAC credentials) for Lithops
{: #option2-storage}

1. From the IBM Cloud Object Storage navigation, click **Service Credentials**.
2. Click **New credential +** and provide a name and select a role.
3. Click **Advanced options** and enable the option `Include HMAC Credential`. 
4. Click **Add** to generate service credential.
5. Click **View credentials** and copy the `access_key_id` and `secret_access_key` values.
6. Edit your `lithops` config file and add the following keys:

    ```yaml
    lithops:
        storage_backend: ibm_cos

    ibm_cos:
        endpoint   : <REGION_ENDPOINT>  
        private_endpoint : <PRIVATE_REGION_ENDPOINT>
        access_key    : <ACCESS_KEY_ID>
        secret_key    : <SECRET_KEY_ID>
    ```
    {: pre}

#### Option 3 (IBM IAM API key) for Lithops
{: #option3-storage}

1. If you don't have an IAM API key, navigate to the [IBM IAM dashboard](https://cloud.ibm.com/iam/apikeys).
2. Click **Create an IBM Cloud API Key**. Enter a name and optional description for your API key and click **Create**.
3. Copy the generated IAM API key (You can see the key only when you create it, so make sure to copy it).
4. Edit your `lithops` config file and add the following keys:

    ```yaml
    lithops:
        storage_backend: ibm_cos

    ibm:
        iam_api_key: <IAM_API_KEY>

    ibm_cos:
        endpoint   : <REGION_ENDPOINT>  
        private_endpoint : <PRIVATE_REGION_ENDPOINT>
    ```
    {: pre}

### Deploy your first Code Engine job by using Lithops
{: #running-first}

Run the following **hello world** example, 

```txt
import lithops

iterdata = [1,2,3,4,5]

def my_map_function(data):
    return data + 1

if __name__ == '__main__':
    pw = lithops.function_executor(type = "serverless", backend='code_engine') 
    futures = pw.map(my_map_function, iterdata)
    print (pw.get_result())
    pw.clean()
```
{: pre}

### Next steps for Lithops
{: #nextsteps-lithops}

You can find more examples and use cases, as well as ask questions, on the [Lithops project page](https://github.com/lithops-cloud/lithops){: external}.