ai action.md

AI Action

Use the AI action block to describe, in natural language, what should happen in your flow and let Leapwork use AI to decide how to carry it out. The block takes a prompt, identifies the right element on the application to interact with and how, executes that interaction, and can reuse what it has learned to make later runs faster.

You typically use the AI action block when you want to express actions or decisions as text instead of building them from multiple low‑level UI or logic blocks.

When to use

Use the AI action block when you need to:

If you only need simple, fully deterministic steps based on fixed selectors or rules, use the standard UI and logic blocks instead of the AI action block.

Location

You can find the AI action block in the AI section of the building blocks panel.

Open Add building block, expand AI, and select AI to add the AI action block to your flow. In the same AI category you can also see other AI‑related blocks, such as AI Extract, AI Generate, AI Transform, AI Validate, AI Vision Extract, and AI Vision Validate.

Drag the AI action block onto the canvas and connect it to the rest of your flow.

Inputs

The AI action block takes input from your flow and sends it to the AI system that decides which element to interact with and how to perform the requested action.

Prompt

The Prompt defines what you want the AI to do. It is the main instruction and can include:

Examples:

The block resolves all input connectors before sending the final prompt to the AI system.

Context data

Context data is optional additional data sent along with the prompt. Use context when:

You can pass context from:

This helps the AI make better decisions without overloading the main prompt.

Other configuration

Depending on how AI is set up for your environment, the block may expose settings that control which underlying AI capability is used and how the request is sent. These settings are configured for your Leapwork installation and are not defined in LWW‑12858 or PPQ‑921.

Outputs

When the AI‑driven interaction completes, the AI action block exposes outputs that you can use in the rest of your flow.

Result

The Result is the main outcome of the AI‑driven step. It can describe, for example:

You can connect the result to:

Status and error information

The block exposes basic status information, such as:

You can use this information for retries, fallbacks, or logging so that failed AI steps are visible and can be handled in the flow.

How it works

When the flow reaches the AI action block, it processes the input and uses AI to decide how to act before passing control on to the next blocks.

  1. The block resolves all incoming connectors and builds the final prompt (and optional context).
  2. The block sends this information to the AI system.
  3. The AI identifies the right element on the application to interact with and how to interact with it.
  4. The block executes the decided interaction on the application.
  5. The block exposes the outcome and any response details as outputs.
  6. On subsequent runs, the block can reuse what it has already learned so that the same interaction executes faster.

The flow waits until the AI step finishes or until a timeout is reached. If the request fails or times out, the block exposes error information that you can use for handling in the flow.

Configuration

To configure an AI action block, you work from top to bottom in the block configuration:

  1. Add the block to your flow and open its configuration.
  2. Enter your Prompt and reference any values from the flow that the AI should consider.
  3. (Optional) Add Context inputs for additional information that should be available to the AI.
  4. Review any available AI‑related settings that are exposed in your environment (for example, which capability or connection to use).
  5. Decide which outputs from the block you want to connect to the rest of the flow.
  6. Save the configuration and connect the outputs to the next steps in your flow.

Once configured, you can run the flow and inspect the AI‑driven interaction in the run log to verify that the block behaves as expected.

Examples

Examples help you see typical ways to use the AI action block in real flows.

Example 1: Click the Login button

In this example, the AI action block:

Subsequent runs can reuse what the AI learned about this button so that the click happens faster.

Example 2: Open the first failed row

Here, the AI action block:

Limitations and considerations

The AI action block relies on AI to interpret prompts and choose elements, so results and behaviour can vary. Keep the following in mind:

Design prompts carefully, add only the context that is needed, and build basic error‑handling into your flows to get reliable results from the AI action block.