Skip to main content

Verify for Python

Cloud browsers, mobile devices and computers from Python.

Verify is a thin Revyl SDK, not a test runner. Open a web browser, iOS simulator or Android emulator for natural-language instructions and validations, or an early-access Mac/Linux computer for commands, files, processes and screenshots.

For coding agents

Use Python ≥3.10 and the revyl_verify import. The distribution is named revyl-verify; it is separate from the revyl CLI. Install it from PyPI with pip install revyl-verify or uv add revyl-verify.

Run only explicitly authorized cloud workloads. Keep API keys, signed recording URLs and session links private. Use context managers so errors still trigger cleanup; there is no runner, automatic step replay or creation retry.

Install

pip install revyl-verify
# Or, in a uv project:
uv add revyl-verify

Pillow is the only runtime dependency, for PNG blank-frame inspection; HTTP uses the standard library.

Authenticate

On the first interactive open(), attach() or current_computer() call without credentials, Verify prints a Revyl approval URL and code, opens your browser, and waits for you to approve. It saves the login to ~/.revyl/credentials.json, which the Revyl CLI and the other Verify SDKs share, so later runs start without a prompt. You can also sign in ahead of time with the separately installed Revyl CLI:

revyl auth login

Verify never opens a browser when stdin or stderr is not a terminal or CI is set. Supply REVYL_API_KEY through the process's secret store there; without credentials the call raises AUTH_MISSING.

Credential precedence matches the other SDKs: a usable stored CLI login marked local_auth_override, then REVYL_API_KEY, then another usable CLI login. An expired access token can fall back to its stored API key. Never pass keys in argv, source, screenshots or logs.

Inside a revyl-macos GitHub Actions job

current_computer() and async_current_computer() attach to REVYL_COMPUTER_ID with normal credential resolution, non-owning by default. They never create a computer, raise COMPUTER_ID_MISSING when the ID is unset or blank, and reject invalid IDs with INVALID_ARGUMENT. The job's owner releases the computer; closing the attachment only cleans up hosted children.

Use a release containing these helpers and a runner configured to inject REVYL_COMPUTER_ID and a short-lived REVYL_API_KEY. A workflow can supply its own key instead. With Python ≥3.10 and the project dependencies installed, add this step to a job with runs-on: revyl-macos:

- name: Run Verify
  run: |
    python - <<'PY'
    from revyl_verify import current_computer
    with current_computer() as computer:
        computer.screenshot(path="computer.png")
    PY

Use async with await async_current_computer() as computer in asyncio jobs. Both helpers accept explicit backend_url, app_url, step_timeout, and log options; neither reads URL environment variables. stop_on_close=True explicitly takes ownership and can end the job's computer when closed. Use computer.open(target) with an exact app/build pair for hosted app sessions.

Quick Start

Synchronous iOS Settings

from revyl_verify import Target, open

with open(Target(platform="ios", bundle_id="com.apple.Preferences", start_timeout=600)) as session:
    session.instruction("Open General, then About", timeout=120)
    session.validation("The screen shows the operating system version", timeout=120)
    session.screenshot(path="settings.png")
    report = session.report()

open returns a Session, which is also a context manager. instruction and validation wait for completion; a failed validation raises by default even if HTTP succeeded. Pass soft=True to validation to inspect a failed verdict without raising. Screenshots return PNG bytes and optionally save them to path. report() returns a JSON dictionary: for devices it is the session-details/report metadata from /execution/device-sessions/{id}, not a fabricated report endpoint.

All timeout values are seconds, including start_timeout (default 600), step timeouts and computer command timeouts. Mobile startup includes a bounded best-effort blank-frame observation, not a guarantee that the app has rendered. Begin with an instruction that reaches the screen you need.

Asyncio

import asyncio

from revyl_verify import Target, async_open


async def main() -> None:
    async with await async_open(
        Target(platform="ios", bundle_id="com.apple.Preferences", start_timeout=600)
    ) as session:
        await session.instruction("Open General, then About", timeout=120)
        await session.validation("The screen shows the operating system version", timeout=120)
        await session.screenshot(path="settings.png")


asyncio.run(main())

