> ## 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 (OpenAI-compatible Holo vision-language models 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) before reading the answer. Use webhooks or the `changes` long-poll endpoint to follow progress.

# Sessions

> One agent working on a task.

## Run a session

`holo run` and `run_session` / `runSession` create the session, block until it ends, and return the answer.

```bash CLI theme={"system"}
holo run "Open Hacker News and list the top 3 stories with their URLs." \
  --agent h/web-surfer-flash
```

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

client = Client()
result = client.run_session(
    agent="h/web-surfer-flash",
    messages="Open Hacker News and list the top 3 stories with their URLs.",
)
print(result.status, result.answer)
```

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

const client = new HaiAgentsClient();
const result = await client.runSession({
  agent: "h/web-surfer-flash",
  messages: "Open Hacker News and list the top 3 stories with their URLs.",
});
console.log(result.status, result.answer);
```

Long sessions compact their history automatically.

## Get the result

| Way | Use when | You get back |
| - | - | - |
| `client.run_session(...)` / `runSession` | One call: create, block, read | The final result: `status`, `answer`, `outcome`, `error_code` |
| `client.start_session(...)`, then `session.stream()` or `session.wait_for_completion()` ([Watch and steer](https://hub.hcompany.ai/agents-api/observe-and-steer.md#watch-a-session)) | Read or steer while it runs | Each event as it arrives, or the same final result |
| [Webhooks](https://hub.hcompany.ai/agents-api/webhooks/overview.md) | Batches and queued sessions, without polling | `session.completed` and the other status events |

Over raw HTTP, the create call returns at once with the `id`, which every follow-up call (message, pause, cancel) uses. Long-poll [`changes`](https://hub.hcompany.ai/agents-api/sessions/changes) by its [polling rules](https://hub.hcompany.ai/agents-api/sessions/changes.md#polling-rules), or read `latest_answer` with [Retrieve a session](https://hub.hcompany.ai/agents-api/sessions/retrieve.md) once the session is terminal.

```bash theme={"system"}
curl -X POST https://agp.eu.hcompany.ai/api/v2/sessions \
  -H "Authorization: Bearer $HAI_API_KEY" -H "Content-Type: application/json" \
  -d '{"agent": "h/web-surfer-flash", "messages": "Open Hacker News and list the top 3 stories with their URLs."}' | jq -r .id
```

## Session states

The [session object](https://hub.hcompany.ai/agents-api/sessions/retrieve.md#response) carries the current state.

| Status | Meaning | Terminal |
| - | - | - |
| `queued` | Waiting for a free slot (see [Queued sessions](https://hub.hcompany.ai/agents-api/plans-and-limits.md#queued-sessions)). | No |
| `pending` | Created, agent is launching. | No |
| `running` | Agent is working on the task. | No |
| `paused` | [Paused](https://hub.hcompany.ai/agents-api/sessions/pause.md) via the API. State is preserved. | No |
| `idle` | Interactive agent finished a task and waits for your next message. | No |
| `awaiting_tool_results` | Blocked on [custom tool](https://hub.hcompany.ai/agents-api/custom-tools.md) calls your code must answer, or on calls held for your [approval](https://hub.hcompany.ai/agents-api/sessions/tool-approvals.md). | No |
| `completed` | The agent answered. Its [`outcome`](https://hub.hcompany.ai/agents-api/errors#outcomes) says whether the task succeeded. | Yes |
| `timed_out` | Never started: it waited 24 hours in the queue. | Yes |
| `interrupted` | [Cancelled](https://hub.hcompany.ai/agents-api/sessions/cancel.md), or ended while idle to [make room](https://hub.hcompany.ai/agents-api/plans-and-limits.md#idle-sessions-make-room) at your limit. | Yes |
| `failed` | An unrecoverable error occurred. `error_code` says why. | Yes |

A [message](https://hub.hcompany.ai/agents-api/sessions/send-messages.md) or a [forced answer](https://hub.hcompany.ai/agents-api/sessions/force-answer.md) restarts a finished session at `pending`, billed again.

## Customize a catalog agent for one session

[`overrides`](https://hub.hcompany.ai/agents-api/sessions/create#param-overrides) replaces fields of a catalog agent for one session, keyed by path. For example, send a web surfer to a chosen start page:

```bash CLI theme={"system"}
holo run "Summarize the top discussion right now" \
  --agent h/web-surfer-flash \
  --override 'agent.environments[kind=web].start_url=https://news.ycombinator.com'
```

```python Python theme={"system"}
session = client.sessions.create_session(
    agent="h/web-surfer-flash",
    messages="Summarize the top discussion right now",
    overrides={"agent.environments[kind=web].start_url": "https://news.ycombinator.com"},
)
```

```typescript TypeScript theme={"system"}
const session = await client.sessions.createSession({
  body: {
    agent: "h/web-surfer-flash",
    messages: "Summarize the top discussion right now",
    overrides: { "agent.environments[kind=web].start_url": "https://news.ycombinator.com" },
  },
});
```

```bash cURL theme={"system"}
curl -X POST https://agp.eu.hcompany.ai/api/v2/sessions \
  -H "Authorization: Bearer $HAI_API_KEY" -H "Content-Type: application/json" \
  -d '{
    "agent": "h/web-surfer-flash",
    "messages": "Summarize the top discussion right now",
    "overrides": {"agent.environments[kind=web].start_url": "https://news.ycombinator.com"}
  }'
```

## Find past sessions

[`GET /api/v2/sessions`](https://hub.hcompany.ai/agents-api/sessions/list) pages through your sessions, newest first. Combine filters, for example `?status=running&status=queued&agent=web-price-finder`. The SDKs expose it as `client.sessions.list_sessions(...)` / `listSessions`.


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