In this quickstart tutorial, we’ll guide you through creating your first automation with AskUI. We’ll create a simple script that searches for a product on Amazon and adds it to the cart.

1

Install AskUI Agent OS

First, download and install the AskUI Agent OS for your operating system:

2

Install Python Package

Install the AskUI Python package using pip:

pip install askui

Note: Requires Python version >=3.10.

3

Set Up Authentication

Set up authentication with your chosen AI model provider:

4

Create Your First Automation

Create a new Python file amazon_shopping.py and add the following code:

from askui import VisionAgent
import logging
from askui import locators as loc
from askui.reporting import SimpleHtmlReporter

# Initialize your agent with logging and reporting
with VisionAgent(
    log_level=logging.DEBUG,
    reporters=[SimpleHtmlReporter()]
) as agent:
    # Open Amazon website
    agent.tools.webbrowser.open_new("http://www.amazon.com")
    agent.wait(3)  # Wait for page to load

    # Search for a product
    agent.click(loc.Element("textfield"))
    agent.type("nike shoes")
    agent.keyboard('enter')
    agent.wait(2)  # Wait for search results

    # Verify page contents
    page_status = agent.get("Are Nike shoes visible on the screen?")
    print(f"Cart Status: {page_status}")

Run the script:

python amazon_shopping.py

The script will:

  1. Open Amazon in your default browser
  2. Search for “nike shoes”
  3. Verify the cart contents
  4. Generate an HTML report of the automation
5

Understanding the Code

Let’s break down the key components:

  1. Agent Initialization

    with VisionAgent(log_level=logging.DEBUG, reporters=[SimpleHtmlReporter()]) as agent:
    
    • Creates a new agent with debug logging
    • Enables HTML reporting for better visibility
  2. Basic Interactions

    agent.click(loc.Element("textfield"))
    agent.type("nike shoes")
    agent.keyboard('enter')
    
    • Uses natural language to find elements
    • Performs basic keyboard and mouse actions
  3. Information Extraction

     # Verify page contents
        page_status = agent.get("Are Nike shoes visible on the screen?")
        print(f"Cart Status: {page_status}")
    
    • Retrieves information from the UI
    • Uses natural language queries
6

Running in CI/CD

You can run your automations in any CI/CD pipeline. Here’s an example for GitHub Actions:

name: AskUI Automation
on: [push]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Set up Python
        uses: actions/setup-python@v2
        with:
          python-version: '3.10'
      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          pip install askui
      - name: Run automation
        env:
          ASKUI_WORKSPACE_ID: ${{ secrets.ASKUI_WORKSPACE_ID }}
          ASKUI_TOKEN: ${{ secrets.ASKUI_TOKEN }}
        run: python amazon_shopping.py

Next Steps