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()

In runner configs, use platform: ios; the runner calls the iOS SDK create path under the hood.

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.4.tar.gz (71.9 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.4-py3-none-any.whl (33.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: use_computer-0.0.4.tar.gz
  • Upload date:
  • Size: 71.9 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.4.tar.gz
Algorithm Hash digest
SHA256 8e7b3538e7f75d5e100ea6b203b66b39f0911d7cd11a3cb38fe9e4cbfe4f2a18
MD5 f9f2f4a42baba5112161edc009b71f5a
BLAKE2b-256 6ca11c2ea8bce7433e3b177824f77bbec025a90106d9176160bf6b9d49933e7c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: use_computer-0.0.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 1cf88f8e143fb35a1d6f9aca5fcc1eed57cff720b37ad928c5893dcc5dac07b0
MD5 c79ad3a1432b624f8e937abafdc9c5a9
BLAKE2b-256 9978601c23464f86f23e27416db56d1234f2dca053b32f65431664c8400b4b60

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