Files
nousresearch--hermes-agent/website/docs/user-guide/messaging/raft.md
T
wehub-resource-sync b4fbd6fe9f
Deploy Site / deploy-vercel (push) Has been skipped
Deploy Site / deploy-docs (push) Has been skipped
Build Skills Index / build-index (push) Has been skipped
CI / Deny unrelated histories (push) Has been skipped
CI / Detect affected areas (push) Successful in 27m35s
CI / OSV scan (push) Failing after 4s
CI / Build&Test Docker image (push) Successful in 9s
CI / Supply-chain scan (push) Has been skipped
CI / Lint Docker scripts (push) Failing after 5m13s
CI / Check contributors (push) Failing after 12m8s
CI / Docs Site (push) Failing after 12m8s
CI / TypeScript (push) Failing after 12m8s
CI / Python lints (push) Failing after 12m9s
CI / Python tests (push) Failing after 12m9s
CI / Check uv.lock (push) Failing after 23m22s
CI / CI timing report (push) Has been cancelled
Build Skills Index / trigger-deploy (push) Has been cancelled
CI / All required checks pass (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 11:56:03 +08:00

3.2 KiB

sidebar_position, title, description
sidebar_position title description
19 Raft Connect Hermes Agent to Raft as an external agent via wake-channel bridge

Raft Setup

Hermes connects to Raft as an external agent through a local wake-channel bridge. The adapter starts a loopback HTTP endpoint that receives content-free wake hints from the bridge, then injects them into the Hermes gateway session pipeline. The agent reads and sends messages through the Raft CLI — the adapter never touches message bodies or delivery cursors.

:::info Division of Labor

  • The bridge owns: wake-hint consumption, dedup, backoff, reconnection, at-least-once delivery, and proof logging.
  • The Hermes adapter owns: a localhost wake endpoint and injecting a short notice into the agent's context.
  • The agent owns: pulling messages (raft message check), replying (raft message send), and all other Raft interactions via the CLI.

The adapter holds no Raft credentials — only a per-session shared token for localhost auth between the bridge and the endpoint. :::


Prerequisites

  • A Raft workspace where you can create an External Agent
  • The Raft CLI installed and logged in to that External Agent profile
  • aiohttp — Python package (included in Hermes [all] extras)

In Raft, open the Agents menu, create an External Agent, and follow the setup card to install the Raft CLI and log in the agent profile. Once the agent is created, Raft shows a Hermes setup guide with the environment variables and configuration needed to start the gateway.


Setup

Add to ~/.hermes/.env:

RAFT_PROFILE=your-agent-profile

That's it — the adapter auto-enables when RAFT_PROFILE is set. It generates a per-session bridge token, picks an ephemeral port, and spawns the bridge child process automatically when the gateway starts.


How It Works

Raft Server → Bridge (wake-hints SSE) → POST /wake → Hermes Adapter → Agent context
Agent → raft message check → Raft Server (message bodies)
Agent → raft message send → Raft Server (replies)
  1. The Raft server sends wake hints to the bridge process via SSE.
  2. The bridge forwards each hint as a POST /wake to the adapter's loopback endpoint.
  3. The adapter validates the bridge token, verifies the payload is content-free, and injects a wake notice into the Hermes session.
  4. The agent sees the wake notice and uses the Raft CLI to read messages and reply.

Wake payloads are content-free by contract — they carry metadata (event ID, message ID, timestamps) but never message bodies, channel names, or sender identities. The adapter rejects any payload containing content-shaped fields (text, body, content, messages, etc.).


Bridge

The adapter automatically spawns raft agent bridge as a child process, passing the endpoint URL and token. The bridge connects to the Raft server using the configured profile and begins forwarding wake hints. It is terminated when the gateway shuts down.


Environment Variables

Variable Description Default
RAFT_PROFILE Raft agent profile slug — auto-enables the adapter when set (required)