async_open returns an AsyncSession. Its async methods adapt the synchronous implementation through worker threads, rather than introducing another HTTP stack. Cancelling a method schedules best-effort session close; cancelling open interrupts startup and attempts cleanup as soon as an identity is known. Cancellation does not forcibly terminate an in-flight thread or undo a remote operation; do not replay an uncertain mutation. Always close explicitly or use async with await async_open(...).

Linux computer (early access)

Ask support@revyl.ai about computer access before running:

from revyl_verify import Target, open

with open(Target(platform="linux", start_timeout=600)) as session:
    result = session.exec(["uname", "-a"], timeout=30, check=True)
    session.write_file("message.txt", b"Hello from Verify\n")
    contents = session.read_file("message.txt")
    processes = session.processes()
    session.screenshot(path="linux.png")

recording = session.recording()

exec(argv, stdin=bytes_or_string, timeout=30, check=True) preserves argument boundaries and raises on command failure by default. File and process operations are computer-only. File paths are workspace-relative, not arbitrary absolute guest paths. recording() returns computer recording metadata or None, including after close; it does not wait for or download a recording. Signed URLs in that metadata are credentials. Recording is locally unavailable on devices.

Breaking wire change: computer-operation arguments use argv_b64 (one padded URL-safe base64 UTF-8 string per argument) and file paths use path_b64, with no raw argv or path. This SDK is incompatible with the previous backend contract. Deploy the encoded-only backend before publishing or upgrading to this SDK. Public APIs and decoded limits are unchanged; stdin and file data retain their existing standard base64 encoding, and process commands are unchanged. Encoding is not encryption, and Verify does not fall back to plaintext or replay the request.

Attach and open a hosted browser

Attach to an existing active computer with attach(computer_id), or create one with open(Target(platform="mac")). Attaching checks its identity, operating system and unexpired active report without creating or stopping anything on failure. A successful attach takes close ownership by default: exiting its context stops that computer, not merely the local handle.

from revyl_verify import Target, attach

with attach("aaaaaaaa-bbbb-4ccc-8ddd-eeeeeeeeeeee") as computer:
    with computer.open(
        Target(
            platform="web",
            app_id="11111111-2222-4333-8444-555555555555",
            build_id="66666666-7777-4888-8999-aaaaaaaaaaaa",
        )
    ) as browser:
        browser.navigate("http://localhost:3000")
        browser.validation("The application home page is visible")

Use real IDs from the same authorized environment; these are placeholders. The existing Web build must point to a supported HTTPS source. After startup, navigate(url) sends a single deterministic navigation request and accepts HTTP or HTTPS, including localhost, on every Web session. A cold development server may need a warm-up request before navigation succeeds. For hosted browsers localhost means the hosting computer; for ordinary cloud browsers it means that browser's runtime, not your own computer. If navigation times out uncertainly, it may still commit and the session remains usable; re-navigating is your choice. The server runtime owns navigation network policy. The SDK rejects credentials, control characters and backslashes; it never logs the URL. Navigation is unavailable on mobile and computer sessions and returns None after a confirmed response.

computer.open(target) requires both app_id and build_id UUIDs. Hosted Web accepts viewport, sign_in, idle_timeout_seconds and start_timeout, but no url or branch; the server currently accepts external Web builds, not bundled Web artifacts. Hosted iOS/Android use the selected build and fixed simulator/emulator configuration, so bundle_id, artifact_url, device_model, os_version, url, branch, viewport and sign_in are unavailable. Mac hosts Web/iOS; Linux hosts Android and exposes Web only subject to server capability. Linux-hosted Web is currently unavailable in the runtime. All hosting depends on server capability and capacity.

Children reuse their parent's credentials, API/viewer origins, step timeout and log callback. They return normal sessions with instruction, validation, screenshot, report and close methods. The parent's remaining lifetime bounds child startup and worker requests; report and close remain available after expiry. Closing a parent prevents new children, cancels in-flight starts, and gives pending starts and child closes one shared five-second cleanup budget before attempting the computer stop. Child startup failure never closes the parent. Confirmed physical parent release supersedes an earlier child-close uncertainty, which is logged safely. An ambiguous child start is cleaned up using its preallocated ID, without replaying creation. A definitive refusal does not issue a child stop.

When the computer belongs to another caller, such as a CI runner, use attach(computer_id, stop_on_close=False) or await async_attach(computer_id, stop_on_close=False). These attachments are not registered for automatic cleanup. Explicit close or context-manager exit still cancels pending child starts and closes hosted children within the five-second cleanup phase, but never stops the computer; its owner must release it. Child-cleanup failures remain observable. The default is True, and ownership is never inferred from the environment.

