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.
Minimum configuration
Section titled “Minimum configuration”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 |
1. Write the Compose file
Section titled “1. Write the Compose file”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=65536is 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 withexceeds the available context size. The two lines under it keep that window in memory at half the cost./opt/dataholds everything Hermes keeps:config.yaml, sessions, skills and memories, andollamathe models. Named volumes rather than bind mounts are what letstack copy --with-volumescarry them to another server.- Port
8642is the gateway’s OpenAI-compatible API and health endpoint. It stays on the loopback; drop theports:and the threeAPI_SERVER_*lines if only the messaging platforms need to reach the agent. - Port
9119is the web dashboard, supervised in the same container as the gateway onceHERMES_DASHBOARD=1is set. It is published on every interface of the host, behind the login Hermes enforces. shm_sizeis for the browser tools, which run Chromium.
2. Write its variables
Section titled “2. Write its variables”HERMES_TAG=stableOLLAMA_TAG=latestAPI_SERVER_KEY=generate-with-openssl-rand-hex-32DASHBOARD_USER=adminDASHBOARD_PASSWORD=generate-with-openssl-rand-hex-32DASHBOARD_SECRET=generate-with-openssl-rand-hex-32API_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.
3. Deploy it
Section titled “3. Deploy it”kaio-cli stack deploy hermes ./compose.yml --env-file .envkaio-cli stack lskaio-cli stack logs hermes --followFrom the web UI, + STACK, the Compose file in the editor and Paste .env under it do the same in one step.
4. Pull a model and point Hermes at it
Section titled “4. Pull a model and point Hermes at it”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:
kaio-cli container lskaio-cli container shell <ollama-container>ollama pull qwen3:4b-instruct-2507-q4_K_Mollama listThe 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:
kaio-cli container shell <hermes-container>hermes config set model.provider ollamahermes config set model.base_url http://ollama:11434/v1hermes config set model.default qwen3:4b-instruct-2507-q4_K_MThey 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:
hermes setupThen restart the stack so the gateway reads what the wizard wrote:
kaio-cli stack restart hermes5. Open the dashboard
Section titled “5. Open the dashboard”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.

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.0The 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: trueThen, 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.
6. Run it day to day
Section titled “6. Run it day to day”kaio-cli stack check-update hermes # did the stable tag move?kaio-cli stack update hermes # pull and recreate, config migrates itselfkaio-cli stack scan hermes # CVEs of the image, with Trivykaio-cli stack env set hermes HERMES_TAG=mainkaio-cli stack apply hermes # recreate with the pending variableskaio-cli stack versions hermeskaio-cli stack rollback hermes 1 # compose file and variables, togetherA rollback restores the Compose file and its variables, not the volume: what the agent learned stays where it is.
Moving it to another server
Section titled “Moving it to another server”kaio-cli stack copy hermes --to prod-02 --with-volumesThe 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:
kaio-cli stack pause hermeskaio-cli node prod-02 run stack restart hermesLetting an agent drive Kaio
Section titled “Letting an agent drive Kaio”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