In this quickstart tutorial, we will guide you through your first automation on a web calculator. We will calculate 7 + 7 and then extract the calculation result in a variable. Please make sure you followed through the Installation Guide prior to this.

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:

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 calculator.py and add the following code:

from askui import VisionAgent

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?")
    print(f"The result is: {result}")

Run the script:

python calculator.py
5

(Optional) Enable Detailed Logging

To better understand what your agent is doing, enable debug logging and reporting:

import logging
from askui import VisionAgent

with VisionAgent(log_level=logging.DEBUG, enable_report=True) as agent:
    # Your automation code here
6

(Optional) Run in CI/CD Pipeline

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: |
          pip install askui
      - name: Run automation
        env:
          ASKUI_WORKSPACE_ID: ${{ secrets.ASKUI_WORKSPACE_ID }}
          ASKUI_TOKEN: ${{ secrets.ASKUI_TOKEN }}
        run: python calculator.py

You can also find more examples in our Community.