For async code use async with await async_attach(computer_id) as computer, then async with await computer.open(target) as browser and await browser.navigate(url). Cancelling a child open cleans up only that child and leaves the parent open; cancelling attach before it succeeds does not stop the existing computer.

Platforms and cleanup

Targets and methods

Construct a frozen Target(platform=...):

  • Web: app_id (Revyl UUID) is required. Supply url for a public HTTPS site, build_id for a specific build, or branch for the selected app's latest build. build_id cannot be combined with url or branch. Optional Viewport(width, height, device_scale_factor=...) and SignIn(path, secret, persona=...) configure the browser and saved sign-in secret reference, not a raw credential.
  • iOS / Android: provide exactly one of app_id, build_id, HTTPS artifact_url or installed-app bundle_id. Optional device_model and os_version select the device. Do not combine mobile app sources.
  • Mac / Linux: only platform and start_timeout are accepted; app/browser/device fields are unavailable.

start_timeout defaults to 600 seconds (allowed range 10–1800). Web/mobile also accept idle_timeout_seconds (60–3600). open, async_open, attach and async_attach accept default step_timeout in seconds.

Pass log=callback to either opening API for sanitized lifecycle progress, including the viewer link as soon as the session identity is known. The default is quiet. Async callbacks run on a worker thread, so make them thread-safe; callback exceptions do not interrupt resource cleanup. Progress never includes app URLs, command or step content, credentials, recording URLs, or raw server errors. Viewer links and session IDs are still private operational context.

Startup VerifyError instances retain optional typed platform, session_id, workflow_run_id, and viewer_url, plus cleanup_status and cleanup_error. These fields remain available even though opening did not return a session:

from revyl_verify import Target, VerifyError, open

try:
    session = open(Target(platform="linux"), log=lambda line: None)
except VerifyError as error:
    session_id = error.session_id
    viewer_url = error.viewer_url
    cleanup_status = error.cleanup_status
    cleanup_error = error.cleanup_error
else:
    session.close()

Cleanup status is acknowledged for a validated device stop response, confirmed for terminal computer state plus physical release, unconfirmed when cleanup failed or no usable mobile identity was returned, and not_required after a definite create refusal. not_attempted applies before startup ownership exists. An unknown mobile ID is None, never invented. Web/computer caller-generated IDs remain available after an uncertain create; a mismatched web acknowledgment never authorizes stopping the other ID. Startup cleanup uses a fresh bounded deadline, preserves the original failure, and attaches a separate cleanup error. Do not retry creation to recover an uncertain outcome; inspect the known session privately. A device stop acknowledgment does not prove physical release.

Session properties include id, platform, viewer_url, expires_at and closed. Steps return StepResult with passed, reason and duration_seconds; commands return ExecResult with exit_code, stdout and stderr. Computer methods also include stat(path), processes() and terminate(handle_id), with bounded seconds-based timeouts. Errors raise VerifyError with a stable code. Async session methods have the same arguments/results and are awaited.

EDGE_BLOCKED identifies HTTP 403 with a text/html content type and nonempty cf-ray, unless the body is syntactically valid JSON. HTML branding is not required; cf-ray alone is not enough. Other responses retain their existing mapping, including JSON 401/403 authentication errors. Edge-block errors expose http_status but no body or ray ID. Check network access or contact support; Verify does not retry blocked requests.

VerifyError.reason is an optional exported RefusalReason literal containing only a known safe server code; http_status is the response status when available. Raw server messages and payloads are not exposed through these fields. Ordinary Web startup 409 web_runtime_unavailable keeps code="API_ERROR", computer admission keeps COMPUTER_LIMIT for computer_limit and NOT_AVAILABLE_ON_PLATFORM for runtime_unavailable; inspect reason to distinguish availability from other failures. Hosted errors use NOT_AVAILABLE_ON_PLATFORM for runtime/capability refusals, COMPUTER_LIMIT for capacity, SESSION_ENDED for computer_not_running, NOT_FOUND for computer_not_found, INVALID_ARGUMENT for build selection and SESSION_BUSY for child identity conflicts. Unknown reasons remain None; no refusal automatically retries creation.

