hermes-agent/plugins/platforms/a2a
teknium1 6a109c84fa
feat(a2a): consolidated Agent-to-Agent protocol plugin (closes #514)
Single platform-adapter plugin under plugins/platforms/a2a/ — zero core
edits — that supersedes the entire A2A PR/issue cluster. Built on the
ctx.register_platform + ctx.register_tool surface the codebase now exposes.

Outbound (a2a toolset): a2a_discover / a2a_call / a2a_list let the agent
call any A2A-compliant peer over JSON-RPC message/send. Inbound (platform
adapter): a stdlib http.server serves an Agent Card at
/.well-known/agent.json and routes incoming tasks into the agent's LIVE
gateway session (the #11025 insight) — same agent, full memory — returning
the reply over A2A.

Security on by default: no bearer token => 127.0.0.1-only bind; constant-
time bearer auth; inbound prompt-injection filtering + untrusted-peer
framing; outbound credential redaction; append-only audit log; per-context
conversation persistence outside the compaction pipeline.

Stdlib only (no a2a-sdk). 37 tests incl. a live HTTP round-trip
(card + message/send + reply) and a bearer-auth 401 path.
2026-07-06 02:15:06 -07:00
..
__init__.py feat(a2a): consolidated Agent-to-Agent protocol plugin (closes #514) 2026-07-06 02:15:06 -07:00
adapter.py feat(a2a): consolidated Agent-to-Agent protocol plugin (closes #514) 2026-07-06 02:15:06 -07:00
DESIGN.md feat(a2a): consolidated Agent-to-Agent protocol plugin (closes #514) 2026-07-06 02:15:06 -07:00
plugin.yaml feat(a2a): consolidated Agent-to-Agent protocol plugin (closes #514) 2026-07-06 02:15:06 -07:00
protocol.py feat(a2a): consolidated Agent-to-Agent protocol plugin (closes #514) 2026-07-06 02:15:06 -07:00
README.md feat(a2a): consolidated Agent-to-Agent protocol plugin (closes #514) 2026-07-06 02:15:06 -07:00
security.py feat(a2a): consolidated Agent-to-Agent protocol plugin (closes #514) 2026-07-06 02:15:06 -07:00
tools.py feat(a2a): consolidated Agent-to-Agent protocol plugin (closes #514) 2026-07-06 02:15:06 -07:00

A2A — Agent-to-Agent protocol for Hermes

Talk to other agents, and let other agents talk to you, over the open A2A protocol. Works with any A2A-compliant peer (another Hermes, LangChain, CrewAI, Google ADK, OpenClaw, …). Stdlib only — no a2a-sdk dependency.

Enable

hermes gateway setup      # pick A2A, or:
# ~/.hermes/config.yaml
gateway:
  platforms:
    a2a:
      enabled: true
      extra:
        port: 9900

# peers you want to call (outbound):
a2a_agents:
  researcher:
    url: "http://localhost:9999"
    auth: { type: bearer, token: "sk-..." }
    timeout: 120

Outbound — call other agents

The agent gets three tools:

  • a2a_discover(url) — what can this agent do?
  • a2a_call(agent, message, context_id?) — send it a task, get the reply.
  • a2a_list() — configured peers + saved conversations.

Inbound — be callable

When the a2a platform is enabled, Hermes serves an Agent Card at http://<host>:<port>/.well-known/agent.json and accepts JSON-RPC message/send tasks. Incoming tasks are injected into your live agent session — the same agent that's talking to you, with full memory — and the reply is returned over A2A.

Security

  • No bearer token ⇒ localhost only. The server binds 127.0.0.1 and refuses to widen unless you set both A2A_BEARER_TOKEN and A2A_HOST.
  • Inbound text is run through prompt-injection filters and framed as untrusted peer input.
  • Outbound text is scrubbed of credential-shaped strings.
  • Every exchange is logged to ~/.hermes/a2a_audit.jsonl.
  • Conversations persist to ~/.hermes/a2a_conversations/ — they survive context compaction and restarts.

Env vars

Var Default Meaning
A2A_BEARER_TOKEN (unset) Required on inbound calls. Unset ⇒ localhost-only.
A2A_HOST 127.0.0.1 Bind host. Only widens with a token set.
A2A_PORT 9900 Inbound port.
A2A_AGENT_NAME hostname-derived Name on the Agent Card.
A2A_ALLOW_ALL_USERS false Allow any authed peer (dev only).

See DESIGN.md for architecture and the requirement-tracing table.