Skip to content
Kaiov0.8.0

Hermes Agent

A self-hosted agent is a long-running container with secrets, a state directory it writes to constantly, and an image that moves fast. That is a stack like any other, and Kaio gives it the same treatment: secrets masked, every change versioned, the image digest watched, the data carried along when the stack moves.

This example deploys Hermes Agent from Nous Research in gateway mode, the long-lived process that answers on Telegram, Discord, Slack and the other platforms it supports. Its model is an open one, served by Ollama in the same stack: no API key, no account, nothing leaves the host.

A host sized for Kaio alone is too small for this example, and the failures do not say so. Check it has at least:

Resource Minimum Why
CPU 2 cores the Compose file caps Hermes at cpus: "2.0", and Docker refuses a cap above the cores it sees
Memory 12 GB about 8 GB for Ollama with the model and the 64K window, up to 4 GB for Hermes
Disk 15 GB free 5.1 GB for the Ollama image, 3.3 GB for Hermes, 2.5 GB for the model, and room for sessions
GPU none everything runs on the CPU, slowly; a GPU only makes it faster
services:
ollama:
image: docker.io/ollama/ollama:${OLLAMA_TAG:-latest}
restart: unless-stopped
environment:
- OLLAMA_CONTEXT_LENGTH=65536
- OLLAMA_FLASH_ATTENTION=1
- OLLAMA_KV_CACHE_TYPE=q8_0
volumes:
- ollama:/root/.ollama
hermes:
image: docker.io/nousresearch/hermes-agent:${HERMES_TAG:-stable}
command: ["gateway", "run"]
restart: unless-stopped
shm_size: 1g
environment:
- API_SERVER_ENABLED=true
- API_SERVER_HOST=0.0.0.0
- API_SERVER_KEY=${API_SERVER_KEY}
- HERMES_DASHBOARD=1
- HERMES_DASHBOARD_BASIC_AUTH_USERNAME=${DASHBOARD_USER}
- HERMES_DASHBOARD_BASIC_AUTH_PASSWORD=${DASHBOARD_PASSWORD}
- HERMES_DASHBOARD_BASIC_AUTH_SECRET=${DASHBOARD_SECRET}
ports:
- "127.0.0.1:8642:8642"
- "9119:9119"
volumes:
- hermes-data:/opt/data
depends_on:
- ollama
deploy:
resources:
limits:
memory: 4G
cpus: "2.0"
volumes:
ollama:
hermes-data:
  • Ollama is not published at all: Hermes reaches it on the stack’s network as http://ollama:11434, and nothing else on the host can.
  • OLLAMA_CONTEXT_LENGTH=65536 is not a tuning knob. Hermes refuses a model with less than 64K of context, its own system prompt is close to 12,000 tokens, and Ollama otherwise loads the model with 4,096, so the first message fails with exceeds the available context size. The two lines under it keep that window in memory at half the cost.
  • /opt/data holds everything Hermes keeps: config.yaml, sessions, skills and memories, and ollama the models. Named volumes rather than bind mounts are what let stack copy --with-volumes carry them to another server.
  • Port 8642 is the gateway’s OpenAI-compatible API and health endpoint. It stays on the loopback; drop the ports: and the three API_SERVER_* lines if only the messaging platforms need to reach the agent.
  • Port 9119 is the web dashboard, supervised in the same container as the gateway once HERMES_DASHBOARD=1 is set. It is published on every interface of the host, behind the login Hermes enforces.
  • shm_size is for the browser tools, which run Chromium.
HERMES_TAG=stable
OLLAMA_TAG=latest
API_SERVER_KEY=generate-with-openssl-rand-hex-32
DASHBOARD_USER=admin
DASHBOARD_PASSWORD=generate-with-openssl-rand-hex-32
DASHBOARD_SECRET=generate-with-openssl-rand-hex-32

API_SERVER_KEY ends in _KEY, and the other two name a password and a secret, so Kaio flags all three as secrets: masked in stack env ls, never returned by the API, shown as •••••• (unchanged) in the web dialog. DASHBOARD_SECRET signs the dashboard’s sessions, so a restart does not log you out. Hermes refuses an API_SERVER_KEY or a DASHBOARD_SECRET shorter than 16 characters. A short secret does not say so: the dashboard loops on no auth providers are registered, as if the variables were missing.

Terminal window
kaio-cli stack deploy hermes ./compose.yml --env-file .env
kaio-cli stack ls
kaio-cli stack logs hermes --follow

From the web UI, + STACK, the Compose file in the editor and Paste .env under it do the same in one step.

