# 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-`). It is never accepted from, or shown to, a client. - Idempotency: `Idempotency-Key: hermeven-turn-`. 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 (150 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.