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

Examples: https://github.com/josancamon19/use-computer-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

use_computer-0.0.5.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.5-py3-none-any.whl (33.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: use_computer-0.0.5.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.5.tar.gz
Algorithm Hash digest
SHA256 56d3fbf62d44625914595f3603fea39b58fb07c2a6d5ae9b574c51d2d60c7e78
MD5 08ca72b6066a80718c274d2998e13d26
BLAKE2b-256 a6df04a6c9849d9c734b01733a0091f06a9beeca6d9b65f9192dd8b726543360

See more details on using hashes here.

File details

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

File metadata

  • Download URL: use_computer-0.0.5-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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 74c599a4c11a1e23edb502e701367a16a0dcd333587d2655b078d346e12adcc1
MD5 d3a6479265f49dc77ecb50d57cdba329
BLAKE2b-256 4966f6988b7b0368cd14e95b5771e4916c07305a57c0dc6247f01d58ddf7869b

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