feat(a2a): implement A2A HTTP transport for server mode #720

Closed
freemo wants to merge 4 commits from feature/m9-a2a-http into master

4 Commits

Author SHA1 Message Date
freemo 3249b87926 fix(lint): remove unused MagicMock import from HTTP transport steps
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 16s
CI / build (pull_request) Successful in 17s
CI / quality (pull_request) Successful in 20s
CI / security (pull_request) Successful in 37s
CI / typecheck (pull_request) Successful in 59s
CI / unit_tests (pull_request) Successful in 3m5s
CI / integration_tests (pull_request) Successful in 3m27s
CI / docker (pull_request) Successful in 40s
CI / coverage (pull_request) Successful in 5m28s
CI / benchmark-regression (pull_request) Successful in 36m25s
2026-03-12 04:26:30 +00:00
freemo 25605b1ba4 feat(a2a): implement A2A HTTP transport for server mode
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Failing after 14s
CI / build (pull_request) Successful in 16s
CI / quality (pull_request) Successful in 17s
CI / typecheck (pull_request) Successful in 38s
CI / coverage (pull_request) Has been skipped
CI / benchmark-regression (pull_request) Has been skipped
CI / security (pull_request) Successful in 52s
CI / unit_tests (pull_request) Successful in 3m12s
CI / docker (pull_request) Has been skipped
CI / integration_tests (pull_request) Successful in 3m29s
Implement the client-side A2A HTTP transport for server mode, enabling
JSON-RPC 2.0 communication over HTTP with SSE streaming support.

New components:
- A2aTransport Protocol (transport_protocol.py): Abstract interface that
  all transport implementations (HTTP, stdio) must satisfy, with methods
  for connect/disconnect lifecycle, send, and send_streaming.
- A2aRemoteTransport (http_transport.py): Client-side HTTP transport using
  httpx that sends JSON-RPC 2.0 requests to a remote A2A server. Supports
  SSE streaming for message/stream (TaskStatusUpdateEvent and
  TaskArtifactUpdateEvent), authentication via bearer token/API key/custom
  headers (AuthConfig), TLS verification, and context manager usage.
- TransportSelector (transport_selector.py): Picks the appropriate transport
  based on ServerConnectionConfig — returns A2aRemoteTransport when
  server.url is configured, raises A2aNotAvailableError for local/stdio
  mode (pending stdio transport implementation).
- SSE event parser for consuming Server-Sent Events streams.
- httpx added as a project dependency.

Tests:
- 26 Behave BDD scenarios covering protocol definition, auth config,
  transport construction, connection lifecycle, request serialization,
  response parsing, SSE parsing, TransportSelector, and contract tests.
- 9 Robot Framework integration tests with helper script verifying
  end-to-end transport behavior.

ISSUES CLOSED: #692
2026-03-12 02:09:20 +00:00
freemo 33900eab03 feat(a2a): implement JSON-RPC 2.0 wire format and method routing
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 14s
CI / build (pull_request) Successful in 16s
CI / quality (pull_request) Successful in 18s
CI / security (pull_request) Successful in 35s
CI / typecheck (pull_request) Successful in 55s
CI / unit_tests (pull_request) Successful in 2m57s
CI / integration_tests (pull_request) Successful in 3m23s
CI / docker (pull_request) Successful in 41s
CI / coverage (pull_request) Successful in 5m36s
CI / benchmark-regression (pull_request) Successful in 35m11s
Implement the JSON-RPC 2.0 wire format layer and method routing for the
A2A protocol, building on the ACP-to-A2A rename from #688.

New modules in src/cleveragents/a2a/:
- jsonrpc_models.py: Pydantic v2 models for JSON-RPC 2.0 request,
  response, error, and notification envelopes
- jsonrpc_router.py: Method router that dispatches JSON-RPC requests
  to registered handlers, with support for standard A2A methods and
  _cleveragents/ extension methods
- jsonrpc_handlers.py: Handlers for standard A2A methods (message/send,
  message/stream, tasks/get, tasks/cancel) and extension method factory
  that delegates to A2aLocalFacade
- jsonrpc_errors.py: Maps domain error taxonomy to JSON-RPC 2.0 error
  codes (standard -32700 to -32603, application -32001 to -32008)
- agent_card.py: Agent Card model and generation for the
  /.well-known/agent.json capability advertisement endpoint

Standard A2A methods:
- message/send: Create/update tasks via messages
- message/stream: Streaming variant with SSE event indicators
- tasks/get: Retrieve task by ID
- tasks/cancel: Cancel running tasks

CleverAgents extension methods (_cleveragents/ prefix):
- plan/use, execute, status, diff, apply, cancel
- registry/list_tools, list_resources
- context/show
- sync/status
- namespace/list
- health

Tests:
- Behave BDD: features/a2a_jsonrpc.feature (28 scenarios)
- Robot Framework: robot/a2a_jsonrpc.robot (9 integration tests)

ISSUES CLOSED: #690
2026-03-12 01:00:37 +00:00
freemo 2fe95d1b38 refactor(a2a): rename ACP module and symbols to A2A standard
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 20s
CI / build (pull_request) Successful in 16s
CI / quality (pull_request) Successful in 35s
CI / security (pull_request) Successful in 47s
CI / typecheck (pull_request) Successful in 1m37s
CI / integration_tests (pull_request) Successful in 3m38s
CI / unit_tests (pull_request) Successful in 4m44s
CI / docker (pull_request) Successful in 1m6s
CI / coverage (pull_request) Successful in 5m30s
CI / benchmark-regression (pull_request) Successful in 35m37s
Renamed src/cleveragents/acp/ to src/cleveragents/a2a/ and all 13
Acp* classes to A2a* per ADR-047 (A2A Standard Adoption). Updated
all imports, structlog event names (acp.* → a2a.*), field names
(acp_version → a2a_version), and test references across the entire
codebase. This is a cosmetic rename only — no behavioral changes.

ISSUES CLOSED: #688
2026-03-11 22:10:25 +00:00