Files

12 KiB

name, description, version, author, license, metadata
name description version author license metadata
hermes-a2a Connect Hermes agents over A2A: setup, peers, verify. 1 Hermes Agent MIT
hermes
tags related_skills
a2a
agents
multi-agent
hermes
tailnet
delegation
hermes-agent
termux-go-builds

Hermes A2A (Agent-to-Agent) — connecting agents to each other

A2A is the open Agent2Agent protocol (v1.0) for inter-agent communication. The Hermes A2A plugin is bidirectional:

  • Inbound: your Hermes serves an Agent Card + JSON-RPC 2.0 endpoint (port 9900) → other agents can send you tasks.
  • Outbound: the a2a toolset gives YOUR agent tools to call other agents (a2a_discover, a2a_call, a2a_list, a2a_history, a2a_orchestrate).

Use A2A when crossing process/machine/framework boundaries. For multiple agents on the SAME machine, prefer delegate_task (in-process) or the kanban board.

Docs: https://hermes-agent.nousresearch.com/docs/user-guide/messaging/a2a

When to Use

  • The user wants two Hermes agents (or a Hermes agent and any other agent) to talk to each other, send tasks, or chain multi-agent work across machines.
  • Setting up or debugging an A2A inbound/outbound connection (port 9900, bearer token, peer registration).
  • Deciding between in-process delegate_task/kanban (same machine) vs A2A (crosses process/machine/framework boundaries).
  • Verifying that an A2A peer is actually reachable and answering, not just showing up in tailscale status.

User's peers (this profile)

The user refers to peers by machine name, not by their config key — resolve via a2a_list before calling:

  • blackbook = config key macbook (hostname blackbook.ts.robbis.space) — the browser/computer-use peer (e.g. muting/unmuting the SoundCloud Firefox tab, starting music playback).
  • nas = config key nas (nas.ts.robbis.space). Hosts the WG bot whose kanban board is the „Werkstatt" (setup cards). That board is operator-only via A2A: the peer's A2A sessions carry no kanban/terminal/code-exec/file tools, and the bot's working rules forbid unblocking/moving/completing its cards from a peer message — privilege is recognized only via system-verified Telegram identity, never self-assertion in a peer message. Legitimate start paths on this user's stack: /dispatch in the bot's private Telegram chat, the bot's Werkstatt menu, or on the NAS host itself: hermes kanban unblock <id> / hermes kanban reclaim <id> (needs host access, e.g. SSH).
  • When a resource's home is unknown, check LOCAL first, then fan out. "Start/manage X on agent Y" style requests: check the local kanban boards/profiles before calling peers (a quick hermes kanban boards list + id grep is cheaper than an A2A round-trip and catches the case where X is local). Peers queried about foreign resources need a strict "answer only, create nothing" instruction — otherwise a helpful peer may invent the missing board/card. Peer claims can also contradict each other; the local state is the tie-breaker.

