> ## Documentation Index
> Fetch the complete documentation index at: https://hub.hcompany.ai/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> H Platform has four products: the Agents API (managed computer-use agents, base URL https://agp.eu.hcompany.ai/api/v2 or https://agp.hcompany.ai/api/v2 for the US), the Models API (OpenAI-compatible Holo vision-language models at https://api.hcompany.ai/v1), HoloDesktop CLI (Holo on the user's own desktop), and HoloTab (a free no-code Chrome extension that runs Holo in the user's browser, with recordable routines and schedules).
> Authenticate with a bearer API key from the HAI_API_KEY environment variable. SDKs: `pip install hai-agents` (Python, `from hai_agents import Client`) and `npm install hai-agents` (TypeScript, `import { HaiAgentsClient } from "hai-agents"`). CLI: `hai`.
> Agents do work in a browser or on a desktop; describe the task as an imperative instruction. To run a task quickly, prefer the pre-built agent `h/web-surfer-flash`. Read results from the session's `latest_answer` after it reaches a terminal status.
> Sessions are the unit of work; wait for a terminal status (completed, failed, timed_out, interrupted) before reading the answer. Use webhooks or the `changes` long-poll endpoint to follow progress.

# Build with the SDKs

> Install and configure the hai-agents Python and TypeScript SDKs and CLI: authentication, region, retries, async client, and example recipes.

<Frame caption="A plain-language prompt driving a browser agent from Python (add_to_cart.py)">
  <video controls playsInline className="w-full aspect-video rounded-xl" src="https://mintcdn.com/hcompany/NKXrpCWEaWVdSeM0/videos/add-to-cart.mp4?fit=max&auto=format&n=NKXrpCWEaWVdSeM0&q=85&s=ee4bb16ed0f1b4765589a1c89e5dbad0" data-path="videos/add-to-cart.mp4" />
</Frame>

Call the API directly over HTTP, use a typed client, or connect any [MCP host](/agents-api/mcp). The clients and CLI ship as `hai-agents`.

<CardGroup cols={2}>
  <Card title="Python" icon="python" href="https://pypi.org/project/hai-agents/">
    Sync and async clients, typed with Pydantic v2.
  </Card>

  <Card title="TypeScript" icon="js" href="https://www.npmjs.com/package/hai-agents">
    A fully typed client for sessions, agents, skills, environments, schedules, and webhooks.
  </Card>
</CardGroup>

## Install

<CodeGroup>
  ```bash CLI theme={"system"}
  pip install "hai-agents[cli]"
  ```

  ```bash Python theme={"system"}
  pip install hai-agents
  ```

  ```bash TypeScript theme={"system"}
  npm install hai-agents
  ```
</CodeGroup>

## Authenticate

