Skip to main content

A cross-platform UI automation adapter for AI Agents.

Project description

# 👁️ PyA11y (Python Accessibility Adapter)

**A cross-platform UI automation library designed for AI Agents.**

PyA11y bridges the gap between AI models (like GPT-4, Claude) and operating system UIs. Instead of relying on fragile coordinate-based clicks or expensive screenshot analysis, PyA11y hooks directly into the OS Accessibility API to generate a semantic, lightweight JSON representation of the screen.

> **Current Status:**
> * ✅ **Windows:** Fully supported (via UIAutomation)
> * 🚧 **Linux:** In Development (planned X11/Atspi support)
> * 📅 **macOS:** Planned

## 🚀 Installation

```bash
pip install pya11y

⚡ Quick Start

PyA11y separates the "Driver" (the OS interface) from your logic. Here is how to snapshot the current window:

import time
from pya11y import get_ui_driver, ScanConfig

# 1. Configure the scanner
# Scan 10 levels deep, ignore clutter like ScrollBars
config = ScanConfig(max_depth=10)

# 2. Get the driver for your OS
driver = get_ui_driver(config)

print("Switch to your target app in 3 seconds...")
time.sleep(3)

# 3. Capture the semantic tree
ui_data = driver.capture()

# 4. Use the data
print(f"Captured Window: {ui_data['name']}")

if 'children' in ui_data and len(ui_data['children']) > 0:
    first_child = ui_data['children'][0]
    print(f"First Element: {first_child['name']}")
    print(f"Coordinates: {first_child['bbox']}")

🧠 Why PyA11y?

Most automation tools (like PyAutoGUI) are "blind"—they just click X,Y coordinates. If a window moves, they fail.

PyA11y provides Context:

  1. Semantic Tree: It tells you "There is a 'Submit' button at [200, 400]".
  2. Token Efficient: Outputs clean JSON, not heavy screenshots.
  3. Resilient: If the window moves, the underlying tree updates automatically.

🔧 Configuration

You can fine-tune the scanner to save tokens or get more detail:

config = ScanConfig(
    max_depth=12,              # How deep to scan nested elements
    include_offscreen=False,   # Ignore hidden elements to save space
    require_text=True          # Ignore elements with no labels
)

🤝 Contributing

We are actively looking for contributors to help build the Linux and macOS adapters!

  1. Fork the repo
  2. Create your feature branch (git checkout -b feature/linux-adapter)
  3. Submit a Pull Request

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py_a11y_ui-0.1.0.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

py_a11y_ui-0.1.0-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file py_a11y_ui-0.1.0.tar.gz.

File metadata

  • Download URL: py_a11y_ui-0.1.0.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for py_a11y_ui-0.1.0.tar.gz
Algorithm Hash digest
SHA256 56c92bc6ee342f46477196ecbc9eea0c08b591b78c6d5db22fffe4a6d056f04f
MD5 bc41f75bd225584ed3242c1b1f768f12
BLAKE2b-256 d7f25438c4c8018aa33ba916fe976b3d11e254efb5c561148901cce3bdf25936

See more details on using hashes here.

File details

Details for the file py_a11y_ui-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: py_a11y_ui-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for py_a11y_ui-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8193a2c8250b513dc21bf963574864b8f9d7014c073cb88b1064ff1b7b573d41
MD5 c8c7b59485c5f6d84932e102ed93d78c
BLAKE2b-256 ce00036caa90788b68224a2db44c59979902ac41e2eb2de40b028a1b2730a031

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page