feat: add A2A (Agent-to-Agent) protocol support#11025
Closed
iamagenius00 wants to merge 1 commit into
Closed
Conversation
0d557dc to
eb0854f
Compare
Contributor
Author
|
CI status note:
|
Gateway adapter for Google A2A protocol — routes agent-to-agent messages through the existing session pipeline (same live agent as Telegram/Discord). Includes: - Gateway platform adapter (gateway/platforms/a2a.py) - Client tools: a2a_discover, a2a_call, a2a_list (tools/a2a_tools.py) - Shared security module (tools/a2a_security.py) - Privacy: A2A messages skip wakeup context injection - Auth: bearer token required, localhost-only fallback when no token - Rate limiting, input sanitization, output filtering, audit logging - Bounded task session cache (prevents memory leaks) Integration: gateway/config.py, gateway/run.py, toolsets.py, pyproject.toml Companion repo: https://github.com/iamagenius00/hermes-a2a
eb0854f to
ec4b0bc
Compare
5 tasks
Contributor
|
Closing in favor of #41711, which consolidates the entire A2A protocol cluster into a single platform-adapter plugin with zero core edits. This pr contributed the peer-to-peer model. The single most important architectural decision in the new plugin — routing inbound A2A into the agent's LIVE session instead of a throwaway clone, plus the security hardening (injection filters, outbound redaction, audit log) and conversation persistence outside the compaction pipeline — is your design, carried over wholesale. Thanks @iamagenius00! See #41711 — the PR body has a table tracing each requirement back to its source issue/PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Add Google A2A (Agent-to-Agent) protocol support to Hermes Agent — enabling peer-to-peer communication between agents across frameworks.
Why
Hermes has
delegate_taskfor spawning child agents — that's a boss-worker relationship. The child does a job, reports back, and disappears. There's no way for agents to talk to each other as peers. Your Hermes agent can't reach another user's agent — whether it's another Hermes instance, an OpenClaw agent, or anything else that speaks A2A.Design principles
Peer-to-peer, not boss-and-worker. Two agents talk as equals, each with their own memory, context, and judgment. Neither controls the other.
Same session, same agent — not a clone. Incoming A2A messages inject into the agent's existing live session, not a new process. The agent that replies is the same one talking to its user on Telegram all day — with full context and memory. Not a clone that loaded your files, replied, and disappeared. This matters because the alternative (new session per message) means "you" replied but have no memory of it. Your user can't see it in their chat.
Conversations persist independently — compaction can't erase them. Hermes' context compaction summarizes long conversations to save tokens, which can compress away A2A exchanges. hermes-a2a stores every conversation separately on disk (
~/.hermes/a2a_conversations/), outside the session context pipeline. Compaction can't touch them. Agent restarts can't lose them. (Session-internal compaction causing search misses is a known issue — PR #13841 addresses this.)Instant wake — no polling. When a message arrives, the plugin fires an HMAC-signed webhook to trigger an agent turn immediately. No cron delay, no polling interval.
Privacy earned through real leaks. The first version sent the agent's entire private files (diary, memory, body) in A2A messages. Fixed in 3 rounds. Now: 9 injection filters, outbound redaction, privacy prefix, audit logging. But the last line of defense is always the agent's own judgment.
Current status
This PR proposes native integration. In the meantime, a standalone plugin is available and actively used:
👉 hermes-a2a — 7 files, drop into
~/.hermes/plugins/a2a/, zero external dependencies.The plugin uses
pre_llm_call/post_llm_callhooks and a backgroundThreadingHTTPServerto achieve session injection without patching gateway code. It works with Hermes v0.11.0+ and the newregister_commandAPI.What's working in production
/a2aslash command — check server status and connected agents from TelegramWhat native integration would add
The plugin works but has inherent limitations as a workaround:
register_platform()API so plugins can add platforms without patching gateway sourceWhat's included (in this PR)
Gateway adapter (
gateway/platforms/a2a.py)/.well-known/agent.jsonClient tools (
tools/a2a_tools.py)a2a_discover— fetch a remote agent's capabilitiesa2a_call— send a message with structured metadata (intent, expected_action, reply_to_task_id)a2a_list— list configured remote agentsSecurity (
tools/a2a_security.py)~/.hermes/a2a_audit.jsonlConfiguration
A2A_ENABLED,A2A_PORT,A2A_AUTH_TOKEN,A2A_WEBHOOK_SECRETin.envconfig.yamlundera2a.agentsTechnical notes
http.server+urllib.requestthreading.Lockon all shared stateRelated