Skip to content

feat: add A2A (Agent-to-Agent) Protocol support - #107

Merged
nfvelten merged 1 commit into
masterfrom
feat/a2a-protocol
Apr 6, 2026
Merged

feat: add A2A (Agent-to-Agent) Protocol support#107
nfvelten merged 1 commit into
masterfrom
feat/a2a-protocol

Conversation

@nfvelten

@nfvelten nfvelten commented Apr 6, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds a security-enforced /a2a endpoint that proxies JSON-RPC 2.0 requests to upstream A2A agents via the ra2a SDK
  • New src/a2a/ module with A2aProxyExecutor (forwards messages to upstream) and A2aPolicyInterceptor (enforces agent identity, API key auth, rate limiting, and payload filtering)
  • A2A config (a2a: block in YAML) is optional — existing MCP behaviour is completely unaffected when omitted
  • Both HttpTransport and StreamableHttpTransport gain a with_a2a() builder to mount the ra2a router at the configured path

Test plan

  • cargo test --lib — 428 unit tests (14 new in interceptor.rs)
  • cargo test --test a2a — 11 new integration tests (agent card discovery, message proxying, identity enforcement, API key auth, payload filtering, rate limiting, MCP endpoint isolation)
  • cargo clippy -- -D warnings — no warnings
  • cargo fmt --check — no formatting violations

Closes #88

Adds a security-enforced A2A endpoint that proxies JSON-RPC 2.0 requests
to upstream A2A agents while enforcing per-agent policies via a
CallInterceptor.

New module src/a2a/:
- executor.rs: A2aProxyExecutor forwards message/send to the upstream A2A
  server and streams the reply back through the event queue
- interceptor.rs: A2aPolicyInterceptor enforces agent identity
  (x-arbitus-agent header), API key auth (constant-time compare),
  sliding-window rate limiting, and regex payload filtering
- mod.rs: public re-exports

Config changes (src/config.rs):
- New A2aConfig with upstream URL, mount path, and agent card metadata
- A2aAgentCardConfig for name/description/url/version

Transport changes (src/transport/http.rs):
- with_a2a() builder on both HttpTransport and StreamableHttpTransport
- Mounts the ra2a router under the configured path when A2A is enabled

Binary changes (src/bin/arbitus.rs):
- Constructs A2aProxyExecutor + A2aPolicyInterceptor + ServerState
  from config and wires them into the transport

Tests:
- tests/a2a.rs: 11 integration tests covering agent card discovery,
  message proxying, identity enforcement, API key auth, payload
  filtering, rate limiting, and MCP endpoint isolation
- tests/common/mod.rs: dummy A2A upstream + A2aHarness helper

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@nfvelten
nfvelten merged commit b4322d2 into master Apr 6, 2026
3 checks passed
@nfvelten
nfvelten deleted the feat/a2a-protocol branch April 6, 2026 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: A2A Protocol support — security enforcement for agent-to-agent traffic

1 participant