7.0 KiB
7.0 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.
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. - 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".
- 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.