agent and session lifecycle you already use. Run a session that uses a local desktop from the hai-agents Python SDK (the only SDK with local control today) and it connects your machine to H for you. Works on macOS, Windows, and Linux.
Use it when the task lives outside the browser: native apps, the file system, or multi-window flows on a machine you control.
How it works
A local desktop is an environment with itskind set to desktop and host set to user_device. When a session starts with one, the SDK opens a connection inside your Python process. The connection receives the agent’s actions and carries them out on the real desktop, and it is what ties this particular session to this particular machine. Everything else is unchanged: observe and steer the run and read its answer just as you would a remote one.
A Python process serves one local desktop session at a time. Starting a new session that uses the local desktop while an earlier one is still running hands the desktop to the new session and cancels the earlier one.
Install the desktop driver
The desktop driver is an optional extra, provided by the
hai-drivers package:Install
Run a session
In Python, define the environment inline on the agent and run a session. There is nothing else to set up; the SDK connects the desktop before the session starts. From the CLI, serve the desktop with The session behaves like any other: observe and steer it, read changes, or watch it in Agent View. The Python connection closes when your process exits.Auto-connect covers agents defined inline in
hai local desktop and point the agent at the session_id it prints.run_session, start_session, or create_session. A registered agent referenced by name, or a session started from the web app or another machine, expects its user_device environment to carry the session_id of a machine served with hai local desktop, as in the CLI tab. Set HAI_AUTO_BRIDGE=0 to opt out of auto-connect entirely.Grant OS permissions when prompted
The agent controls the real mouse and keyboard and reads the screen, so your operating system has to trust the program running it (your terminal, or the app that launches Python). On macOS, your first session triggers two permission prompts. Grant both in System Settings → Privacy & Security, then restart the program and run the session again:
- Accessibility, to move the mouse and type.
- Screen Recording, to read the screen.
Next steps
Local browser
Drive Chrome on your machine the same way.
Observe & steer
Watch a local run, redirect it mid-task, and read the answer.
SDKs
Install the clients and authenticate.
Environments
How environments attach to an agent and what each kind contributes.