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

# Memory

> Agents keep notes that outlive the session. Agents on the same namespace read and write the same notes.

Memory is stored by the hosted Agents API. The examples below use `Client()`; `Client.local().memories` is not implemented.

## Try it

Two sessions share the namespace `market-research`. The researcher finds a price and saves it. The writer, in a later session, reports it from memory.

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

client = Client()
memory = {"namespace": "market-research"}
browser = [{"id": "browser", "kind": "web"}]

client.run_session(
    agent={"name": "researcher", "description": "Finds prices.", "environments": browser, "memory": memory},
    messages="Find the price of a Kindle Paperwhite on amazon.com, and remember it.",
)

result = client.run_session(
    agent={"name": "writer", "description": "Writes short reports.", "environments": browser, "memory": memory},
    messages="Write a one-line report on the Kindle Paperwhite price our team found.",
)
print(result.answer)
```

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

const client = new HaiAgentsClient();
const memory = { namespace: "market-research" };
const browser = [{ id: "browser", kind: "web" as const }];

await client.runSession({
  agent: { name: "researcher", description: "Finds prices.", environments: browser, memory },
  messages: "Find the price of a Kindle Paperwhite on amazon.com, and remember it.",
});

const result = await client.runSession({
  agent: { name: "writer", description: "Writes short reports.", environments: browser, memory },
  messages: "Write a one-line report on the Kindle Paperwhite price our team found.",
});
console.log(result.answer);
```

```bash cURL theme={"system"}
API=https://agp.eu.hcompany.ai/api/v2
AUTH="Authorization: Bearer $HAI_API_KEY"

SESSION_ID=$(curl --fail-with-body -sS "$API/sessions" \
  -H "$AUTH" -H "Content-Type: application/json" \
  -d '{"agent":"h/web-surfer-flash","overrides":{"agent.memory":{"namespace":"market-research"}},"messages":"Find the price of a Kindle Paperwhite on amazon.com, and remember it.","max_time_s":120,"queue":false}' | jq -r .id)

# Wait for the note to be saved before starting the second session.
for attempt in {1..120}; do
  STATUS=$(curl --fail-with-body -sS "$API/sessions/$SESSION_ID/status" -H "$AUTH" | jq -r .status)
  case "$STATUS" in
    completed) break ;;
    failed|timed_out|interrupted) echo "Session $SESSION_ID: $STATUS" >&2; exit 1 ;;
  esac
  sleep 2
done
[ "$STATUS" = completed ] || { echo "Session did not finish in time" >&2; exit 1; }

# Start a new session in the same namespace.
curl "$API/sessions" -H "$AUTH" -H "Content-Type: application/json" \
  -d '{"agent":"h/web-surfer-flash","overrides":{"agent.memory":{"namespace":"market-research"}},"messages":"Write a one-line report on the Kindle Paperwhite price our team found."}'
```

```bash CLI theme={"system"}
holo run --quiet -a h/web-surfer-flash \
  -o 'agent.memory={"namespace":"market-research"}' \
  "Find the price of a Kindle Paperwhite on amazon.com, and remember it."

# Each command waits for its session to finish.
holo run --quiet -a h/web-surfer-flash \
  -o 'agent.memory={"namespace":"market-research"}' \
  "Write a one-line report on the Kindle Paperwhite price our team found."
```

The writer answers from the researcher's note, with the price and the day it was found. With cURL, [poll the new session's changes](https://hub.hcompany.ai/agents-api/sessions/changes.md#polling-rules) for its answer. A stored agent takes [`memory`](https://hub.hcompany.ai/agents-api/agents/agent-object#fields) the same way.

> [accordion] How it works
>
> Each session of an agent with `memory` gets four tools and the `h/memory` [skill](https://hub.hcompany.ai/agents-api/skills/overview.md), which tells it when to use them:
>
> | Tool | Does |
> | - | - |
> | `list_memories` | Lists the keys saved in the namespace. |
> | `get_memory` | Reads a note. |
> | `set_memory` | Saves a note, replacing the one under the same key. |
> | `delete_memory` | Deletes a note. |
>
> The agent saves what a later session would otherwise find out again: preferences, procedures that worked, ids, conclusions. The skill tells it to avoid secrets and check what it reads; this is guidance, not an access restriction. `memory` is `null` by default.

> [accordion] Namespaces, keys and retention
>
> * **Namespace.** 1 to 127 characters, shared by every agent of your organization that names it.
> * **Keys.** Slash paths that group by topic, such as `prices/kindle-paperwhite` or `preferences/report-format`.
> * **Values.** Text, up to 64 KB.
> * **Retention.** Each write uses your current privacy setting unless you pass `delete_after_min`. Pass `null` to keep a note until you delete it, or a positive number of minutes to expire it. Each write restarts the window. See [retention](https://hub.hcompany.ai/agents-api/memories/create.md#param-delete-after-min).

> [accordion] What to trust
>
> A note can carry what a page told the agent. Give memory to agents whose sources you trust, and keep secrets out of their tasks.

## Manage notes

The CLI, SDKs and API can [create](https://hub.hcompany.ai/agents-api/memories/create.md), [list](https://hub.hcompany.ai/agents-api/memories/list.md), [read](https://hub.hcompany.ai/agents-api/memories/retrieve.md), [update](https://hub.hcompany.ai/agents-api/memories/update.md), and [delete](https://hub.hcompany.ai/agents-api/memories/delete.md) notes. Writing the same namespace and key replaces the note.

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

client = Client()
note = client.memories.create_memory(
    namespace="market-research",
    key="preferences/report-format",
    value="Tables, with a source link per row.",
    delete_after_min=None,
)
for item in client.memories.list_memories(namespace="market-research").items:
    print(item.key, item.value)
client.memories.delete_memory(note.id)
```

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

const client = new HaiAgentsClient();
const note = await client.memories.createMemory({
  namespace: "market-research",
  key: "preferences/report-format",
  value: "Tables, with a source link per row.",
  deleteAfterMin: null,
});
const page = await client.memories.listMemories({ namespace: "market-research" });
for (const item of page.items) console.log(item.key, item.value);
await client.memories.deleteMemory({ id: note.id });
```

```bash cURL theme={"system"}
API=https://agp.eu.hcompany.ai/api/v2
AUTH="Authorization: Bearer $HAI_API_KEY"

curl -X POST "$API/memories" -H "$AUTH" -H "Content-Type: application/json" \
  -d '{"namespace": "market-research", "key": "preferences/report-format", "value": "Tables, with a source link per row.", "delete_after_min": null}'

curl "$API/memories?namespace=market-research" -H "$AUTH"

# Set MEMORY_ID to the id returned above.
curl -X DELETE "$API/memories/$MEMORY_ID" -H "$AUTH"
```

```bash CLI theme={"system"}
holo memories set market-research preferences/report-format \
  "Tables, with a source link per row." --forever
holo memories list --namespace market-research
# Set MEMORY_ID to the id returned above.
holo memories get "$MEMORY_ID"
holo memories delete "$MEMORY_ID" --yes
```

List responses are paginated; request the next `page` while there are more results. With the CLI, use `--page` and `--size`, and `--json` for the full response. `holo memories set` replaces a note by namespace and key; `update` addresses it by ID. Pass `--forever` to keep it until deletion, `--expires-in MINUTES` to expire it, or neither to use your current privacy setting. Each write resets retention. Pass `-` as the value to read a multiline note from stdin.


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