10 KiB
10 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 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
a2atoolset 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(hostnameblackbook.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:/dispatchin 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)
- 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) - Tokens & bind (in
~/.hermes/.env— credentials go in .env, never config.yaml). Generate a token:python3 -c "import secrets;print(secrets.token_hex(24))".Security model: no token ⇒ binds 127.0.0.1 only. Remote exposure requires a bearer token ANDA2A_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>A2A_HOST. Per-peer alt:A2A_PEER_TOKENS="alice:tok1,bob:tok2". - 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 - 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 withnameandurl. - 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.jsonlrecords inbound/outbound task + reply even when the HTTP response is lost. If you see aninboundand a matchingoutboundline, 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). Checka2a_audit.jsonlbefore concluding A2A is broken. A long LLM reply easily exceeds a short curl timeout; the server logsBrokenPipeErrorafter 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'sa2a_historyprove 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. Atimed outerror 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.
- 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.0only widens the bind whenA2A_BEARER_TOKENis 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 --peersis 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. - Token must match on BOTH sides. A mismatch does NOT always return HTTP 401 —
verified in-session: the peer answered
HTTP 200with a JSON-RPC error body{"code": -32050, "message": "unauthorized"}. Treat-32050 unauthorizedas the token-mismatch signature (card fetch needs no auth, so a 200 card + -32050 task call = network fine, auth wrong). a2a_agentsis a custom top-level key —hermes config setwarns "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 (inA2A_PUBLIC_URL, peerurls, and the advertised Agent Cardurl) only resolve if the control server has Magic DNS enabled for that zone. Symptom that bites: even your OWN node's advertised URL fails withcurl: (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 regenerateA2A_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 intailscale statusdoes not imply either.
Templates
templates/a2a-peer-setup.sh— idempotent per-peer inbound setup (enables the platform/toolsets, derives the tailnet IP viatailscale ip -4so 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-buildsskill (references/tailscale-android.md there) for Termux/Android bring-up.