hai-agents Python SDK only.
Local control is not local mode: here only the browser or desktop is on your machine, while in local mode (Client.local()) the agent itself runs there too.
How it works
A local environment is a normal environment withhost: "user_device". When a session starts, the SDK opens a connection inside your Python process. The connection receives the agent’s actions, carries them out on your machine, and ties this session to this machine. Observe and steer, changes, and Agent View work as for a cloud run.
- One at a time. A Python process drives one local browser (or desktop) at a time. A new session on it takes it over and cancels the earlier session.
- Tied to your process. The connection closes when your Python process exits, and the sessions it served are cancelled (Chrome stays open). If the connection drops mid-session, the session is cancelled too.
- Cloud-only fields. Vaults and browser profiles apply to cloud browsers only. Your local Chrome’s own logins fill that role.
Auto-connect scope
Install
The drivers come from thehai-drivers package, as optional extras. Add cli for the hai command.
Install
Run a session
Create an agent whose environment setshost to user_device, then run a session with it. In Python there is nothing else to set up. From the CLI, serve your machine and point the agent at the session_id it prints (the CLI tab reuses the agent created in the Python tab).
- Browser
- Desktop
hai local browser flags: --session-id (generated when omitted) and --debug-port (default 9222).The Chrome it drives. The SDK attaches to a Chrome with remote debugging open on port 9222. If none is running, it launches one with its own profile in ~/.hai/chrome-profile. That profile persists across runs: sign in once and the agent finds you signed in next time. The SDK never touches your everyday Chrome profile (Chrome does not allow remote debugging on it).To drive a different Chrome, start it yourself before the session. Chrome only opens the debugging port with --user-data-dir, so pick a dedicated directory and keep it for the logins you want the agent to have.