> ## Documentation Index
> Fetch the complete documentation index at: https://docs.boxlite.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Host your personal agent on BoxLite Cloud

> Deploy Hermes as your cloud agent, give it tasks over HTTPS, and keep its workspace between requests.

**Give your personal agent a home in the cloud.** Deploy Hermes, ask it to create a launch plan, then return with another task that updates the same file. Your agent's Gateway stays available after your local commands finish.

By the end, you will have an authenticated HTTPS endpoint and a plan in the agent's workspace. You can submit more tasks without installing Hermes on your workstation.

![Client tasks reach Hermes in a Cloud box; model requests pass through BoxLite Secret substitution](https://mintcdn.com/boxliteai/T55zNyy-RmFxjFGm/assets/diagrams/cloud-agent-runtime.svg?fit=max\&auto=format\&n=T55zNyy-RmFxjFGm\&q=85\&s=0a7a2a817cf6dc672e20d4e5a0c44a0a)

This guide keeps the box running. Automatic stop and request-triggered wake are optional. For a model that runs outside the box and only needs code execution, use the [Code interpreter quickstart](https://docs.boxlite.ai/cloud/code-interpreter.md).

## 1. Prepare your workstation

You need a [Cloud account](https://app.boxlite.ai) with available balance and capacity, a Cloud API key, Python, and an OpenAI Chat Completions-compatible model provider with tool-call support. All commands below run on your workstation.

Install the CLI and Python SDK:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -fsSL https://sh.boxlite.ai | sh
export PATH="$HOME/.local/bin:$PATH"
python3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade boxlite
```

In the console, create a key under **API Keys**. Read it into your current terminal without saving it in shell history:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
export BOXLITE_REST_URL="https://api.boxlite.ai"
printf 'BoxLite Cloud API key: '
read -rs BOXLITE_API_KEY
printf '\n'
export BOXLITE_API_KEY
```

Use a new local directory for this example's files. Keep them outside Git.

## 2. Create your agent's home

Save `create.py`. Replace `<YOUR_MODEL_HOST>` with the hostname of your model endpoint, such as `api.openai.com`, without a scheme or path.

The prompt reads your real model key locally and supplies it to a host-scoped [Secret](https://docs.boxlite.ai/cloud/secrets.md). Hermes receives a placeholder; the real key does not enter the guest.

```python create.py theme={"theme":{"light":"github-light","dark":"github-dark"}}
import asyncio
from getpass import getpass
import boxlite

async def main():
    runtime = boxlite.Boxlite.rest(boxlite.BoxliteRestOptions.from_env())
    try:
        box = await runtime.create(
            boxlite.BoxOptions(
                image="docker.io/nousresearch/hermes-agent@sha256:a11574b7fe8e1631d7d88d556677dac693bc058abf558cdeb899155688c1bf05",
                cpus=2, memory_mib=4096, disk_size_gb=10,
                auto_stop=0, auto_delete=0, detach=True,
                cmd=["sleep", "infinity"],
                network=boxlite.NetworkSpec(inbound=boxlite.InboundNetworkSpec(mode="enabled")),
                env=[
                    ("SSL_CERT_FILE", "/etc/ssl/certs/ca-certificates.crt"),
                    ("HERMES_GATEWAY_BOOTSTRAP_STATE", "running"),
                ],
                secrets=[boxlite.Secret(
                    name="model",
                    value=getpass("Model provider API key: "),
                    hosts=["<YOUR_MODEL_HOST>"],
                    headers={"Authorization": "Bearer {value}"},
                )],
            ),
            name="personal-agent",
        )
        print(box.id)
        await box.start()
    except Exception as exc:
        # A cold start can time out after Cloud has registered the box.
        if "Timed out waiting for box" in str(exc):
            box = await runtime.get("personal-agent")
            if box is not None:
                print(f"Registered box: {box.id}; continue with configuration below.")
                return
        raise SystemExit(f"{type(exc).__name__}: inspect personal-agent before retrying creation.") from None
    finally:
        runtime.close()

asyncio.run(main())
```

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
python create.py
```

Keep the printed box ID. The box is named `personal-agent`, which the remaining commands use. The script handles a cold-start timeout by checking for the registered box; continue with configuration when it prints `Registered box`. For other failures, use `boxlite inspect personal-agent` before retrying creation.

The box keeps running after your local client exits and retains its files when stopped. You can choose a different [lifecycle policy](https://docs.boxlite.ai/cloud/box-lifecycle.md) later.

> [accordion] How Gateway starts and the workspace survives
>
> The official image supplies the entrypoint and service supervisor. `HERMES_GATEWAY_BOOTSTRAP_STATE=running` enables its managed Gateway on first boot; the saved `sleep infinity` command keeps the container alive without starting a duplicate Gateway. `auto_stop=0` keeps this deployment running; `auto_delete=0` retains its disk when stopped.

## 3. Connect the model and secure Gateway

Save Hermes's native model configuration as `config.yaml`. Set the model ID and API base URL for the same provider whose hostname you used above:

```yaml config.yaml theme={"theme":{"light":"github-light","dark":"github-dark"}}
model:
  provider: custom
  default: <YOUR_MODEL_ID>
  base_url: https://<YOUR_MODEL_HOST>/v1
  api_mode: chat_completions
  key_env: OPENAI_API_KEY
terminal:
  backend: local
```

Generate a separate key for clients calling your agent. This is a **Gateway caller key**, not the model-provider key. Keep this terminal open for the requests below:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
export HERMES_GATEWAY_KEY="$(python3 -c 'import secrets; print(secrets.token_hex(32))')"
(umask 077; cat > gateway.env <<EOF
OPENAI_API_KEY='<BOXLITE_SECRET:model>'
API_SERVER_ENABLED=true
API_SERVER_HOST=0.0.0.0
API_SERVER_PORT=8642
API_SERVER_KEY='$HERMES_GATEWAY_KEY'
EOF
)
chmod 600 config.yaml
boxlite cp config.yaml personal-agent:/opt/data/config.yaml
boxlite cp gateway.env personal-agent:/opt/data/.env
boxlite exec personal-agent -- sh -c \
  'chown 10000:10000 /opt/data/config.yaml /opt/data/.env && chmod 600 /opt/data/config.yaml /opt/data/.env'
boxlite stop personal-agent
```

Run `boxlite inspect personal-agent` until its state is `stopped`, then start it with the saved configuration and register the HTTP port:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
boxlite start personal-agent
boxlite network tunnel personal-agent 8642
```

Copy the returned URL into your terminal:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
export HERMES_URL='<YOUR_TUNNEL_URL>'
curl --fail-with-body --max-time 30 "$HERMES_URL/health" \
  -H "Authorization: Bearer $HERMES_GATEWAY_KEY"
```

If Gateway is still starting, wait a few seconds and repeat this health check. The public tunnel reaches Hermes, while its caller key controls access to tasks. Keep that key private: an authorized caller can ask the agent to use its tools.

## 4. Give your agent its first task

Ask Hermes to create a plan using its tools:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl --fail-with-body --max-time 300 "$HERMES_URL/v1/chat/completions" \
  -H "Authorization: Bearer $HERMES_GATEWAY_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"model":"hermes-agent","messages":[{"role":"user","content":"Use your file or terminal tools to create /opt/data/launch-plan.md with a Markdown heading Launch plan and three unchecked checklist items: Review requirements, Build prototype, Test release. Read the file back and report its contents."}],"stream":false}'
```

Check the actual artifact independently of the agent's reply:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
boxlite exec personal-agent -- cat /opt/data/launch-plan.md
```

You should see:

```markdown theme={"theme":{"light":"github-light","dark":"github-dark"}}
# Launch plan
- [ ] Review requirements
- [ ] Build prototype
- [ ] Test release
```

A successful Gateway response has `finish_reason: "stop"`. Checking the file establishes that the agent used its tools, rather than merely describing a plan.

## 5. Come back with another task

Send a new request to the same endpoint. You do not need to resend the original file or recreate the box:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl --fail-with-body --max-time 300 "$HERMES_URL/v1/chat/completions" \
  -H "Authorization: Bearer $HERMES_GATEWAY_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"model":"hermes-agent","messages":[{"role":"user","content":"Read /opt/data/launch-plan.md using your tools. Mark Build prototype complete and append an unchecked Publish demo item. Preserve the other items. Save the updated file, then read it back and report its contents."}],"stream":false}'
boxlite exec personal-agent -- cat /opt/data/launch-plan.md
```

The same file should now contain:

```markdown theme={"theme":{"light":"github-light","dark":"github-dark"}}
# Launch plan
- [ ] Review requirements
- [x] Build prototype
- [ ] Test release
- [ ] Publish demo
```

**Your cloud agent is ready for more tasks.** Hermes runs inside the box, and the endpoint remains available after your local client exits.

These requests demonstrate **workspace continuity**, not automatic conversation recall. Each request explicitly identifies the file to read. For conversation history and session controls, follow [Hermes's API documentation](https://hermes-agent.nousresearch.com/docs/user-guide/features/api-server).

## 6. Connect your own client

Use an OpenAI-compatible client with these connection settings:

| Setting | Value |
| - | - |
| Base URL | Your tunnel URL followed by `/v1` |
| API key | Your Gateway caller key |
| Model | `hermes-agent` |

Try a read-only follow-up from your application. These clients use the same `HERMES_URL` and `HERMES_GATEWAY_KEY` you set above.

> [tab] Python
>
> Save as `ask_agent.py` and run `python ask_agent.py`. It uses Python's standard library.
>
> ```python ask_agent.py theme={"theme":{"light":"github-light","dark":"github-dark"}}
> import json
> import os
> import urllib.request
>
> request = urllib.request.Request(
>     os.environ["HERMES_URL"].rstrip("/") + "/v1/chat/completions",
>     data=json.dumps({
>         "model": "hermes-agent",
>         "messages": [{"role": "user", "content": "Read /opt/data/launch-plan.md with your tools and list the unfinished items. Do not modify the file."}],
>         "stream": False,
>     }).encode(),
>     headers={
>         "Authorization": "Bearer " + os.environ["HERMES_GATEWAY_KEY"],
>         "Content-Type": "application/json",
>     },
> )
> with urllib.request.urlopen(request, timeout=300) as response:
>     result = json.load(response)
> choice = result["choices"][0]
> if choice["finish_reason"] != "stop":
>     raise RuntimeError(f"Task did not finish: {choice['finish_reason']}")
> print(choice["message"]["content"])
> ```

> [tab] TypeScript
>
> Save as `ask-agent.ts`. Install the runner with `npm install tsx`, then run `npx tsx ask-agent.ts`.
>
> ```typescript ask-agent.ts theme={"theme":{"light":"github-light","dark":"github-dark"}}
> async function main() {
>   const response = await fetch(`${process.env.HERMES_URL!.replace(/\/$/, "")}/v1/chat/completions`, {
>     method: "POST",
>     headers: {
>       Authorization: `Bearer ${process.env.HERMES_GATEWAY_KEY!}`,
>       "Content-Type": "application/json",
>     },
>     body: JSON.stringify({
>       model: "hermes-agent",
>       messages: [{ role: "user", content: "Read /opt/data/launch-plan.md with your tools and list the unfinished items. Do not modify the file." }],
>       stream: false,
>     }),
>     signal: AbortSignal.timeout(300_000),
>   });
>   if (!response.ok) throw new Error(`Gateway returned HTTP ${response.status}`);
>   const result = await response.json();
>   const choice = result.choices[0];
>   if (choice.finish_reason !== "stop") throw new Error(`Task did not finish: ${choice.finish_reason}`);
>   console.log(choice.message.content);
> }
> main().catch(error => { console.error(error); process.exitCode = 1; });
> ```

The client talks to Hermes; Hermes chooses tools and calls its configured model. Keep the provider key in BoxLite Secret.

For a stable named address, add a [domain](https://docs.boxlite.ai/cloud/domains.md). To operate the workspace yourself, use [SSH](https://docs.boxlite.ai/cloud/ssh.md). To investigate a failed task, inspect its response and read `/opt/data/logs/gateway.log` with `boxlite exec personal-agent -- tail -n 50 /opt/data/logs/gateway.log`; do not automatically retry a timed-out task because it may have already changed files.

## Take your agent further

| What you want next | Continue with |
| - | - |
| More CPU or memory for agent tools | [Box sizes](https://docs.boxlite.ai/cloud/box-sizes.md) |
| Control which APIs the agent can access | [Secrets](https://docs.boxlite.ai/cloud/secrets.md) and [network policy](https://docs.boxlite.ai/cloud/network-policy.md) |
| Keep selected files when replacing the agent box | [Volumes](https://docs.boxlite.ai/cloud/volumes.md) |
| Save a prepared environment for another agent | [Checkpoints](https://docs.boxlite.ai/cloud/checkpoints.md) |
| Choose continuous operation or request-triggered startup | [Box lifecycle](https://docs.boxlite.ai/cloud/box-lifecycle.md) and [Hermes wake setup](https://docs.boxlite.ai/cloud/agent-in-box/hermes.md#optional-wake-on-a-request) |
| Deploy another agent runtime | [Manual agent deployment](https://docs.boxlite.ai/cloud/agent-in-box/index.md) |

## Choose how long it runs

Leave the box running for continuous work, or stop it explicitly:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
boxlite stop personal-agent
```

Stopping retains the workspace. Once the state is `stopped`, `boxlite start personal-agent` restarts Gateway from the saved command. Deleting the box removes its files; use a [volume](https://docs.boxlite.ai/cloud/volumes.md) or [checkpoint](https://docs.boxlite.ai/cloud/checkpoints.md) when you need data beyond this box's lifetime.

To stop between requests and wake on access, follow [Hermes: optional wake on a request](https://docs.boxlite.ai/cloud/agent-in-box/hermes.md#optional-wake-on-a-request). This is an optional operating choice, not a requirement for deploying an agent. Retained storage can still incur [charges](https://docs.boxlite.ai/cloud/box-costs.md).

When finished with this example, delete its resources:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
boxlite rm --force personal-agent
rm -f gateway.env
unset HERMES_GATEWAY_KEY
```

To deploy a different runtime, choose [Claude Code, Codex, OpenCode, or Pi](https://docs.boxlite.ai/cloud/agent-in-box/index.md). Their model configuration and external request interfaces differ; use the corresponding deployment guide.


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