> ## 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.

# Send messages

> Send a running agent more context, a correction, or an answer to its question.

## Behavior

The agent reads messages on its next step.

Delivery adapts to the session's state: a `paused` session is resumed first, a [`queued`](https://hub.hcompany.ai/agents-api/plans-and-limits#queued-sessions) session buffers the message until it starts, and a finished session restarts (back to `pending`, billed as in [Token usage](https://hub.hcompany.ai/agents-api/plans-and-limits.md#token-usage)) with the message delivered to the relaunched agent.

## Path parameters

**id** `string` *required*

The session ID.

## Request body

Send either a single message or a batch, discriminated by `type`.

### Single message

**type** `string` (default: user\_message)

`"user_message"`. May be omitted.

**message** `string` *required*

The message text.

**images** `string[]`

Base64 data URIs to attach, for example `data:image/png;base64,...`.

**files** `object[]`

Files to attach, up to 10 and 7 MB in total. Each is `{ name, source, type: "base64", media_type? }` (`media_type` is guessed if omitted). Saved under `~/Downloads` on a cloud browser, and under `files/` in the [workspace](https://hub.hcompany.ai/agents-api/your-desktop.md#workspace) of a desktop in shell mode. An agent with no environment that can receive files gets `422`.

**caller\_id** `string` (default: user)

The sender. Leave it unset for normal user input.

**skills** `object[]`

Skills for this message only, as inline [skill objects](https://hub.hcompany.ai/agents-api/skills/create.md#request-body) (`name`, `description`, `body`). The agent gets their instructions with this message, and the agent's own skills are unchanged.

```json theme={"system"}
"skills": [
  {"name": "team-tone", "description": "Write like our team", "body": "Answer in three short bullets."}
]
```

### Batch

**type** `string` *required*

`"batch"`.

**messages** `object[]` *required*

At least one single-message object, processed in order.

## Response

`202 Accepted`. The message is delivered asynchronously.

```bash CLI theme={"system"}
holo sessions send "$SESSION_ID" 'Focus on hotels near Kiyomizu-dera temple, under $200/night'
```

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

client = Client()

client.sessions.send_session_messages(
    session_id,
    request={"message": "Focus on hotels near Kiyomizu-dera temple, under $200/night"},
)
```

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

const client = new HaiAgentsClient();

await client.sessions.sendSessionMessages({
  id: sessionId,
  body: {
    type: "user_message",
    message: "Focus on hotels near Kiyomizu-dera temple, under $200/night",
  },
});
```

```bash cURL theme={"system"}
curl -X POST https://agp.eu.hcompany.ai/api/v2/sessions/$SESSION_ID/messages \
  -H "Authorization: Bearer $HAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "user_message",
    "message": "Focus on hotels near Kiyomizu-dera temple, under $200/night"
  }'
```

## More examples

### Send a batch of messages

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

client = Client()

client.sessions.send_session_messages(
    session_id,
    request={
        "type": "batch",
        "messages": [
            {"message": "Also check availability for June 15-20"},
            {"message": "I prefer traditional ryokans over modern hotels"},
        ],
    },
)
```

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

const client = new HaiAgentsClient();

await client.sessions.sendSessionMessages({
  id: sessionId,
  body: {
    type: "batch",
    messages: [
      { type: "user_message", message: "Also check availability for June 15-20" },
      { type: "user_message", message: "I prefer traditional ryokans over modern hotels" },
    ],
  },
});
```

```bash cURL theme={"system"}
curl -X POST https://agp.eu.hcompany.ai/api/v2/sessions/$SESSION_ID/messages \
  -H "Authorization: Bearer $HAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "batch",
    "messages": [
      {"type": "user_message", "message": "Also check availability for June 15-20"},
      {"type": "user_message", "message": "I prefer traditional ryokans over modern hotels"}
    ]
  }'
```

## Errors

| Status | Cause |
| - | - |
| `404` | Not found, or not in your organization. |
| `409` | The session just stopped and is still shutting down. `detail[].type` is `session_stopping`. Send the message again after `Retry-After` to restart it. |
| `422` | Invalid message body, for example an image that isn't a decodable base64 data URI, or `files` when no environment of the session can receive them. |
| `429` | The message would restart a finished session, but no slot is free: you are at your [concurrency limit](https://hub.hcompany.ai/agents-api/plans-and-limits.md#concurrent-sessions), or the platform is at capacity. `detail[].type` says which [limit](https://hub.hcompany.ai/agents-api/errors.md#quota-errors-429) was hit. The session stays finished and the message is not delivered. A restart never queues, so retry later. |


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