Building Technical Ops Automation Flows with GenAI

Objective

After completing this lesson, you will be able to build Technical Ops automation flows using Generative AI

GenAI in SAP Automation Pilot

As you explored in the previous lessons, SAP Automation Pilot is a low-code/no-code tool that simplifies DevOps operations by automating tasks like handling your application, troubleshooting, and orchestration.

However, building a custom automaton flow could be challenging for new users. Generative AI Command Generation addresses this by using simple prompts to create complete automation flows directly in SAP Automation Pilot. In this lesson, you will learn how to enable the feature, crafting prompts, generating commands, and executing them for immediate impact.

Start exploring its full potential now!

What GenAI in SAP Automation Pilot does

GenAI features have been introduced in SAP Automation Pilot to improve customers’ onboarding and boost Dev(Ops) Teams efficiency. The solution itself is to make GenAI (via SAP AI Core) available to customers via a simple prompt so that it:

  • Generates fully working DevOps automation flows for customers’ SAP landscapes that can be implemented immediately;
  • Enhances the variety and the quality of commands by fully utilizing coding knowledge (bash, python, etc.) of the model;
  • Extends the ops use cases even further as the knowledge of different public APIs (e.g., SAP BTP, GitHub, Jira, Dynatrace, etc.) is also fully utilized.

Find below a quick overview of the flow of how SAP Automation Pilot users can generate fully working Ops commands:

overview of the flow of how SAP Automation Pilot users can generate fully working Ops commands

Business Scenario

As you may know, the Rotating Banana team has developed a cloud application deployed on SAP BTP within the Cloud Foundry environment. To ensure the application operates smoothly, the Operations team needs to validate its functionality and recover it when necessary.

As an administrator at Rotating Banana, your task is to create a recovery command that:

  1. Checks the app’s API to confirm it is running correctly.
  2. Restarts the app if an issue is detected.
  3. Automatically generates a diagnostic ticket in a ticketing system (such as Atlassian Jira).

Note

Although this example uses Jira, the process applies to any ticketing system.

The steps from the Ops flow are also visualized as per the diagram below:

Ops Flow Steps

The goal is a fully functional, no-code operational workflow generated instantly from a single prompt. This outcome demonstrates how GenAI streamlines complex DevOps processes, making them more efficient and user-friendly.

Design your Ops Automation Flow with GenAI and Run it

Enable Content Generation Assistant in SAP Automation Pilot