Set `HAI_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](/agents-api/quickstart#get-your-api-key) first.

<CodeGroup>
  ```bash CLI theme={"system"}
  hai login   # browser sign-in; stores the key in ~/.config/hai/.env
  ```

  ```python Python theme={"system"}
  from hai_agents import Client

  client = Client()
  # or pass it explicitly: Client(api_key="hk-...")
  ```

  ```typescript TypeScript theme={"system"}
  import { HaiAgentsClient } from "hai-agents";

  const client = new HaiAgentsClient();
  // or pass it explicitly: new HaiAgentsClient({ apiKey: "hk-..." })
  ```
</CodeGroup>

Each endpoint's [reference page](/agents-api/sessions/create) has a playground that runs in your browser and shows raw HTTP, handy for exploring the wire format; the shared conventions are on the [API reference](/agents-api/api-reference). Use the SDK snippets here and in the [Quickstart](/agents-api/quickstart) for code you'd ship.

## Client configuration

### Region

The clients default to the EU host. Requests stay in-region; the hosts are listed on the [API reference](/agents-api/api-reference#base-url). To target the US region, pass it explicitly:

<CodeGroup>
  ```python Python theme={"system"}
  from hai_agents import Client, HaiAgentsEnvironment

  client = Client(environment=HaiAgentsEnvironment.US)
  ```

  ```typescript TypeScript theme={"system"}
  import { HaiAgentsClient, HaiAgentsEnvironment } from "hai-agents";

  const client = new HaiAgentsClient({ environment: HaiAgentsEnvironment.Us });
  ```
</CodeGroup>

### Retries

The clients retry transient errors with backoff, twice by default. Set `max_retries` (Python) / `maxRetries` (TypeScript) on the client, or per call via request options. Which codes count as transient is on [Errors](/agents-api/errors#handling-errors-with-the-sdk).

### Async client

Python ships `AsyncClient` with the same surface as `Client`, awaited. Session handles from it support `async for` on `stream()`. [Structured output](/agents-api/structured-output#chaining-agents) uses it to run agents in parallel with `asyncio.gather`. The TypeScript client is async throughout.

## Examples

The [`hcompai/computer-use-agents-demos`](https://github.com/hcompai/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.

| Example                                                                                                                  | What it shows                                                                                                                                                      | Interface                                       |
| ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------- |
| [`qa/mcp`](https://github.com/hcompai/computer-use-agents-demos/tree/main/examples/qa/mcp)                               | An autonomous browser agent QAs a remote URL and returns a structured `{verdict, summary, findings}`                                                               | MCP server (`review_web_ui`, `visual_check`)    |
| [`qa/cli`](https://github.com/hcompai/computer-use-agents-demos/tree/main/examples/qa/cli)                               | The same QA agent exposed as a shell command, surfaced to Claude Code via the `hai-qa-via-cli` skill                                                               | CLI (`qa-cli review / visual`)                  |
| [`extract_anything`](https://github.com/hcompai/computer-use-agents-demos/tree/main/examples/extract_anything)           | Wrap an agent call as a typed function: a generic `extract(url, task, schema)` or curated `get_*` tools                                                            | MCP server (`extract`) + CLI (`extract-cli`)    |
| [`counterfeit_detection`](https://github.com/hcompai/computer-use-agents-demos/tree/main/examples/counterfeit_detection) | A custom-tools cookbook in three stages: bare `run_session`, then local screenshot-compare tools, then a `max_steps` / `max_time_s` budget for an exhaustive sweep | CLI (`counterfeit-cli simple / tooled / sweep`) |

### See it in action

QA a live page from Claude Code: *"Use `review_web_ui` to check the top story link works and the page has reasonable accessibility."*

<Frame caption="Autonomous QA of a web page via the review_web_ui MCP tool">
  <video controls playsInline className="w-full aspect-video rounded-xl" src="https://mintcdn.com/hcompany/NKXrpCWEaWVdSeM0/videos/qa-review-web-ui.mp4?fit=max&auto=format&n=NKXrpCWEaWVdSeM0&q=85&s=2f31220a7f6ed272f878341a8c394545" data-path="videos/qa-review-web-ui.mp4" />
</Frame>

The video at the top of this page drives the agent straight from a natural-language prompt in Python: *"Search for 'Random Access Memories' by Daft Punk, add it to the shopping cart."* Runnable code: [`examples/add_to_cart/add_to_cart.py`](https://github.com/hcompai/computer-use-agents-demos/blob/main/examples/add_to_cart/add_to_cart.py)

## Next steps

<CardGroup cols={2}>
  <Card title="MCP server" icon="plug" href="/agents-api/mcp">
    Run and manage agents from Cursor, Claude Code, Codex, Hermes, and more, with no SDK code.
  </Card>

  <Card title="Coding assistants" icon="screwdriver-wrench" href="/agents-api/coding-skills">
    Install the `hai-agents` skill so Claude Code, Cursor, and other assistants know the H APIs and scaffold use cases for you.
  </Card>

  <Card title="Quickstart" icon="arrow-right" href="/agents-api/quickstart">
    Run your first session end to end in under 5 minutes.
  </Card>

  <Card title="Agents" icon="robot" href="/agents-api/agents/overview">
    Reusable configurations: pre-built agents and how to create your own.
  </Card>
</CardGroup>