Pull the model from a shell in the ollama container. Qwen3 4B Instruct is small, calls tools, and holds the 64K window Hermes asks for:

Terminal window
kaio-cli container ls
kaio-cli container shell <ollama-container>
ollama pull qwen3:4b-instruct-2507-q4_K_M
ollama list

The name ollama list prints is the one Hermes must ask for, tag included. Hermes answers HTTP 404: model '...' not found both when the name is wrong and when Ollama cannot fit the model in memory, so check the name first and the host’s free memory second.

Then, from a shell in the hermes container:

Terminal window
kaio-cli container shell <hermes-container>
hermes config set model.provider ollama
hermes config set model.base_url http://ollama:11434/v1
hermes config set model.default qwen3:4b-instruct-2507-q4_K_M

They land in /opt/data/config.yaml, in the volume, so they survive an update and a copy. The gateway reads them on the next message, with no restart.

Call it hermes, never /opt/hermes/.venv/bin/hermes. The shell is root, and hermes on the PATH is a wrapper that drops to the hermes user before writing to /opt/data. The full path skips it, leaves root-owned files in the volume, and on its next restart the gateway loops on install state is not writable by this user.

The model runs on the CPU when there is no GPU, so do not expect a first answer at once: Hermes’s system prompt alone is close to 12,000 tokens to read. With an NVIDIA GPU, give it to the ollama service as the Open WebUI and Ollama example does.

The messaging platforms, and anything else the example leaves out, are set by the Hermes setup wizard in the same shell:

Terminal window
hermes setup

Then restart the stack so the gateway reads what the wizard wrote:

Terminal window
kaio-cli stack restart hermes

The dashboard is the agent in a browser: a chat with it, its sessions, files, skills, cron jobs, MCP servers and configuration, and the gateway with a restart button. Whoever signs in drives the agent and every tool it holds.

Open http://<host>:9119 from any machine that reaches the host and sign in with DASHBOARD_USER and DASHBOARD_PASSWORD. Every page and every API route asks for that session, except /api/status, which tells anyone who reaches the port the Hermes version and whether the gateway is up.

The Hermes Agent dashboard on its Chat page: the menu on the left from Chat to Config, the gateway running underneath, the agent's banner listing its tools and skills in the middle, and the model picker with New chat on the right.
Signed in as admin: the agent's terminal in the page, with its code execution, file and browser tools one prompt away.

Over plain HTTP the password and the session cross the network in clear, which a home network may accept and the internet does not. Beyond the local network, publish 127.0.0.1:9119:9119 instead and serve the dashboard through a reverse proxy with TLS, as you would Kaio. Hermes itself says its password login is not meant to face the internet alone.

The login is not optional. Inside the container the dashboard listens on 0.0.0.0, and without the three HERMES_DASHBOARD_BASIC_AUTH_* variables Hermes refuses to start it:

Refusing to bind dashboard to 0.0.0.0

The supervisor still reports the service as started and the container stays up, so a dashboard that does not answer is one to look for in kaio-cli stack logs hermes, not in the stack status.

To chat with Hermes from a UI you already run, put Open WebUI in front of the gateway’s API. The 8642 the host publishes is on its loopback, out of reach of another container, so the open-webui service joins the network of the hermes stack instead:

services:
open-webui:
networks:
- default
- hermes
networks:
hermes:
name: hermes_default
external: true

Then, in Open WebUI under Admin Settings, Connections, add an OpenAI connection to http://hermes:8642/v1 with API_SERVER_KEY as its key, and pick the hermes-agent model. Deploy the hermes stack first: the network is its own, and the other stack will not come up without it.

Terminal window
kaio-cli stack check-update hermes # did the stable tag move?
kaio-cli stack update hermes # pull and recreate, config migrates itself
kaio-cli stack scan hermes # CVEs of the image, with Trivy
kaio-cli stack env set hermes HERMES_TAG=main
kaio-cli stack apply hermes # recreate with the pending variables
kaio-cli stack versions hermes
kaio-cli stack rollback hermes 1 # compose file and variables, together

A rollback restores the Compose file and its variables, not the volume: what the agent learned stays where it is.

Terminal window
kaio-cli stack copy hermes --to prod-02 --with-volumes

The copy lands stopped, with its history, its variables and both volumes, the model included, so nothing is pulled again. Start it there once the source is stopped:

Terminal window
kaio-cli stack pause hermes
kaio-cli node prod-02 run stack restart hermes

An agent can also manage the host itself through Kaio’s MCP server: point Hermes, or any MCP client, at /mcp with a read credential to let it watch stacks, or write to let it deploy them. There is deliberately no shell tool.

Kaio, built by Régis Gaidot