Setting Up AskUI in Azure DevOps

Automate your AskUI workflows in Azure DevOps with this comprehensive guide for Python!

1

Project Structure

Create a tests directory in your repository root to store your AskUI Python scripts.

Note: The directory name may vary based on your project organization.

2

Configure Pipeline YAML

Create an azure-pipelines.yml file in your repository root with the following configuration:

trigger:
  - main

pool:
  vmImage: 'ubuntu-latest'

steps:
- task: UsePythonVersion@0
  inputs:
    versionSpec: '3.10'
    addToPath: true
  displayName: 'Set up Python 3.10'

- script: |
    python -m pip install --upgrade pip
    pip install askui pytest pytest-html
  displayName: 'Install dependencies'
3

Configure Environment Variables

Add the following required variables to your pipeline:

variables:
  ASKUI_WORKSPACE_ID: $(ASKUI_WORKSPACE_ID)
  ASKUI_TOKEN: $(ASKUI_TOKEN)

For AI model integration:

variables:
  ANTHROPIC_API_KEY: $(ANTHROPIC_API_KEY)  # Required if using Anthropic models

Note: Set these variables in your Azure DevOps pipeline settings.

4

Set Up AskUI Agent OS

Add the following to your pipeline YAML to set up the AskUI Agent OS:

- script: |
    curl -L -o /tmp/AskUI-Suite-Latest-User-Installer-Linux-x64-Full.run https://files.askui.com/releases/Installer/Latest/AskUI-Suite-Latest-User-Installer-Linux-x64-Full.run
    bash /tmp/AskUI-Suite-Latest-User-Installer-Linux-x64-Full.run --unattended
  displayName: 'Install AskUI Agent OS'
5

Run Tests

Execute your AskUI Python scripts:

- script: |
    python -m pytest tests/ --html=report.html --self-contained-html
  displayName: 'Run AskUI tests'
  env:
    ASKUI_WORKSPACE_ID: $(ASKUI_WORKSPACE_ID)
    ASKUI_TOKEN: $(ASKUI_TOKEN)
    ANTHROPIC_API_KEY: $(ANTHROPIC_API_KEY)
6

Publish Test Results

Publish the test results:

- task: PublishTestResults@2
  inputs:
    testResultsFormat: 'JUnit'
    testResultsFiles: '**/test-*.xml'
    mergeTestResults: true
    testRunTitle: 'AskUI Tests'
  condition: succeededOrFailed()
  displayName: 'Publish test results'

- task: PublishPipelineArtifact@1
  inputs:
    targetPath: 'report.html'
    artifact: 'TestReport'
    publishLocation: 'pipeline'
  condition: succeededOrFailed()
  displayName: 'Publish HTML report'

Example Python Script

Here’s a sample Python script to use in your tests directory:

from askui import VisionAgent

def test_calculator():
    with VisionAgent() as agent:
        # Open Chrome and navigate to calculator
        agent.tools.webbrowser.open_new("https://askui.github.io/askui-practice-page/")

        # Click numbers and operators
        agent.click("7")
        agent.click("+")
        agent.click("7")
        agent.click("=")

        # Extract the result
        result = agent.get("What is the calculation result?")
        assert result == "14"

Complete Example