Enable Content Generation Assistant in your SAP Automation Pilot instance to benefit from this feature (by default, this feature is not enabled.

To do so, you must have the GenAI role in your subaccount. For more information, see Permissions and Roles in the SAP Help Portal.

Follow the steps below to enable or disable the AI-based generation of commands, executors, inputs, and scheduled executions.

  1. From the sidebar navigation, choose Terms and Conditions.Terms & Conditions
  2. Enable the Content Generation Assistant by switching on the toggle button.Toggle on the Content Generation Assistant
  3. Read and understand the terms and conditions for using the AI-based feature. Select the ‘I have read and understood the terms and conditions’ checkbox at the bottom of the pop-up to provide your consent.
  4. Choose "Accept".Accept the Terms

With this, the Content Generation Assistant is enabled, and you can generate AI-based commands.

Terms& Conditions for Generative AI

Prepare your Prompt

Since you have already enabled the Content Generation Assistant, let’s proceed to the next step: drafting your prompt.

All that is needed from the user is to prepare a prompt describing the scope of the desired automation flow. The entire ops automation flow is designed, and it will be delivered to you quickly and without code by the SAP Automation Pilot GenAI feature.

Business Scenario

For the automation required at Rotating Banana, the team came up with the following prompt:

I want a command that:

  • Sends an HTTP request to a specified URL from the input key "appUrl" to verify the status of my application
  • If the response body contains DOWN, restart the Cloud Foundry application using input keys prefixed with "app."
  • Lastly, if the response body contains DOWN, it creates a Jira issue using input keys prefixed with "jira". Inputs for Jira server, user, and passwords will be provided as input keys. The project must be "CLMTEST" and the type "Bug" (replace CLMTEST with a valid input depending on your actual Jira project where the ticket shall be created). Do not add any labels and components. Within the Jira issue description, add only details about the output from the HTTP request, output the application status if the HTTP request response is DOWN - 'DOWN'; otherwise - 'UP'.

Generate the Ops Automation Flow

After you draft a prompt, see the GenAI feature in action.

process to generate the Ops Automation Flow

As you notice, using the Content Generation Assistant is simple. All you need to do is:

  1. Navigate to the "Commands" section and click the "Generate" button. Generate button
  2. Choose in which catalog your ops automation command shall be stored and add a command name.
  3. Provide your input in a simple user's prompt describing the ops command you want generated.type your prompt
  4. Click on the "Generate" button, and SAP Automation Pilot will generate the ops automation flow described, comprising all required activities.

Note

The ops automation flow generated by the Content Generation Assistant is ready to be tested and used. As you notice in the following screenshot, the generated command contains the necessary input keys and executors.
necessary input keys and executors

Caution

As part of the generated automation flow, the Content Generation Assistant automatically maps the input keys to the command executors in your workflow. However, you must manually define the required inputs and their corresponding values in the Inputs section of SAP Automation Pilot before executing the command.

Once the inputs are created, reference them when running the command. For detailed guidance, consult the Managing Inputs documentation.

Business Scenario

For the automated command from Rotating Banana, the following inputs are required:

Inputs collection for Cloud Foundry app (needed to interact with the app itself):

Inputs collection for Cloud Foundry app

Inputs collection for the Jira app (needed to interact with the Jira ticket system):

Inputs collection for the Jira app

Executing the Ops Automation Flow

With the command generated and the required inputs created, it’s time to execute the automation flow and review the outputs.

1. Run the command.

Navigate to the command and trigger it, ensuring the input collections you created are appropriately referenced (see the following example).

Run the command

2. Monitor its execution.

After execution, access the Execution Overview page for more insights.

Monitor its execution

Business Scenario

The Rotating Banana team has successfully triggered the execution of the required command. To check out the created Jira issue, the team can find the Jira ID of the created issue in the command Output by clicking on the "Show" link:

Show the Jira ID

Remember that in their prompt, the team specified that a Jira ticket should be created only if the application API response returns "DOWN". This is why, as the app is up and running correctly, no Jira ticket has been created (see the following example):

No Jira ticket

Therefore, the team reruns the command after simulating the app's "DOWN" response. Now, they can observe the RestartApp executor's behavior – where it restarts the app as a remediation action as designed within the command itself:

Condition

Condition logic within the command (designed within the "RestartApp" executor) that Content Generation Assistant has modeled

Command execution page – “RestartApp” executor being triggered

Command execution page – "RestartApp" executor being triggered

After the execution of the command was completed, the team could verify that the expected remediation action was performed and the app had been restarted successfully:

Verify performed action

The team can now consult the command output again to find the Jira ticket ID or the issue that has been created:

Find Jira ticket

The team navigates to the created Jira ticket and checks that it contains all the required information about the outcome:

Check the info in the Jira ticket

Hint

Ops flows, such as the one that detects issues with your app from the example, can be scheduled to be run periodically. For this, see Scheduled Execution.

Enhance Available Ops Automation Flows with GenAI

You can also leverage the GenAI Assistant to enrich existing commands.

Business Scenario

The Rotating Banana team would like to enhance their previously created command by capturing more details in the Jira ticket. For this, they want to use the GenAI Assistant to design an additional executor to add technical insights as comments.

To achieve this:

  1. Access the Command Executors configuration section and click Generate.Generate Command executors
  2. Provide a prompt for the GenAI to process.Type your prompt

    Hint

    See the prompt from the preceding screenshot as text:

    If the response body contains DOWN, add an initial comment to the Jira issue with information about the Cloud Foundry application name, app region, and app subaccount or which the check was executed. Inputs for the Jira server, user, and passwords are provided as input keys with the prefix "jira".

  3. Review the newly generated executor, which has been placed within your automation flow and mapped to the relevant input keys.review the new executor
  4. Re-trigger the command and inspect the updated behavior.

Business Scenario

After enhancing the command and re-running it, the Rotating Banana team inspects the newly created Jira ticket:

Inspect the new jira ticket

This enhancement automatically captures in-depth technical information about the application, providing precise context and actionable data within the Jira ticket. These additional insights streamline the troubleshooting process by facilitating accurate application identification and expediting root cause analysis – reducing the overall ops efforts for the Rotating Banana team.

Summary

Within the current lesson, you have learned how to use GenAI of SAP Automation Pilot to get the following benefits:

  • Accelerated onboarding to technical ops automation:simplifies the process of automating ops tasks by enabling users to create and utilize operational commands with less effort quickly
  • Enhanced use cases: extending the scope of your ops automation by leveraging GenAI's understanding of programming languages and public APIs, making complex workflows more accessible and efficient

Log in to track your progress & complete quizzes