Platform Instructions / validations Commands / files / processes PNG screenshot
Web Yes, if the backend supports web steps — Yes
iOS simulator / Android emulator Yes — Yes
Mac / Linux computer — Yes Yes

Mac and Linux are early access; ask support@revyl.ai about access. Computer admission may return COMPUTER_LIMIT; the SDK does not retry creation. Computer sessions have a hard 60-minute lifetime from creation. Screenshot observation retries structured startup screen-not-ready errors within a bounded window; other errors are not silently replayed.

Context-manager exit calls close(). Device close acknowledges a stop request; computer close requires terminal state and confirmed resource release. Close submits its stop mutation once; repeated calls share the first outcome, including an unconfirmed failure. Interpreter-exit cleanup is best effort and cannot replace explicit close, especially with asyncio. A failed close is not proof the resource was released; investigate it rather than starting replacement sessions blindly.

Async startup cancellation interrupts its bounded startup request and cleans up when an identity is known. Context managers preserve an existing body failure if cleanup also fails, chaining the cleanup exception. Main-thread open/async_open installs cleanup-compatible SIGTERM handling only when no custom SIGTERM handler exists; it exits with 128 + signal after unwinding and best-effort cleanup. Abrupt termination, SIGKILL, and existing application signal handlers cannot guarantee cleanup.

Development

From python/:

uv sync --frozen
uv run --frozen ruff check .
uv run --frozen ruff format --check .
uv run --frozen mypy
uv run --frozen pytest
uv build
uv run --frozen python -m twine check --strict dist/*
uv run --frozen python scripts/check_package.py

Use an empty dist/ before building; the package checker rejects stale or extra distributions. uv build builds the wheel through the sdist. Package checks validate public files, typing marker, metadata and license, then install the wheel into a fresh isolated venv and run a loopback fake-server smoke without pytest. They also extract the sdist, sync its locked dev environment and run its tests independently of the checkout; repository-only checks for workflow configuration and canonical Go fixture parity skip there. They make no live Revyl requests. CI covers Python 3.10 and the current stable 3.15 series. Use uv lock after deliberate dependency changes; do not hand-edit uv.lock.

Documentation

Troubleshooting

  • NOT_AVAILABLE_ON_PLATFORM: computers do not support instruction/validation; devices do not support commands, files, processes or recording metadata.
  • Blank initial screen: first-frame observation is best effort. Start with an instruction; a transport-level connection does not prove rendered readiness.
  • Validation failed with successful HTTP: use the validation verdict, not transport counters, to decide success. soft=True changes throwing behavior, not the verdict.
  • ACTION_UNCERTAIN: an operation or cleanup outcome was not confirmed. Do not blindly retry mutations or assume a computer has been released.

License

Apache 2.0.

Metadata

Release files for revyl-verify 0.1.0

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

Source distribution (sdist)

Source distribution for revyl-verify 0.1.0
File Size Uploaded Provenance Actions
revyl_verify-0.1.0.tar.gz 163.3 kB With provenance Details for revyl_verify-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for revyl-verify 0.1.0
File Interpreter ABI Platform Actions
revyl_verify-0.1.0-py3-none-any.whl Python 3 none any Details for revyl_verify-0.1.0-py3-none-any.whl

Total release size: 207.7 kB

Release files / revyl_verify-0.1.0.tar.gz

Download URL revyl_verify-0.1.0.tar.gz
Size 163.3 kB
Tags Source
SHA-256 checksum
How to use checksums
df5ec674c8d053752ada649e981959717c63bd4425d1c9ebc5ce9d81e7598778
BLAKE2b-256 checksum
How to use checksums
0c0eb01b12f0cb49875ac92529bfd22707aeae5fb28b936e010de93df3b866a5
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 Nov 11, 2026.

Transparency log

Release files / revyl_verify-0.1.0-py3-none-any.whl

Download URL revyl_verify-0.1.0-py3-none-any.whl
Size 44.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e0d51a9e93acbb5c6c07c2eeae90171a87e14fc122987b92c36c928906161b5a
BLAKE2b-256 checksum
How to use checksums
f5c9e5aa46f750e6a23d1c643701481c7ef3a8c39a4b591c1e370e128468535e
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 Nov 11, 2026.

Transparency log

Security for revyl-verify 0.1.0

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 revyl_verify-0.1.0.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 Nov 11, 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