Files
hermeven/docs/decisions/0002-hermes-runs-api.md
T
DanandClaude Fable 5.2 4687cc0114 First vertical slice: Even client, bridge, contract v1, tests, docs
Client (apps/even-client): pure interaction reducer with generation-based
stale-result rejection, HUD renderer, measured pagination, Even Hub SDK
0.0.16 adapter, bridge HTTP client, phone pairing/status/diagnostics page.

Bridge (services/bridge): device pairing and revocable expiring credentials,
turn engine with idempotent submit, cancel, deadlines and restart recovery,
Hermes Runs API adapter, OpenAI-compatible STT adapter, operator CLI.

Contract (packages/contracts): versioned schemas, types and error codes.

Tests: 122 unit/integration (fakes), 6 simulator scenarios (Even Hub
simulator 0.9.5), 9 scenarios against a real Hermes v0.23.1 gateway with a
stub model. No real STT, real model or physical device has been exercised;
see docs/test-evidence.md and docs/device-test-plan.md.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-18 18:21:49 -08:00

2.9 KiB

0002: Use the Hermes Runs API, not /v1/responses

Status: accepted for the first slice; revisit if the target Hermes differs. Date: 2026-11-18.

Context

The specification says to use the supported authenticated Hermes API, "normally /v1/responses", and to verify cancellation, idempotency and continuity before relying on it. Both were checked against hermes-agent v0.23.1 (docs and source), then against a running gateway.

Need /v1/responses /v1/runs
Start a turn without holding a connection for its whole duration No. Non-streaming blocks until the turn ends; streaming holds an SSE connection. Yes. Returns 202 and a run_id at once.
Read status later, including after a bridge restart Only the finished response by id. GET /v1/runs/{id}.
Cancel No endpoint. Only dropping a streaming connection interrupts the agent. POST /v1/runs/{id}/stop; status settles as cancelled.
Idempotent create Yes, with replay rules that depend on the response store. Yes: durable reservation, 24-hour retention, identical retry returns the same run_id.
Approval-required visible Not as a pollable state. waiting_for_approval.
"Outcome unknown" visible 409 unknown_execution on retry. unknown status.
Continuity previous_response_id or conversation. session_id (loads that session's transcript).

Decision

One adapter (services/bridge/src/hermes/runsAdapter.ts) using POST /v1/runs, GET /v1/runs/{id} and POST /v1/runs/{id}/stop.

  • Continuity: each Hermeven conversation owns one bridge-generated Hermes session_id (hermeven-<uuid>). It is never accepted from, or shown to, a client.
  • Idempotency: Idempotency-Key: hermeven-turn-<request id>. The exact request body is persisted before the first attempt so a retry is byte-identical, and erased once the run id is stored.
  • The bridge never calls the approval endpoint.

Verified

Against a real gateway with a stub model: admission, identical replay (Idempotency-Replayed: true), 409 on a changed body, session continuity (the model received both user turns), stop settling as cancelled, and re-attachment after a bridge restart.

Not verified

waiting_for_approval, unknown, interrupted and the stopped-short (completed: false) shape are implemented from the source and exercised only against the test fake, because the stub model calls no tools. They need a run against a real model with a tool that requires approval.

Consequences

  • Polling adds up to one poll interval (500 ms by default) of latency to every answer.
  • No token streaming to the HUD. Acceptable: the HUD shows whole pages, and streaming through the Even WebView is undocumented.
  • If the target Hermes runs without the durable run ledger, the idempotency guarantee weakens. The bridge should check /v1/capabilities runs_idempotency.durable at startup; that check is not implemented yet.