Skip to main content

allternit-computer-driver

Drive an Allternit hosted computer (/v1/computers) from Claude, OpenAI computer use, or Gemini computer use. Standard library only; pip install allternit-computer-driver[anthropic] adds the Anthropic SDK. Needs a project key with the computers scope and the hosted driver turned on for the project.

from allternit_computer_driver import AllternitComputers
client = AllternitComputers()  # reads ALLTERNIT_API_KEY
computer = client.create(name="agent-1")

Structured UI driving (allternit.computer.v2)

Contract v2 adds ten driver-backed structured members — read_ui, act, run_batch, verify, request_human, use_credential, run_subtask, run_parallel, run_skill, skills — typed end to end. ComputerV2Driver calls them directly; every adapter also exposes them to the model as the computer_v2 function tool. The structured members need the Allternit Driver on the computer (this-device today).

from allternit_computer_driver import ComputerV2Driver

v2 = ComputerV2Driver(client, computer["id"], on_approval=lambda a: ask_a_person(a))

# Read the UI as an element tree — no screenshots.
ui = v2.read_ui({"app": "Safari"})
field = next((e for e in ui.get("elements", []) if e.get("role") == "textfield"), None)
if field:
    v2.act({"id": field["id"], "op": "set_value", "value": "hello@example.com", "version": ui["version"]})

# Hand a bounded step sequence to the fast decision loop instead of clicking through it yourself.
sub = v2.run_subtask({
    "goal": "Fill the signup form and submit it",
    "inputs": [{"name": "email", "value": "hello@example.com"}],
    "success": [{"role": "button", "name": "Submit"}],
})
if sub["status"] != "done":
    print(sub["status"], sub.get("next"))

Subtask safety statuses

run_subtask / run_skill / run_parallel results end with a status:

  • done — the goal is met.
  • escalated — handed back with a reason and the current screen; continue from there yourself.
  • needs_confirmation — the next step (held_step) needs the person's confirmation; run it yourself with act/run_batch and the server asks them.
  • paused — the safety monitor paused the subtask; stop and call request_human.
  • denied — the step isn't allowed on this computer (app/domain lists or a credential binding); find another way.
  • use_api — make the named API/MCP call yourself (api["tool"]); the screen is untouched.
  • failed — ran out of steps, budget or a hard error.

The computer_v2 function tool in a model loop

Each adapter exposes the structured members with the same steering guidance gizzi sends:

from allternit_computer_driver.anthropic import ComputerV2Tool  # to_dict()/tool_result(tool_use)
from allternit_computer_driver import (
    openai_computer_v2_tool, run_openai_v2_call,
    gemini_computer_v2_declaration, run_gemini_v2_call,
    computer_v2_tool,
)

# Anthropic: put ComputerV2Tool(client, computer_id).to_dict() next to the toolset in tools.
# OpenAI: put openai_computer_v2_tool() in tools; answer function_call items with
# run_openai_v2_call(client, computer_id, call.call_id, json.loads(call.arguments)).
# Gemini: put gemini_computer_v2_declaration() in function_declarations; answer
# functionCall parts with run_gemini_v2_call(client, computer_id, part.function_call.name, dict(part.function_call.args)).

computer_v2_tool() returns the provider-neutral {"name", "description", "schema"} dict if you wire tools yourself.

Claude

from allternit_computer_driver.anthropic import AllternitComputerToolset, ComputerV2Tool
toolset = AllternitComputerToolset(client, computer["id"], on_approval=lambda approval: ask_a_person(approval))
v2_tool = ComputerV2Tool(client, computer["id"], on_approval=lambda approval: ask_a_person(approval))
# tools=[toolset.to_dict(), v2_tool.to_dict()]  (the toolset subclasses the SDK's abstract toolsets when present)

Each member runs on the server through POST /v1/computers/{id}/toolset. A 409 approval_required calls on_approval: True approves it and resends with the grant, False returns the held result to the model as an error. When the installed anthropic package has anthropic.tools.computer / anthropic.tools.browser, these classes subclass its abstract toolsets. Older releases get a small stand-in with to_dict() and tool_result(tool_use) for a hand-written loop.

OpenAI computer use

from allternit_computer_driver import run_openai_action
step = run_openai_action(client, computer_id, call.call_id, call.action.model_dump(), display={"width": 1280, "height": 800})
next_input.append(step["output"])

Gemini computer use

from allternit_computer_driver import run_gemini_call
step = run_gemini_call(client, computer_id, fc.name, dict(fc.args))
# step["function_response"] and step["inline_data"] (0-999 coords sent as normalized_1000)

The OpenAI and Gemini pixel adapters raise ApprovalRequiredError; call client.approve() and resend.

Errors

  • ApprovalRequiredError — 409 approval_required; carries approval (id, member, approve_url) and the held result. client.toolset_with_approval(computer_id, call, on_approval) approves and resends with the approval_grant for you.
  • ComputerV2Error — a structured member answered is_error: True; carries the member name and raw result.
  • ComputerBusyError — 423 computer_busy / computer_controlled_elsewhere.
  • SandboxRequiredError — 409 sandbox_required (the call needs a sandbox computer).
  • ComputerConflictError — 409 computer_conflict (another subtask or lease conflicts).
  • AllternitApiError — everything else, with status, code and type.

Metadata

Release files for allternit-computer-driver 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for allternit-computer-driver 0.3.1
File Size Uploaded Provenance Actions
allternit_computer_driver-0.3.1.tar.gz 27.1 kB With provenance Details for allternit_computer_driver-0.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for allternit-computer-driver 0.3.1
File Interpreter ABI Platform Actions
allternit_computer_driver-0.3.1-py3-none-any.whl Python 3 none any Details for allternit_computer_driver-0.3.1-py3-none-any.whl

Total release size: 56.0 kB

Release files / allternit_computer_driver-0.3.1.tar.gz

Download URL allternit_computer_driver-0.3.1.tar.gz
Size 27.1 kB
Tags Source
SHA-256 checksum
How to use checksums
e30550dde81edbe49457ed94b7d175c5619cf5a40a399f8353531f4b6934f512
BLAKE2b-256 checksum
How to use checksums
b1215a1c9424796b410915dcb8fdddad2e3978c0e58087c30d8325dceaab7abc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.

Transparency log

Release files / allternit_computer_driver-0.3.1-py3-none-any.whl

Download URL allternit_computer_driver-0.3.1-py3-none-any.whl
Size 29.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
98782c45ca4b375da48ff61a2d8cc653b251e5b2810342cddf50f3346d321724
BLAKE2b-256 checksum
How to use checksums
c4a6dcc6fcccd751339677d64a6dba8e1eb6aaf99409cc8ce86ad5858395e29a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.

Transparency log

Security for allternit-computer-driver 0.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for allternit_computer_driver-0.3.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page