Skip to main content

Python SDK for the use.computer macOS and iOS Computer Use API

Project description

use-computer Python SDK

Python client for use.computer macOS and iOS sandboxes.

pip install use-computer
export USE_COMPUTER_API_KEY=mk_live_...
from use_computer import Computer

computer = Computer()
sandbox = computer.create()  # macOS

try:
    png = sandbox.screenshot.take_full_screen()
    sandbox.mouse.click(500, 400)
    sandbox.keyboard.type("hello")
    sandbox.exec_ssh("open -a TextEdit")
finally:
    sandbox.close()
    computer.close()

iOS

from use_computer import Computer

computer = Computer()
ios = computer.create(type="ios")
try:
    ios.apps.open_url("https://example.com")
    ios.input.tap(200, 300)
    ios.input.type_text("hello")
    ios.environment.set_appearance("dark")
finally:
    ios.close()
    computer.close()

Action DSL

Actions are dotted method calls plus args/kwargs. They are useful when a model emits tool-like steps. Given an open macOS sandbox:

from use_computer import Action, parse_pyautogui, parse_xdotool

actions = [
    Action("mouse.move", [500, 400]),
    Action("mouse.click", [500, 400]),
    Action("keyboard.hotkey", ["command+space"]),
    Action("keyboard.type", ["Safari"]),
    Action("screenshot.take_full_screen"),
]

for action in actions:
    action.execute(sandbox)

for action in parse_pyautogui("pyautogui.click(100, 200); pyautogui.write('hi')"):
    action.execute(sandbox)

for action in parse_xdotool("xdotool mousemove 100 200 click 1 type hello"):
    action.execute(sandbox)

Common macOS targets: mouse.*, keyboard.*, screenshot.*, display.*, recording.*.

Common iOS targets: input.*, apps.*, environment.*, screenshot.*, recording.*.

Docs: https://api.use.computer/docs

OpenAPI: https://api.use.computer/openapi.yaml

Runner: https://github.com/josancamon19/mmini-runner

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

use_computer-0.0.3.tar.gz (71.8 kB view details)

Uploaded Source

Built Distribution

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

use_computer-0.0.3-py3-none-any.whl (33.0 kB view details)

Uploaded Python 3

File details

Details for the file use_computer-0.0.3.tar.gz.

File metadata

  • Download URL: use_computer-0.0.3.tar.gz
  • Upload date:
  • Size: 71.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for use_computer-0.0.3.tar.gz
Algorithm Hash digest
SHA256 dfb326bdaeb5803208f58de974578913e1b30a66db4fe7cf736cf0501ffd8b6b
MD5 bfd231fc757e6be6a81080c1694bcf9a
BLAKE2b-256 9f4fb245748308f1dfa55b23ad7e13a03fc712831a5c2f5390f52dddb58fb8c4

See more details on using hashes here.

File details

Details for the file use_computer-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: use_computer-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 33.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for use_computer-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 ee968b48bea5ae96cdf30d8894f5ad164b1bd0ad1cdcf9b4e9ad7bc79e27bbe8
MD5 d2d9c4d85ee683444f71bc0827cd4185
BLAKE2b-256 30f0429cdbc361b1c616a34ae0edaf4fdb403eeeae7d08175b0372673fbb6fd0

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