hermes-acp-http
Streamable HTTP + WebSocket transport for Hermes Agent’s ACP interface.
Hermes ships an ACP (Agent Client Protocol) server over stdio only
(hermes-acp). This Rust sidecar exposes that same interface over the ACP
HTTP transport — Streamable HTTP and WebSocket — with one /acp/<profile>
endpoint per Hermes profile, so ACP-compatible clients (Zed, acp-ui,
vscode-acp, …) can reach Hermes over HTTP/2.
The bridge is deliberately thin: it depends only on Hermes’ stable public
contracts (the hermes-acp command, the ACP stdio wire protocol, and the
HERMES_HOME profile environment), never on Hermes internals. Upgrading
Hermes does not require touching this binary; the --probe self-check exists
to catch a broken backend early with a precise diagnostic.
Architecture
ACP client (HTTP/2)
│ GET /acp/<profile> → WebSocket upgrade | SSE (connection- + session-scoped)
│ POST /acp/<profile> → initialize:200+Acp-Connection-Id / others:202
│ DELETE /acp/<profile> → terminate connection
▼
[hermes-acp-http] Rust binary, ~5–15 MB RSS, single long-lived process
└─ agent-client-protocol-http::AcpHttpServer (official ACP HTTP/WS server)
└─ agent factory → agent-client-protocol::AcpAgent
└─ spawns `hermes-acp` per connection, pipes stdio
└─ one AcpHttpServer router per profile (own ConnectionRegistry)
└─ --probe: spawn backend + ACP initialize per profile, report health
▼ spawn (env HERMES_HOME=<profile home>)
hermes-acp (Python backend, not counted in bridge RSS)
Why one server instance per profile: the ACP HTTP server’s agent factory
takes no arguments, so per-profile behavior is selected by giving each
profile its own sub-router with its own HERMES_HOME-pinned backend command.
Each ACP connection owns one hermes-acp subprocess (ACP is single-connection
per process — it cannot be re-initialized), so the backend lifecycle is
“spawn on connect, tear down on disconnect”, matching Hermes’ own
per-profile gateway model.
Build
cargo build --release
# binary at target/release/hermes-acp-http
Run
hermes-acp-http \
--host 127.0.0.1 --port 8123 \
--hermes-acp hermes-acp \
--profile default=$HOME/.hermes \
--profile work=$HOME/.hermes/profiles/work
# diagnostics: per-profile backend health (exit 0 = all ok)
hermes-acp-http --probe --hermes-acp hermes-acp \
--profile default=$HOME/.hermes
Endpoints: GET /health, and per profile GET|POST|DELETE /acp/<name> plus
WebSocket upgrade on the same path.
Via Hermes’ supervisor
When the binary is on PATH (or --binary is passed), the Hermes CLI can
manage it:
hermes acp-http start --port 8123
hermes acp-http status
hermes acp-http logs --follow
hermes acp-http stop
hermes acp-http run --port 8123 # foreground (WSL/Docker)
The supervisor spawns the sidecar detached, writes a pid file and log under
~/.hermes/logs/, and stops it with SIGTERM (graceful) + SIGKILL fallback.
Upgrade resilience
The bridge consumes three stable contracts and nothing else:
| Contract |
Where |
Failure mode handled |
hermes-acp command |
Hermes console entry point |
--probe reports “failed to spawn”; supervisor configurable fallback command |
| ACP stdio protocol |
agentclientprotocol.com |
version negotiated in initialize; --probe surfaces protocol mismatch |
HERMES_HOME env |
Hermes profile mechanism |
bad home surfaces as backend initialize failure in --probe |
Hermes upgrades change the backend process only; the bridge does not need to
follow unless the ACP protocol itself changes.
Notes
- The ACP HTTP transport is a draft (RFD “Streamable HTTP & WebSocket”); this
bridge tracks the official
agent-client-protocol Rust SDK’s implementation.
- Streamable HTTP requires HTTP/2. Terminate HTTP/2 at a proxy (e.g. Caddy /
nginx h2) or run the server behind a TLS terminator; plain HTTP/1.1 and
WebSocket still work for development.
- No HTTP-level authentication is added; ACP
authenticate passes through
unchanged.
License
MIT. This project depends on the official
agent-client-protocol / agent-client-protocol-http Rust SDK (Apache-2.0)
and the axum/tokio ecosystem (MIT/Apache-2.0); their notices remain in force
for those components.
评论