A plain-language prompt driving a browser agent from Python (add_to_cart.py)
hai-agents.
Python
Sync and async clients, typed with Pydantic v2.
TypeScript
A fully typed client for sessions, agents, skills, environments, schedules, and webhooks.
Install
Authenticate
SetHAI_API_KEY in your environment, or pass the key explicitly. Either way the client attaches it to every call as a bearer token. If you don’t have a key yet, create one first.
Client configuration
Region
The clients default to the EU host. Requests stay in-region; the hosts are listed on the API reference. To target the US region, pass it explicitly:Retries
The clients retry transient errors with backoff, twice by default. Setmax_retries (Python) / maxRetries (TypeScript) on the client, or per call via request options. Which codes count as transient is on Errors.
Async client
Python shipsAsyncClient with the same surface as Client, awaited. Session handles from it support async for on stream(). Structured output uses it to run agents in parallel with asyncio.gather. The TypeScript client is async throughout.
Examples
Thehcompai/computer-use-agents-demos repo collects recipes for the hai-agents SDK. Each one runs on its own and is wired up as an MCP server, a CLI tool, or both, so you can call the agents from Claude Code, Cursor, Codex, or Hermes.
See it in action
QA a live page from Claude Code: “Usereview_web_ui to check the top story link works and the page has reasonable accessibility.”
Autonomous QA of a web page via the review_web_ui MCP tool
examples/add_to_cart/add_to_cart.py
Next steps
MCP server
Run and manage agents from Cursor, Claude Code, Codex, Hermes, and more, with no SDK code.
Coding assistants
Install the
hai-agents skill so Claude Code, Cursor, and other assistants know the H APIs and scaffold use cases for you.Quickstart
Run your first session end to end in under 5 minutes.
Agents
Reusable configurations: pre-built agents and how to create your own.