> ## 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 tool results

> Send results for the agent's pending custom tool calls so the session continues.

## Behavior

When the agent calls a [custom tool](https://hub.hcompany.ai/agents-api/custom-tools.md), the session waits on `awaiting_tool_results` until you post a result for every pending call. The SDK run helpers call this endpoint for you.

Results are relayed to the agent as-is: the API doesn't check `tool_req.id` against the pending calls, so echo the request faithfully. Settling a call on a `paused` session leaves it paused, so [resume](https://hub.hcompany.ai/agents-api/sessions/resume.md) it separately.

## Path parameters

**id** `string` *required*

The session ID.

## Request body

Send either a single settled call or a batch. A single call is a `tool_result` on success or an `error_event` on failure, discriminated by `kind`. Each call echoes back the full pending `tool_req` from [`pending_tool_calls`](https://hub.hcompany.ai/agents-api/custom-tools) (`{ tool_name, args, id }`), not only its ID.

### Tool result (success)

**kind** `string` *required*

`"tool_result"`.

**tool\_req** `object` *required*

The pending tool call this answers, echoed back from `pending_tool_calls`.

**tool\_name** `string` *required*

**args** `object`

**id** `string`

**result** `any`

JSON-serializable tool output, shown to the model.

### Tool error (failure)

**kind** `string` *required*

`"error_event"`.

**error** `string` *required*

Error text shown to the model.

**origin** `string` *required*

Component that produced the error, for example `"custom_tools"`.

**tool\_req** `object`

The pending tool call this answers, echoed back from `pending_tool_calls`. Optional in the schema, but send it so the agent can match the error to its call.

### Batch

**type** `string` *required*

`"batch"`.

**results** `object[]` *required*

At least one `tool_result` or `error_event` object.

## Response

`202 Accepted`. The agent resumes once every pending call has a result.

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

client = Client()

client.sessions.send_session_tool_results(
    session_id,
    request=ToolResultEvent(
        tool_req=ToolRequest(tool_name="lookup_order", args={"order_id": "A1"}, id="call_1"),
        result="shipped",
    ),
)
```

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

const client = new HaiAgentsClient();

await client.sessions.sendSessionToolResults({
  id: sessionId,
  body: {
    kind: "tool_result",
    toolReq: { toolName: "lookup_order", args: { order_id: "A1" }, id: "call_1" },
    result: "shipped",
  },
});
```

```bash cURL theme={"system"}
curl -X POST https://agp.eu.hcompany.ai/api/v2/sessions/$SESSION_ID/tool_results \
  -H "Authorization: Bearer $HAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "kind": "tool_result",
    "tool_req": { "tool_name": "lookup_order", "args": { "order_id": "A1" }, "id": "call_1" },
    "result": "shipped"
  }'
```

## More examples

### Send a batch of results

```python Python theme={"system"}
from hai_agents import Client, ErrorEvent, ToolRequest, ToolResultBatch, ToolResultEvent

client = Client()

client.sessions.send_session_tool_results(
    session_id,
    request=ToolResultBatch(
        results=[
            ToolResultEvent(
                tool_req=ToolRequest(tool_name="lookup_order", args={}, id="call_1"),
                result="shipped",
            ),
            ErrorEvent(
                error="Order not found",
                origin="custom_tools",
                tool_req=ToolRequest(tool_name="lookup_order", args={}, id="call_2"),
            ),
        ],
    ),
)
```

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

const client = new HaiAgentsClient();

await client.sessions.sendSessionToolResults({
  id: sessionId,
  body: {
    type: "batch",
    results: [
      {
        kind: "tool_result",
        toolReq: { toolName: "lookup_order", args: {}, id: "call_1" },
        result: "shipped",
      },
      {
        kind: "error_event",
        error: "Order not found",
        origin: "custom_tools",
        toolReq: { toolName: "lookup_order", args: {}, id: "call_2" },
      },
    ],
  },
});
```

```bash cURL theme={"system"}
curl -X POST https://agp.eu.hcompany.ai/api/v2/sessions/$SESSION_ID/tool_results \
  -H "Authorization: Bearer $HAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "batch",
    "results": [
      {"kind": "tool_result", "tool_req": {"tool_name": "lookup_order", "args": {}, "id": "call_1"}, "result": "shipped"},
      {"kind": "error_event", "error": "Order not found", "origin": "custom_tools", "tool_req": {"tool_name": "lookup_order", "args": {}, "id": "call_2"}}
    ]
  }'
```

## Errors

| Status | Cause |
| - | - |
| `404` | Not found, or not in your organization. |
| `409` | The session already finished. Its pending calls were resolved when it ended. |
| `422` | Malformed request body. |


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