feat: add A2A (Agent-to-Agent) Protocol support - #107
Merged
Conversation
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>
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.
Summary
/a2aendpoint that proxies JSON-RPC 2.0 requests to upstream A2A agents via thera2aSDKsrc/a2a/module withA2aProxyExecutor(forwards messages to upstream) andA2aPolicyInterceptor(enforces agent identity, API key auth, rate limiting, and payload filtering)a2a:block in YAML) is optional — existing MCP behaviour is completely unaffected when omittedHttpTransportandStreamableHttpTransportgain awith_a2a()builder to mount the ra2a router at the configured pathTest plan
cargo test --lib— 428 unit tests (14 new ininterceptor.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 warningscargo fmt --check— no formatting violationsCloses #88