Skip to main content
Glama
codex-hermes-a2a-bridge

codex-hermes-a2a-bridge

by phamviet86

Codex Hermes A2A Bridge

A local bridge so Codex can be the “front desk”: Codex calls MCP tools over stdio, the bridge turns requests into A2A v1.0/JSON-RPC to the Hermes profile default, then keeps conversation/task mapping in SQLite. Hermes remains the “brain” that runs the agent loop, memory, skills, tools, and internal orchestration.

Current version: v0.1.1. Only loopback endpoints are bound/called; there are no tools for model switching, plugins, configuration, updates, a shell, or controlling the Hermes service.

Independent project: this is independent community software, not an official product, not sponsored, and not representative of Nous Research/Hermes Agent or OpenAI/Codex. Brand names are used only to describe interoperability.

Architecture

Codex client --MCP stdio--> MCP server --> bridge core --> Hermes A2A :9900
                                      \--> SQLite context/task mapping
  • Python 3.11 and a dedicated venv, not Hermes' venv.

  • Official Python MCP SDK, httpx async, Pydantic, and SQLite stdlib.

  • Each conversation_key opens a map entry to a Hermes contextId; subsequent turns reuse that mapping.

  • Original prompts are not persisted; the bridge stores fingerprint, route, state, result, and minimal errors.

Related MCP server: Hermes Bridge

Requirements and quick setup

  • Python 3.11.

  • Hermes Agent 0.20.5 with the A2A gateway running on loopback.

  • A Codex client with MCP stdio support.

cd /absolute/path/to/codex-hermes-a2a-bridge
python3.11 -m venv .venv
.venv/bin/python -m pip install -e .
.venv/bin/codex-hermes-a2a-bridge doctor

Contributors can install additional testing tools with python -m pip install -e '.[dev]'. See .env.example for overrides; do not commit a real .env file.

Safe default configuration:

Environment variable

Default

Meaning

HERMES_A2A_ENDPOINT

http://127.0.0.1:9900

A2A root resource; only loopback URLs are accepted.

HERMES_A2A_TOKEN

Empty

Bearer token read from the environment, never through tool arguments.

HERMES_BRIDGE_STATE_PATH

~/.local/state/codex-hermes-a2a-bridge/state.sqlite3

SQLite file mode 0600.

HERMES_BRIDGE_DEFAULT_TIMEOUT

60

Default timeout, clamped to 300 seconds maximum.

HERMES_BRIDGE_AUTO_WAIT

15

How long auto waits before returning the task handle.

HERMES_BRIDGE_SYNC_WAIT

30

Inline wait limit for sync; after that it returns a handle and correlation continues.

HERMES_BRIDGE_CORRELATION_TIMEOUT

300

Lifetime of the SSE worker to keep the A2A task ID/result after the initial timeout.

HERMES_A2A_CONVERSATION_DIR

~/.hermes/a2a_conversations

Read-only fallback when the in‑memory TaskStore is gone.

HERMES_BRIDGE_MAX_TURNS

5

Turn budget/context to avoid agent loops.

HERMES_BRIDGE_MAX_CONCURRENCY

4

Number of concurrent outbound calls.

Enabling Hermes A2A and registering Codex

On initially installed Hermes 0.20.5:

hermes plugins enable a2a-platform --no-allow-tool-override
hermes config set gateway.platforms.a2a.enabled true
hermes gateway run --no-supervise

When the foreground process, a user service can be installed (no sudo):

hermes gateway install --start-now --start-on-login

Register the bridge in Codex shared MCP config:

codex mcp add codex-hermes-a2a-bridge -- \
  /absolute/path/to/codex-hermes-a2a-bridge/.venv/bin/codex-hermes-a2a-bridge serve
codex mcp get codex-hermes-a2a-bridge

A new Codex client must be opened/restarted to pick up the fresh entry. MCP stdio writes only protocol frames to stdout; diagnostics go to stderr.

Seven MCP tools in v0.1

Tool

Purpose

hermes_status

Health, Agent Card summary, DB counts, and connection.

herms_chat

Create/continue brings conversation; auto, sync or async; profile default.

herms_task_get

Reconcile state, result, error, or input_required.

