This example requires a desktop-capable template.
Setup
uv pip install "${NULLSPACE_SDK_INSTALL_SPEC:-nullspace-sdk==1.0.0}"
export NULLSPACE_API_KEY=ns_live_...
export NULLSPACE_API_URL=https://api.your-nullspace-domain
Python
from nullspace import Machine
with Machine.create(template="desktop", timeout=300) as machine:
width, height = machine.desktop.screen_size()
print(f"desktop: {width}x{height}")
machine.desktop.open("https://example.com")
stream = machine.desktop.stream.start(view_only=False)
print(f"viewer: {stream.viewer_url}")
png = machine.desktop.screenshot()
print(f"screenshot bytes: {len(png)}")
machine.desktop.stream.stop()
Production note
Viewer URLs are signed. Treat them as bearer credentials and rotate viewer
sessions when sharing access.
Guide: Managed desktop viewer.