Skip to main content

Prava Python SDK for computer-use automation

Project description

Prava SDK

Prava is an API for Labor. Our computer-use agents handle the skilled digital work you'd normally outsource to a team.

Installation

pip install prava  # or: npm install prava

Quick Start

from prava import ControlClient

client = ControlClient()

response = client.predict({
    "model": "prava-af-medium",
    "instruction": "Click the submit button",
    "image_url": "data:image/png;base64,..."
})

action = response["action"]
# {"kind": "left_click", "coordinate": {"x": 245, "y": 67}}

How It Works

We tell you what actions to execute, then you execute them, take a screenshot, then we tell you what to execute next. The loop keeps going until we stop.

Models

Model Use Case
prava-af-medium General automation
prava-quick-click Simple clicking

Action Types

Action Example
left_click {"kind": "left_click", "coordinate": {"x": 245, "y": 67}}
type {"kind": "type", "text": "hello@example.com"}
key {"kind": "key", "keys": ["Enter"]}
scroll {"kind": "scroll", "delta_y": -100}
wait {"kind": "wait", "duration_ms": 1000}
stop {"kind": "stop"}

Playwright Example

from playwright.sync_api import sync_playwright
from prava import ControlClient

client = ControlClient()

with sync_playwright() as p:
    browser = p.chromium.launch()
    page = browser.new_page()
    page.goto("https://www.google.com")

    previous_actions = []

    for step in range(5):
        screenshot = page.screenshot()
        image_url = client.screenshot_to_data_uri(screenshot)

        response = client.predict({
            "model": "prava-af-medium",
            "instruction": "Search for 'Prava AI'",
            "image_url": image_url,
            "previous_actions": previous_actions
        })

        action = response["action"]
        if action["kind"] == "stop":
            break

        if action["kind"] == "left_click":
            coord = action["coordinate"]
            page.mouse.click(coord["x"], coord["y"])
        elif action["kind"] == "type":
            page.keyboard.type(action["text"])

        previous_actions.append(action)

    browser.close()

PyAutoGUI Example

import pyautogui
from prava import ControlClient

client = ControlClient()

# Take desktop screenshot
screenshot = pyautogui.screenshot()
import io
img_bytes = io.BytesIO()
screenshot.save(img_bytes, format='PNG')
image_url = client.screenshot_to_data_uri(img_bytes.getvalue())

# Get action
response = client.predict({
    "model": "prava-af-medium",
    "instruction": "Open the calculator app",
    "image_url": image_url
})

# Execute action
action = response["action"]
if action["kind"] == "left_click":
    coord = action["coordinate"]
    pyautogui.click(coord["x"], coord["y"])

TypeScript

import { ControlClient } from 'prava';
import { chromium } from 'playwright';

const client = new ControlClient();

const browser = await chromium.launch();
const page = await browser.newPage();
await page.goto('https://www.google.com');

const screenshot = await page.screenshot();
const imageUrl = client.screenshotToDataUri(new Uint8Array(screenshot));

const response = await client.predict({
  model: 'prava-af-medium',
  instruction: 'Search for "Prava AI"',
  image_url: imageUrl
});

const action = response.action;
if (action?.kind === 'left_click' && action.coordinate) {
  await page.mouse.click(action.coordinate.x, action.coordinate.y);
}

await browser.close();

API Keys

from prava import ControlClient

# Pass API key directly
client = ControlClient(api_key="prava_sk_...")

# Or use environment variable
import os
os.environ["PRAVA_API_KEY"] = "prava_sk_..."
client = ControlClient()

Examples

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

prava-0.1.27.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

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

prava-0.1.27-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file prava-0.1.27.tar.gz.

File metadata

  • Download URL: prava-0.1.27.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for prava-0.1.27.tar.gz
Algorithm Hash digest
SHA256 741837f98c981e58ae41eabdf62ef17887b754c515bc5882e9c243c2a440f7b5
MD5 0af178f959a7c30342785d3c7b5e8209
BLAKE2b-256 72b76c8e7e4de11ae3c1469f4b6d9cb569e4bb167333d63a6202d891dff56449

See more details on using hashes here.

File details

Details for the file prava-0.1.27-py3-none-any.whl.

File metadata

  • Download URL: prava-0.1.27-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for prava-0.1.27-py3-none-any.whl
Algorithm Hash digest
SHA256 f8721d95ff4d1a94968b20638277158cefe4b55e75927344d43a64af916ec348
MD5 1208c0b9ffa2549ed3a1f05d1c10df5b
BLAKE2b-256 e1687b973d2a44cad1f3cb71a8b385be95f5d57957ba95ee5c4b70df00f00319

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