> ## 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 three 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 (Holo computer-use models for your own agent harness, OpenAI-compatible, at https://api.hcompany.ai/v1), and HoloTab (a free no-code Chrome extension that runs Holo in the user's browser, with recordable routines and schedules). The `holo` CLI (`pip install "hai-agents[cli]"`) runs Agents API agents from a terminal, drives the user's own desktop with `-a h/holo-desktop`, and serves coding agents through `holo mcp`.
> 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: `holo`.
> 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), or idle for interactive sessions created with `idle_timeout_s`, before reading the answer. Use webhooks or the `changes` long-poll endpoint to follow progress.

# Agent Client Protocol

> Run H agents in Zed, JetBrains IDEs, Neovim, OpenClaw, and other Agent Client Protocol clients, with live steps, approvals, and cancel. The editor starts hai acp locally; the agent runs in the cloud.

| | [Hosted MCP server](https://hub.hcompany.ai/agents-api/mcp.md) | `hai acp` |
| - | - | - |
| Who drives the agent | Your coding assistant, through tool calls | You, from the editor's agent panel |
| Progress | The assistant polls every 25 seconds | Every step, live |
| Held tool calls | Reported, not answered | Answered in the editor |
| Stop | Ends the session | Stops the turn, keeps the session |
| Follow-ups | With `keep_open_s` | Every prompt in a thread |

## Set up

**1. Install and sign in**

`hai acp` ships with the Python SDK's `acp` extra. `hai login` saves your [API key](https://hub.hcompany.ai/agents-api/quickstart.md#get-your-api-key) in `~/.config/hai/.env`, so the key never goes through the editor.

```bash uv theme={"system"}
uv tool install 'hai-agents[acp]'
hai login
```

```bash pip theme={"system"}
pip install 'hai-agents[acp]'
hai login
```

**2. Add it to your editor**

Register a custom agent that runs `hai acp`. If the editor cannot find `hai`, use its full path from `which hai`. Other ACP editors, such as avante.nvim and Emacs agent-shell, take the same command and arguments; see the [client list](https://agentclientprotocol.com/get-started/clients).

```json Zed theme={"system"}
// ~/.config/zed/settings.json
{
  "agent_servers": {
    "H agents": {
      "type": "custom",
      "command": "hai",
      "args": ["acp"]
    }
  }
}
```

```json JetBrains theme={"system"}
// ~/.jetbrains/acp.json
{
  "agent_servers": {
    "H agents": {
      "command": "/full/path/to/hai",
      "args": ["acp"]
    }
  }
}
```

```json OpenClaw theme={"system"}
// OpenClaw config: the acpx plugin starts hai acp
{
  "plugins": {
    "entries": {
      "acpx": {
        "enabled": true,
        "config": { "agents": { "h-agents": { "command": "hai", "args": ["acp"] } } }
      }
    }
  },
  "acp": { "enabled": true, "backend": "acpx", "allowedAgents": ["h-agents"] }
}
```

```lua Neovim (CodeCompanion) theme={"system"}
require("codecompanion").setup({
  adapters = {
    acp = {
      h_agents = function()
        local helpers = require("codecompanion.adapters.acp.helpers")
        return {
          name = "h_agents",
          formatted_name = "H agents",
          type = "acp",
          roles = { llm = "assistant", user = "user" },
          commands = { default = { "hai", "acp" } },
          defaults = { mcpServers = {}, timeout = 20000 },
          parameters = {
            protocolVersion = 1,
            clientCapabilities = { fs = { readTextFile = false, writeTextFile = false } },
            clientInfo = { name = "CodeCompanion.nvim", version = "1.0.0" },
          },
          handlers = {
            lifecycle = {
              setup = function(self) return true end,
              auth = function(self) return true end,
            },
            request = { build_messages = helpers.build_messages },
          },
        }
      end,
    },
  },
})
```

**3. Check it works**

Start a thread with **H agents**: in Zed from the Agent Panel's new-thread menu, in JetBrains from the agent list in AI Chat, in Neovim with `:CodeCompanionChat adapter=h_agents`, in OpenClaw with `/acp spawn h-agents --bind here`. Send:

```text theme={"system"}
What is 17 times 23? Answer with the number only, do not browse.
```

The agent answers `391` under a **Watch the run** link. `Now add 9.` in the same thread answers `400` from the same session.

## How it works

| | Behavior |
| - | - |
| Session | The first prompt starts a session; each later prompt in the thread is a follow-up. It stays open for an hour after each answer. Closing the thread ends it, and quitting the editor ends all of them. |
| Agent | The thread's **Agent** option starts on your default: `HAI_AGENT`, or the one set with `hai agents use`, else `h/web-surfer-flash`. Change it before the first prompt; after that it is fixed. |
| Steps | A **Watch the run** link, then each thought, tool call (marked done or failed), shared file, and the reply. A failure shows the session's `error` and [`error_code`](https://hub.hcompany.ai/agents-api/errors#error-codes). |
| [Approvals](https://hub.hcompany.ai/agents-api/sessions/tool-approvals.md) | The editor asks with four choices. **Always allow** and **Always deny** apply to that tool for the rest of the thread. A denied call tells the agent you declined it; dismissing the prompt denies the call and stops the turn. |
| Stop | [Pauses](https://hub.hcompany.ai/agents-api/sessions/pause.md) the session and ends the turn. Your next prompt resumes it, and the agent keeps what it has done. |
| Files | Attached files are sent as text. A linked file is sent as its URI only. Images are not sent. |

`HAI_API_KEY` and `HAI_API_BASE_URL` in the editor's environment take precedence over `~/.config/hai/.env`.

## Limits and troubleshooting

| Problem | Why, or fix |
| - | - |
| The editor's MCP servers are not passed to the agent | The agent runs in the cloud and cannot reach servers on your machine. The editor shows a warning. |
| The agent cannot read or edit your project files | It works in its own environment; attach the files it needs to the prompt. |
| `Authentication required` | Run `hai login` in a terminal. |
| `Install it with: pip install 'hai-agents[acp]'` | The `acp` extra is missing; install it as above. |
| The editor cannot start the agent | Use the full path from `which hai` as the command. |
| You need the editor's ACP logs | Zed: `dev: open acp logs`. JetBrains: AI Chat, **...**, **Get ACP Logs**. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.