Skip to main content
The typed clients and CLI ship as hai-agents: Python (sync and async, typed with Pydantic v2) and TypeScript. You can also call the API over HTTP (see the API reference, where each endpoint page has a playground) or connect any MCP host.

Install

Authenticate

Set HAI_API_KEY in your environment, or pass the key explicitly. The client sends it on every call as a bearer token. No key yet? Create one.

Client configuration

Region

The clients default to the EU host, and requests stay in-region (the API reference lists the hosts). To target the US region:

Retries, timeouts, and async

Set retries and timeouts on the client, or per call through request options:
Structured output uses AsyncClient to run agents in parallel with asyncio.gather. To run the agent on your own machine behind the same sessions API, use Python’s Client.local(): see Local mode.

Examples

Runnable recipes (QA, extraction, custom tools), each wired as an MCP server or CLI tool, live in hcompai/computer-use-agents-demos.

A plain-language prompt driving a browser agent from Python: add_to_cart.py

The prompt: “Search for ‘Random Access Memories’ by Daft Punk, add it to the shopping cart.” Code: examples/add_to_cart/add_to_cart.py. Related: MCP server, Coding assistants, Quickstart.