herms_task_list

List durable bridge tasks by conversation / state.

herms_task_wait

Wwait on an active stream, subsub SSE into SSE, then poll fallback.

herms_task_cancel

Sent best-effort cancel; does not claim computation stopped.

herms_contexts

List/inspect/close mappings; close does not delete Hermes data.

The set of four MCP operations originally described in the study (discover, send, get, continue) is not full A2A. v0.1 folds these into seven high-level tools for conversation/task work; lower-level A2A operations such as push-notification CRUD and Hermes administration are not expё.

Example workflow

  1. Codex calls OM hermes_status.

  2. Codex calls hermes_chat(message=..., conversation_key=<stable>, mode="auto").

  3. If the task is still running, use hermes_task_wait or hermes_task_get; do not blindly resend after an ambiguous timeout.

  4. If neds_input=true, ask the user, then call hermes_chat with your conversation_key / context_id.

  5. The next conversation line continues with the same mapp; hermes_contexts(action="close") only closes the bridge mapping.

For tasks with side effects, provide an idempotency_key. Hermes 0.20.5 does not have wire-level idempotency, so the bridge will not retry mutation sends when the result transport is unclear.

From v0.1.1, all three modes use SendStreamingMessage to get the A2A task ID from the very first event. sync still waits inline up to 30 seconds (or timeout whenever set lower); the stream remains alive until correlation timeout. For older records in outcome_unknown that lack an A2A ID, hermes_task_get / hermes_task_wait first try ListTasks(contextId) and then read Hermes' official conversation persistence. Recovery attaches a result only when there is exactly one local unresolved task and exactly one remote/disk candidate; ambiguous cases remain unchanged, with no resdend and no guessing. The disk fallback has no A2A state, so it issues a warning and treats an already persisted agent reply as completed.

Testing and operations

.venv/bin/pytest --cov=codex_hermes_a2a_bridge --cov-report=term-missing
.venv/bin/codex-hermes-a2a-bridge doctor
.venv/bin/codex-hermes-a2a-bridge smoke \
  'Reply with exactly MY_MARKER and nothing else.' \
  --conversation-key manual-smoke
.venv/bin/python scripts/live_check.py manual-smoke

Clock pytest uses a fake A2A server on an ephemeral loopback port and does not require a real Hermes. doctor and live_check.py are read-only. A smoke command sends a real task; run it only actively with g harmless content.

Security and privacy

  • v0.1.1 rejects endpoints and Agent Card URLs that are not loopback, does not follow redirects, and does not accept tokens through MCP tool arguments.

  • SQLite is stored by default outside the source tree with mode 0600; it holds mapping, fingerprint, state, result/artifact and minimal errors. Results can contain sensitive data, so apply an appropriate retention/change &backup policy.

  • Original prompts are not persisted by bridge; Hermes may still write its own conversation / audit log. Fallback recovery only reads from the configured Hermes conversation store.

  • The MCP server must be run by a trusted user; the seven tools can trigger Hermes, and Hermes may use skills / tools with side effects. Use an idempotency_key and do not resnd blindly when in outcome_unknown.

  • Report vulnerabilities via [SECURITY.MD]. Do not post tokens, transcripts, or SQLite in issues.

Guarantees and upstream guarantees

The bridge guarantees a loopback policy, a durable local mapping, no retried sent send after ambiguity, and honest cancel semantics. The bridge does not guarantee that HProc Hermes will stop computation, that token‑level streaming is implemented, that wire‑level idempotency exists, or that tasks survive a Hermes restart.

Hermes 0.20.5 uses an in‑memory TaskStore, lifecycle SSE and protocol cancel does not abort the current turn. The bridge's conversation‑store recovery is a read‑only fallback, not a substitute for the upstream's durable task store. Verified details are in the Hermes A2A reference.

Troubleshooting

  • a2a_unreachable: run hermes gateway status, check the card at http://127.0.1:9900/.well-known/agent-card.json.

  • A2A plugin enabled but no port: check hermes config get gateway.platforms.a2a.enabled, then restart the gateway.

  • Codex doesn't Pages or lists not present: run codex mcp get codex-herMes-a2a-bridge, then use a new Codex process/client.

  • outcome_unknown: call hermes_task_get/`hermes; if still ambiguous, do not resend a task with side effects; ask user.

  • turn_budget_exeeded: close the map and create a new conversation; do not reset budget/changes just to let the agent loop on forever.

  • Hermes 0.20.5 loses the A2A TaskStore on restart; bridge keeps local task/result but remote refresh may say the task no longer exists.

  • On macOS currently theif launchctl bootstrap returns exit 5, Hermes uses detached fallback: it works but does not auto-start/auto-restart. Use hermes gateway status to confirm.

Rollback

See scripts/rollback.sh. The script defaults to only printing the plan. scripts/rollback.sh --apply strips the exact MCP entry and the A2A configuration/plugin, but keeps the gateway service because the service may serve another platform. Only add --include-gateway-service if a gateway is installed solely for this rollout. Source, .venv, SQLite, and Hermes transcripts remain in place.

Scoped backups are created next to the config file and suffixed with .pre-codex-hermes-a2a-bridge-v0.1.bak; no full automatic restore is done, because it could overwrite fresh user changes.

Documentation

Canonical sources: OpenAI Codex MCP, Hermes A2A guide,, NousResearch/hermes-agent. Where they differ, the local Hermes 0.20.5 commit d5a... is authoritative.

Available Tools

7 tools
hermes_chatB
Destructive

Start or continue a Hermes conversation; returns a durable bridge task and A2A context mapping.

Inputs: message (required), mode, origin, profile, +5 more. Returns: object

hermes_contextsA
Idempotent

List, inspect, or close bridge-owned conversation/context mappings; close never deletes Hermes data.

Inputs: limit, action, context_id, conversation_key. Returns: object

hermes_statusA
Read-onlyIdempotent

Check bridge persistence, Hermes health, connectivity, and a concise Agent Card summary.

Inputs: no named parameters. Returns: object

hermes_task_cancelA

Request task cancellation; response is explicit that Hermes may continue underlying computation.

Inputs: task_id (required), timeout. Returns: object

hermes_task_getB

Get a task/result; optionally acknowledge a consumed result_id with expected_origin verification.

Inputs: task_id (required), refresh, expected_origin, acknowledge_result_id. Returns: object

hermes_tasks_listA
Read-onlyIdempotent

List durable bridge tasks, optionally filtered by conversation and bridge state.

Inputs: limit, status, conversation_key. Returns: object

hermes_task_waitA
Read-onlyIdempotent

Wait for task progress/result using the active stream, A2A subscribe, then polling fallback.

Inputs: task_id (required), timeout. Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.8/5.0

    Scored across 7 tools

    Disambiguation4/5

    Most tools have clearly distinct purposes: chat/context management, task retrieval, cancellation, listing, waiting, and bridge status. The main possible confusion is between hermes_task_get and hermes_task_wait, since both can surface task results, but their descriptions distinguish immediate retrieval from waiting behavior.

    Naming Consistency4/5

    All tools use the hermes_ prefix and snake_case, which makes the set predictable overall. Minor deviations exist because some names are noun-only (hermes_chat, hermes_contexts, hermes_status) and task/tasks singular-plural usage varies.

    Tool Count5/5

    Seven tools is well-scoped for a bridge server focused on Hermes conversation/context and A2A task lifecycle. Each tool has a distinct operational role, and the set avoids unnecessary surface area.

    Completeness5/5

    The surface covers conversation start/continue, context list/inspect/close, task list/get/wait/cancel, and bridge health/status. Result acknowledgment and origin verification are included in hermes_task_get, so the core A2A bridge lifecycle appears complete.

    Maintenance

    ActivitySlowing
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      C
      quality
      D
      maintenance
      Bridges MCP clients with local Codex CLI to execute autonomous coding tasks, manage threads, and inspect history via SQLite state.
      13
      4
      Apache 2.0
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables MCP clients and external AI supervisors to oversee and steer native Codex sessions through a thin local stdio bridge. It exposes eleven codex_* supervisory tools for tasks such as listing threads, starting turns, observing progress, steering, responding to approvals, interrupting, checkpointing, and rolling over work.
      MIT