Relay work (user's task → peer executes → peer reports back) is the common pattern here: state provenance explicitly and follow the two relay pitfalls below (security heuristics, consent relay).

Quick setup (verified 2026-10-23)

  1. Enable the platform + toolsets:
    hermes config set gateway.platforms.a2a.enabled true
    hermes tools enable a2a --platform cli
    hermes tools enable a2a --platform a2a     # lets inbound tasks call peers (agent chaining)
    
  2. Tokens & bind (in ~/.hermes/.env — credentials go in .env, never config.yaml). Generate a token: python3 -c "import secrets;print(secrets.token_hex(24))".
    A2A_BEARER_TOKEN=<64-hex>
    A2A_HOST=0.0.0.0                 # widens bind ONLY when a token is set (security invariant)
    A2A_PORT=9900
    A2A_PUBLIC_URL=http://<node>.<tailnet-domain>:9900     # routable URL the Agent Card advertises
    A2A_AGENT_NAME=<name>
    
    Security model: no token ⇒ binds 127.0.0.1 only. Remote exposure requires a bearer token AND A2A_HOST. Per-peer alt: A2A_PEER_TOKENS="alice:tok1,bob:tok2".
  3. Register peers (each peer must point at the OTHER's public URL + same token):
    hermes config set a2a_agents.<peer>.url "http://<peer>.<domain>:9900" --force
    hermes config set a2a_agents.<peer>.auth.type bearer --force
    hermes config set a2a_agents.<peer>.auth.token "<same A2A_BEARER_TOKEN>" --force
    
  4. Start the gateway in its own tmux session (survives session churn):
    tmux new-session -d -s gateway 'env TERM=xterm hermes gateway run 2>&1 | tee -a ~/.hermes/logs/gateway-run.log'
    

Verification (do this — don't trust the config)

  • Agent Card: curl -sS http://127.0.0.1:9900/.well-known/agent-card.json → JSON with name and url.
  • Inbound task:
    curl -sS -X POST http://127.0.0.1:9900/ -H 'Authorization: Bearer <tok>' \
      -d '{"jsonrpc":"2.0","id":1,"method":"SendMessage","params":{"message":{"messageId":"m1","role":"ROLE_USER","parts":[{"text":"hi"}]}}}'
    
  • The audit log is the source of truth: ~/.hermes/a2a_audit.jsonl records inbound/outbound task + reply even when the HTTP response is lost. If you see an inbound and a matching outbound line, the round-trip worked.

Pitfalls (hit in-session)

  • curl timeout ≠ failure. A self-test that times out (e.g. -m 40) can still have a COMPLETE audit-log entry (inbound task + outbound reply). Check a2a_audit.jsonl before concluding A2A is broken. A long LLM reply easily exceeds a short curl timeout; the server logs BrokenPipeError after the client gave up — that is a client-side timeout, not a server failure.
  • Same rule for a client-timed-out a2a_call — with one twist. A client timeout does not mean the task wasn't delivered: a2a_list (outbound count rose) and the conversation's a2a_history prove delivery if your message is listed there. But unlike the audit-log curl case, the lost reply is usually LOST — the peer may still finish processing with no one listening for the answer. If the result matters, follow up with a new call that references the original task; don't blindly re-send the same text. A follow-up ping to a peer that is still executing a long task times out the same way — expected, not a second failure: one follow-up is enough, confirm both outbound entries in the audit log, do not spam a third ping, and report 'delivered, peer still working' to the user. A timed out error means the peer server is UP (connection established, reply just took longer than the client waits); a DOWN peer returns a connection error instead.
  • Peer agents have their own security heuristics. A peer LLM can refuse a relayed instruction containing a URL or auth token as "untrusted external input" (because it arrived from another agent, not the user). Recover by stating provenance explicitly (direct request from the user, the user's own service/device) AND re-instructing with a concrete action verb ("call this endpoint and report the response body") instead of "follow this URL".
  • Consent relay (standing user rule). When relaying a user's task that may require the user's consent mid-execution, explicitly instruct the peer: do not guess and do not act silently — send the exact question (what it wants to do and why consent is needed) back to the ORIGIN agent and wait for the answer. The origin agent asks the user in the user's own chat and feeds the answer back. This is this user's explicit instruction for cross-agent work. Same discipline for relayed commands containing an unfilled placeholder (e.g. --user USERNAME): never resolve or guess the value before relaying — forward the command as-is, instruct the peer to return the verbatim error (unknown user) rather than substituting a value, and ask the user whether the placeholder was literal or meant to be filled.
  • Probe what the peer's session can actually do before promising the action. A peer's A2A toolset is per-instance and can be far narrower than the Agent Card's advertised skills (a card may list kanban/browser/etc. while the A2A session has none of them — "dauerhaft deaktiviert" by the operator). One short call asking "list exactly the tools bound to this session" is decisive and cheap. Distinguish its two outcomes: timed out = peer is busy/working (the existing follow-up-once rule applies), vs. a normal reply saying "this session has no X tool" = a hard boundary. When the peer states an explicit policy boundary (no card-move, no shell, identity-gated privilege), respect it and find the operator's canonical path (bot menu, host CLI over SSH) — do NOT route around it with other peer tools (e.g. the peer's cronjob tooling), even if technically reachable: that policy is the peer's security model, not a tech bug.
  • Set the token BEFORE widening the bind. A2A_HOST=0.0.0.0 only widens the bind when A2A_BEARER_TOKEN is set; without the token the server stays on 127.0.0.1 and remote peers get connection-refused.
  • Peers must be running too. A node showing in tailscale status --peers is NOT the same as its A2A server being up. Verify each peer's card first: curl -m 5 http://<peer>.<domain>:9900/.well-known/agent-card.json. A third failure class: a2a_call dying with urlopen error / No address associated with hostname — the peer's tailnet-split-DNS name (e.g. *.ts.robbis.space) does not resolve at all from the local device, distinct from a connection refused: the peer host is down or this device is off the tailnet / its split DNS. Diagnose by resolving the peer name next to a name that must resolve (e.g. the public VPN domain) from the shell before retrying; if only the tailnet-scope name fails, stop retrying — the host or tailnet must be up first, and the user knows which.
  • Token must match on BOTH sides. A mismatch does NOT always return HTTP 401 — verified in-session: the peer answered HTTP 200 with a JSON-RPC error body {"code": -32050, "message": "unauthorized"}. Treat -32050 unauthorized as the token-mismatch signature (card fetch needs no auth, so a 200 card + -32050 task call = network fine, auth wrong).
  • a2a_agents is a custom top-level key — hermes config set warns "not a recognized config key"; use --force. It works and is read by the plugin.
  • Magic DNS may not exist for the tailnet. <node>.<zone> URLs (in A2A_PUBLIC_URL, peer urls, and the advertised Agent Card url) only resolve if the control server has Magic DNS enabled for that zone. Symptom that bites: even your OWN node's advertised URL fails with curl: (6) Could not resolve host — the card is fine, the name just doesn't exist. Fix: enable Magic DNS on the control server, or switch all references to the CGNAT address (tailscale ip -4 → http://100.x.y.z:9900) and regenerate A2A_PUBLIC_URL. Diagnosis order when a peer is "unreachable": curl (6) = DNS, fix the name; curl (7) Failed to connect = port closed, the peer's A2A server genuinely isn't running (most common). A node in tailscale status does not imply either.

Templates

  • templates/a2a-peer-setup.sh — idempotent per-peer inbound setup (enables the platform/toolsets, derives the tailnet IP via tailscale ip -4 so it works without Magic DNS, sets A2A_* env vars incl. token, self-tests the card). Run it on EVERY box that must receive A2A tasks.

See also

  • Tailscale networking that A2A often rides over: see the termux-go-builds skill (references/tailscale-android.md there) for Termux/Android bring-up.

greysi als A2A-Peer (2026-11-15)

  • greysi (Intel-MacBook, Tailnet-IP 100.64.0.6) hat Port 22 (SSH) offen, aber keinen hinterlegten Schlüssel, den der lokale Mac anbietet. Für A2A reicht das Gateway-Setup.
  • Einrichtungsskript: ~/Desktop/greysi-hermes/greysi-hermes-setup.command (siehe Konversation 2026-11-15). Es installiert Hermes, aktiviert A2A und startet das Gateway.
  • Nach dem ersten Start auf greysi ist der Peer unter http://100.64.0.6:9900 erreichbar.
  • Um greysi per SSH zu erreichen, muss ein Schlüssel (z. B. ~/.ssh/id_rsa.pub lokal) in ~/.ssh/authorized_keys auf greysi eingetragen werden (z. B. per ssh-copy-id oder manuell).
  • Der A2A-Bearer-Token für greysi ist in ~/.hermes/.env als A2A_BEARER_TOKEN und in a2a_agents.greysi.auth.token hinterlegt.