Skip to content

feat: A2A (Agent2Agent) protocol support — Agent Card server + client tool - #52037

Closed
cardinalconseils wants to merge 1 commit into
NousResearch:mainfrom
cardinalconseils:feat/a2a-protocol
Closed

feat: A2A (Agent2Agent) protocol support — Agent Card server + client tool#52037
cardinalconseils wants to merge 1 commit into
NousResearch:mainfrom
cardinalconseils:feat/a2a-protocol

Conversation

@cardinalconseils

Copy link
Copy Markdown

Summary

Implements A2A (Agent2Agent) protocol support for Hermes Agent, enabling inter-agent collaboration with any A2A-compliant system (Google ADK, LangGraph, CrewAI, etc.).

MCP connects agents to tools. A2A connects agents to other agents.

Tier 1 — Agent Card Server (plugin)

  • GET /.well-known/agent-card.json — serves A2A-compliant Agent Card, auto-generated from live Hermes state (SOUL.md identity, installed skills, version, auth config). Public, no auth required.
  • POST /a2a — JSON-RPC 2.0 endpoint accepting:
    • message/send — create task, run agent, return Task with Artifacts
    • task/get — get task status by ID
    • task/list — list recent tasks
    • task/cancel — cancel a running task
  • Routes through existing APIServerAdapter._run_agent() — same code path as /v1/chat/completions. Supports blocking and non-blocking modes.
  • Plugin hooks into API server via try/except import in connect() — never breaks startup if plugin is missing.
  • A2A endpoints advertised in /v1/capabilities.

Tier 2 — A2A Client Tool

  • a2a_send tool (delegation toolset) lets Hermes act as an A2A client:
    • discover — fetch and parse Agent Card from remote agent
    • send — send message/task to remote agent, receive structured artifacts
    • status — poll task status
    • list — list recent tasks on remote agent
    • cancel — cancel a running task
  • Uses stdlib urllib only — no external dependencies.
  • Enables the failed payment scenario: Support Agent discovers a Fraud Agent card, sends a task, receives a risk score artifact.

Governance (config + existing features, no new code)

Governance Concern Hermes Feature
Agent identity SOUL.md
Permissions Toolset restrictions + DELEGATE_BLOCKED_TOOLS
Auth Bearer token reuse from API_SERVER_KEY
Auditability Session transcripts in state.db
Cost tracking hermes insights + delegation cost rollup
Failure handling Subagent timeout + auto-deny + zombie cleanup

Files

New files (7):

  • plugins/a2a/__init__.py — Plugin entry point
  • plugins/a2a/agent_card.py — Agent Card generation from SOUL.md + skills + config
  • plugins/a2a/models.py — A2A data model (Task, Message, Part, Artifact) with lifecycle
  • plugins/a2a/jsonrpc.py — JSON-RPC endpoint handlers
  • tools/a2a_send_tool.py — A2A client tool (discover/send/status/list/cancel)
  • tests/plugins/test_a2a.py — 20 unit tests
  • tests/tools/test_a2a_send.py — 18 unit tests

Modified files (2):

  • gateway/platforms/api_server.py — A2A route registration + capabilities advertisement
  • toolsets.py — a2a_send added to delegation toolset

Test Results

38 tests pass (20 Agent Card/models, 18 client tool). Security gate clean.

Security

  • Agent Card endpoint: no auth required (public discovery, like /.well-known/)
  • JSON-RPC endpoint: requires Bearer auth (same API_SERVER_KEY check)
  • No secrets in any output (tested with 12 forbidden patterns)
  • No SQL injection, no auth bypass, no XSS patterns
  • Uses hmac.compare_digest for auth token comparison (same as existing API server)

Spec Reference

https://github.com/a2aproject/A2A/blob/main/docs/specification.md

… tool

Tier 1 — Agent Card endpoint:
- GET /.well-known/agent-card.json serves A2A-compliant Agent Card
  auto-generated from SOUL.md identity, installed skills, Hermes version,
  and auth config. Public, no auth required (standard discovery path).
- POST /a2a JSON-RPC 2.0 endpoint accepts message/send, task/get,
  task/list, task/cancel. Routes through existing APIServerAdapter._run_agent,
  same code path as /v1/chat/completions. Returns A2A Task objects
  with Artifacts. Supports blocking and non-blocking modes.
- Plugin hooks into API server via try/except import in connect() —
  never breaks startup if plugin is missing.
- A2A endpoints advertised in /v1/capabilities.

Tier 2 — A2A client tool:
- a2a_send tool (delegation toolset) lets Hermes act as A2A client.
  Operations: discover (fetch Agent Card), send (send message/task),
  status (poll task), list (list tasks), cancel (cancel task).
- Uses stdlib urllib only — no external dependencies.
- Enables the failed payment scenario: Support Agent discovers a Fraud
  Agent's card, sends a task, receives a risk score artifact.

Governance (config + existing features, no new code):
- Agent identity: SOUL.md
- Permissions: toolset restrictions + DELEGATE_BLOCKED_TOOLS
- Auth: Bearer token reuse from API_SERVER_KEY
- Auditability: session transcripts in state.db
- No secrets in any A2A output (tested with 12 forbidden patterns)

38 tests pass (20 Agent Card/models, 18 client tool). Security gate clean.
Spec: https://github.com/a2aproject/A2A
@alt-glitch alt-glitch added type/feature New feature or request innovation Ambitious or experimental feature ideas comp/gateway Gateway runner, session dispatch, delivery comp/plugins Plugin system and bundled plugins tool/delegate Subagent delegation P3 Low — cosmetic, nice to have labels Jun 24, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Related: #514 (the A2A feature request), #46241 (A2A server adapter approach), #41711 (consolidated single-plugin A2A approach). This PR takes a third approach — a plugin Agent Card server (plugins/a2a/) plus a stdlib-only a2a_send client tool. It's not a duplicate of those, but the A2A cluster is now saturated with competing open PRs; a maintainer should pick one direction.

@cardinalconseils
cardinalconseils deleted the feat/a2a-protocol branch June 24, 2026 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery comp/plugins Plugin system and bundled plugins innovation Ambitious or experimental feature ideas P3 Low — cosmetic, nice to have tool/delegate Subagent delegation type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants