Getting started with Workflows

Note

Workflows is at the Preview stage.

Note

Currently, there are two UIs that support Workflows: Yandex Cloud and Yandex AI Studio. In this case, the following applies:

  • Workflows created in the Yandex Cloud UI are automatically available in the AI Studio UI.
  • Workflows created in the AI Studio UI are not available in the Yandex Cloud UI.

Starting September 3, 2026, Workflows will no longer be supported in the Yandex Cloud UI. To create and manage workflows, use the AI Studio UI.

Using this tutorial, you will create and run a workflow. During the execution of the workflow, the Yandex Cloud Functions functions will be called.

Get your cloud ready

AI Studio follows the Yandex Cloud resource model, where most services store their resources in folders. Folders belong to clouds, and clouds belong to organizations. You will need a folder to work with AI Studio.

  1. Log in to AI Studio under your personal Yandex account (Yandex ID). For a detailed guide on how to create such an account, see Yandex ID Help.

  2. Create an organization:

    • Enter the organization name.
    • Specify the cloud name. This name will be used for all the Yandex Cloud resources.
    • Click Open AI Studio.

    The organization will automatically get a new folder named default.

Linking a billing account

To work with AI Studio, you need an active billing account linked to your cloud. When you create your first billing account and add a credit/debit card, you will get your initial grant.

  1. After you log in to AI Studio, click Link billing account in the top-right corner of the UI.

  2. Create a billing account or select an existing one.

    • Click Add card.
    • Specify your card details: 16-digit number, expiration date, and CVV (you can find it on the back side of your card).
    • Click Link.
  3. Make sure the billing account status is ACTIVE or TRIAL_ACTIVE.

Create a service account

  1. In the management console, select the folder for your service account.
  2. Navigate to Identity and Access Management.
  3. Click Create service account.
  4. Name the service account: sa-for-function.
  5. Click Add role and select functions.functionInvoker.
  6. Click Create.

Create a function to filter data

  1. In the management console, select the folder to create your function in.
  2. Navigate to Cloud Functions.
  3. Create a function:
    1. In the top-right corner, click Create function.
    2. Enter the function name: filter-function.
    3. Click Create.
  4. Create a function version:
    1. In the Editor window that opens, select Node.js 22.
    2. Disable Add files with code examples.
    3. Click Continue.
    4. Create a file named index.js and add the following code into it:
      module.exports.handler = async function (data, context) {
          return {
              id: data.id,
              name: data.name,
              email: data.email,
          };
      };
      
    5. Under Parameters, specify the following in the field:
      • Entry point: index.handler.
      • Service account: sa-for-function.
    6. Click Save changes.

Create a function to return email addresses

  1. In the management console, select the folder to create your function in.
  2. Navigate to Cloud Functions.
  3. Create a function:
    1. In the top-right corner, click Create function.
    2. Enter the function name: return-function.
    3. Click Create.
  4. Create a function version:
    1. In the Editor window that opens, select Node.js 22.
    2. Disable Add files with code examples.
    3. Click Continue.
    4. Create a file named index.js and add the following code into it:
      module.exports.handler = async function (data, context) {
          return {
              result: "OK",
              emails: data.loaded_users.map(p => p.email)
          };
      };
      
    5. Under Parameters, specify the following in the field:
      • Entry point: index.handler.
      • Service account: sa-for-function.
    6. Click Save changes.

Create a workflow

  1. In the AI Studio UI, select the folder where you want to create a workflow.

  2. In the left-hand panel, expand Agent Atelier and select Workflows.

  3. Click Create workflow.

  4. Select the YaML specification method.

  5. Add the specification below. In the functionId field:

    • In line 39, step process_user_transform_info, specify the filter-function ID.
    • In line 44, step upload_users, specify the return-function ID.
    yawl: "0.1"
    start: get_users
    defaultRetryPolicy:
      maxDelay: 10s
      retryCount: 2
      errorList:
        - STEP_QUOTA_EXCEEDED
    steps:
      get_users:
        httpCall:
          url: 'https://jsonplaceholder.typicode.com/{{ .resource_type }}'
          method: GET
          headers: {}
          query: {}
          output: '{{ {loaded_users: .} }}'
          next: process_users
      process_users:
        foreach:
          input: {{ .loaded_users }}
          output: '{{ {loaded_users: .} }}'
          next: upload_users
          do:
            start: process_user_get_info
            steps:
              process_user_get_info:
                httpCall:
                  url: https://jsonplaceholder.typicode.com/users/{{ .id }}
                  method: GET
                  headers: {}
                  query: {}
                  next: process_user_transform_info
                  output: '{{ {user: .} }}'
                  retryPolicy:
                    retryCount: 2
                    errorList:
                      - HTTP_CALL_500
              process_user_transform_info:
                functionCall:
                  functionId: <function_ID>
      upload_users:
        functionCall:
          functionId: "<function_ID>"
          input: '{{ {loaded_users, resource_type} }}'
    
  6. Click Additional parameters and select sa-for-function in the Service account field.

  7. Click Create.

Run the workflow

  1. Select a workflow.

  2. Click Execute.

  3. Enter input data in JSON format and click Execute.

    Input data in JSON format:

    {
      "resource_type": "users"
    }
    
  4. When the workflow status changes from Running to Completed, the following JSON formatted result will appear in the Output data section:

    {
      "result": "OK",
      "emails": [
        "Sincere@april.biz",
        "Shanna@melissa.tv",
        "Nathan@yesenia.net",
        "Julianne.OConner@kory.org",
        "Lucio_Hettinger@annie.ca",
        "Karley_Dach@jasper.info",
        "Telly.Hoeger@billy.biz",
        "Sherwood@rosamond.me",
        "Chaim_McDermott@dana.io",
        "Rey.Padberg@karina.biz"
      ]
    }
    

What's next