1

Install the driver

It needs Python 3.11 or later.
pip install halyard
2

Get a control URL

Every browser session has a control_url: the WebSocket the driver connects to, carrying a short-lived token for that one session. Start a session with your API key and read it from the result:
from halyard import Client

client = Client()                      # reads HALYARD_API_KEY
session = client.browsers.create()
try:
    print(session.control_url)
    ...                                # the next step goes here
finally:
    session.stop()
A session keeps running until it is stopped, so stop it in finally, which runs even when your code raises.Inside a Halyard sandbox the session is already open and HALYARD_CONTROL_URL is set, so you can skip this step.
3

Connect and drive the page

from halyard import Browser, expect

browser = session.connect()            # or Browser.connect(control_url)
page = browser.page

page.goto("https://example.com")
expect(page).to_have_title("Example Domain")

page.get_by_role("link", name="Learn more").click()
page.wait_for_load_state()
print(page.url)

page.screenshot(path="shot.png")
Locators wait for their element before acting, so there is no need to sleep. See Locator.
4

Close up

browser.close()       # closes the connection
session.stop() in finally then ends the session.

The whole script

quickstart.py
from halyard import Client, expect

with Client() as client:
    session = client.browsers.create()
    try:
        with session.connect() as browser:
            page = browser.page
            page.goto("https://example.com")
            expect(page).to_have_title("Example Domain")
            page.get_by_role("link", name="Learn more").click()
            page.wait_for_load_state()
            print("landed on", page.url)
    finally:
        session.stop()

Next steps

Connecting

Control URLs, named connections and the session client.

Page

Navigation, scripts, waits and locators.