Skip to content

assertWithAI ​

Use AI to verify complex UI states with natural language assertions.

Experimental, needs an AI CLI

This command uses an AI model, so it needs an AI CLI configured in Settings → AI. See the AI assistant. The AI can answer differently between runs.

The assertWithAI command checks the screen against a natural language assertion. Astra Scout captures the screen and its element list, sends them with your assertion to the AI provider you chose, and gets back a true or false answer with a reason.

Use it when an element-based assertion such as assertVisible cannot express the check, for example a visual pattern or a two-factor authentication prompt.

Syntax ​

yaml
- assertWithAI: "The screen has a Sign in button"

You can also use the expanded syntax:

yaml
- assertWithAI:
    assertion: A two-factor authentication prompt, with space for 6 digits, is visible.
    optional: false

Parameters ​

ParameterTypeDescription
assertionstringRequired. The natural language description of the expected screen state.
optionalbooleanOptional. When true, a failed assertion is shown in red but the flow continues. Default true.
timeoutnumberOptional. Maximum time to wait for the AI, in milliseconds. Default 60000.

TIP

Like Maestro, optional is true by default so that an unstable AI answer does not break a run. Set optional: false to stop the flow when the assertion is false.

How Astra Scout runs it ​

  • The step sends one AI request with the screenshot (when the provider accepts images) and the list of UI elements. It costs one model call.
  • Choose the provider and model in Settings → AI → AI commands in flows.
  • The result panel of the step records the verdict, the assertion, the raw answer, the model and the screenshot path.
  • If the AI reports a confidence below 0.6, the verdict of the run is Unsure, not Passed.
  • Text on the screen is sent as untrusted data. The prompt tells the AI to ignore any instruction the screen shows.
  • After a step types a secret (for example inputText: ${PASSWORD}), later AI steps send no screenshot until the app is reopened. See No screenshots after typing a secret.