ADR 0010: A2A inbound adapter (read-only, unauthenticated, additive)
Status
Accepted (2026-10-29). Follows ADR 0007 (the MCP adapter this one is modelled on and whose read-only charter it inherits), ADR 0004 (CloudEvents on every Kafka message) and ADR 0006 (Postgres and Kafka are the only runtime). Mirrors the fleet's reference rollout (workforce-management ADR 0039, wes-work-planning ADR 0046).
Context
The fleet is adopting the Agent2Agent (A2A) protocol so that one bounded context can delegate a goal to another context's agent. pick-face-replenishment already exposes its use cases over REST and, read-only, over MCP (ADR 0007). Three transports now carry three different things and must not overlap:
| Transport | Carries |
|---|---|
| Kafka + CloudEvents | facts between contexts (ADR 0004) |
| MCP | an agent's tools |
| A2A | delegation of a goal, never data sync |
The questions a delegating agent asks of this context are the two the MCP surface already answers: which pick faces of this site are low, and why? and what is happening to replenishment requests?
Decision
-
A third driving adapter,
internal/adapters/inbound/a2a, over the SAME read use cases as REST and MCP (ListPickFaces,ListRequests,GetRequest), built on the official SDKgithub.com/a2aproject/a2a-go/v2(pinned v2.7.0). It is a message-only agent (no Task lifecycle: both skills are transactional request/response reads) speaking JSON-RPC 2.0 over HTTP. The Agent Card is served at/.well-known/agent-card.json, the endpoint is mounted at both/and/a2a, andGET /healthzanswers the probes. The card declares no security schemes. -
The write gate: the agent is READ-ONLY. An A2A skill may change state only if the context's MCP surface already offers that write. ADR 0007 decided MCP has no write tool (declaring or removing a policy, requesting and cancelling a replenishment and the site evaluation stay REST-only, because their events are consumed by other contexts and their idempotency and version guard are
Idempotency-KeyandIf-Match), so A2A has none either. Delegation never widens what this context exposes; a write skill would need its own ADR that first widens MCP. -
Two curated, goal-shaped skills (not one per endpoint), derived from the MCP tools and the REST read use cases:
Skill Goal Arguments Use cases pick_face_statuswhich forward pick faces of a site are BELOW_MIN,NO_SOURCE,NO_POLICYorOK, with stock and policy boundssiteId(required),status,limit,cursorListPickFacesreplenishment_lookupone request by id, or a filtered newest-first list requestIdalone, or any ofsiteId,sku,state,limit,cursorGetRequest/ListRequestsThe policy reads (
list_policies,get_policy) are not skills: their bounds already ride on every pick face. The by-id and list forms ofreplenishment_lookupare exclusive (requestIdwith a filter is refused) so a caller never believes a filter narrowed a by-id answer. Arguments are camelCase like the REST body (siteId), not the MCP snake_case. Answers are the REST bodies, never domain structs, and carry a one-line text summary. -
Strict input. A skill call is
{"skill": "<id>", "arguments": {...}}in a data part (or a text part holding the same JSON). Decoding rejects unknown fields and trailing data (DisallowUnknownFields), at the request and the argument level, so a misspelled optional name cannot silently drop a filter.encoding/jsonmatches names case-insensitively, so only genuinely unknown names are refused. -
Rejections are answered in-band, never as JSON-RPC errors. Every domain rejection and malformed request comes back as an RFC 7807-shaped
problem(type,title,detail,status) inside the message envelope, with the SAME status and slug as the REST adapter's problem catalogue:404 replenishment-not-found;400 invalid-site-id,invalid-sku(also above the 64-character REST bound),invalid-request-id,invalid-state,invalid-status,invalid-limit,invalid-cursor;500 internal-errorfor anything untyped (cause logged, never sent). The A2A-only slugs aremalformed-skill-request,unknown-skillandinvalid-argument(all 400). The 409/422 entries of the REST catalogue are unreachable from reads and deliberately absent. Problem details are adapter-owned text: domain errors carry a package prefix (policy: site id must not be blank) and repository errors may wrap infrastructure text, so neither reaches an answer part. This context has no deprecated alias key (siteIdis canonical on every surface), so there is no alias to keep out of the card. -
cmd/a2ais a composition root cloned fromcmd/mcp: the same Postgres repositories and read use cases, a read-onlyEvaluator(no event sink, id generator or clock), the idempotent boot migrations (MIGRATIONS_DATABASE_URL) and the same real wiring. Likecmd/mcpit builds no outbox repository, unit of work or event publisher, never starts the outbox relay, never runs the local-copy consumers and never dials Kafka (noKAFKA_BROKERS,EVENT_PUBLISHER,*_MODEor consumer group). Real Postgres only, no in-memory mode: it refuses to boot withoutDATABASE_URL. It listens onA2A_ADDR(default:8093; 8080 is the API, 8090 MCP, 8091 the projector admin port and 8092 the reports API) and refuses to boot withoutA2A_AGENT_URL, an absolutehttp(s)URL with a host: the card must advertise a URL clients can dial, so there is no default (in-cluster:http://<release>-a2a.<ns>.svc.cluster.local:8093/). Configuration errors surface before any connection and before the listener binds, each naming its variable. -
No authentication of any kind, matching the fleet-wide decision (reverted 2026-09-11) that REST, MCP and A2A are unauthenticated; access control is the in-cluster
ClusterIPboundary.TestNoAuthMiddlewareReintroducedalready scansinternal/adapters/inbound, which now includes this adapter. -
No outbound A2A client. This context delegates to nobody and keeps its ban on live lookups of sibling contexts (REST or MCP).
TestA2ASDKStaysInTheInboundAdapterfails if the SDK is imported outside the adapter andcmd/a2a, or ifa2aclientis imported by any non-test file. -
Observability. Each skill runs under an OTel span
a2a.skill <id>with attributea2a.skill, mirroring the MCPmcp.tool <name>span; a problem answer marks the span as an error. -
Packaging. The Dockerfile already builds every
cmd/*directory, so/app/a2aships beside/app/apiand/app/mcp. The chart renders ana2aDeployment and ClusterIP Service (componenta2a, port 8093, command/app/a2a) only whena2a.enabled=true(default false), withA2A_AGENT_URLdefaulting to the Service DNS and overridable througha2a.agentUrl;a2a.route.enabledadds an HTTPRoute/api/a2a/pick-face-replenishmentthat Kong rewrites to/(the agent card stays reachable under the same prefix). It gets no Kafka env. There is no HPA: one replica, like MCP.
Sensors
internal/architecture/a2a_fitness_test.go:TestA2AAdapterDependencyRule(the adapter depends only on application and domain; nothing depends on it),TestA2ASurfaceIsReadOnly(the adapter andcmd/a2arun the MCP read-only sensor: no write use case, no outbox, event sink, Kafka, ports package or memory double, no outbox repository, unit of work or idempotency store incmd/a2a, no event sink on itsEvaluator;TestEveryUseCaseIsClassifiedReadOrWritekeeps the classification from going stale) andTestA2ASDKStaysInTheInboundAdapter(no outbound client).- Adapter tests drive the real JSON-RPC wire (
httptestplusa2aclient.NewFromCard) with a test-local envelope struct: card shape and truthfulness (every advertised example parses under the strict decoder and is accepted by its skill), both skills, paging, argument validation, in-band problems with the REST classification, adapter-owned details, the 500 path that hides its cause, and reads that raise no event. cmd/a2atests: boot-config refusals, fail-fast before the listener binds, both mounts, the card route, no auth. Theintegrationtest seeds Postgres through the write use cases, reads through the real router and proves theoutbox_eventstable is unchanged by the reads.- Chart:
render_test.sh(Deployment, Service, route,/app/a2a,:8093, the card URL default and override, no Kafka env, the env literals and required variables derived from the Go source),test_service_selectors.py(every Service selects exactly one Deployment) andtest_kong_config.py(the a2a route rewrites to/).
Consequences
- A delegating agent can ask this context about pick faces and replenishment requests without a REST or MCP client; it
cannot change anything. The REST contract stays the only write path, and every fact still leaves as a CloudEvent
through the transactional outbox of
cmd/api. - The skill set is a reviewed contract: adding a skill changes the card test and this ADR. Adding a write skill
additionally needs MCP to offer the same write first, the relaxation of
TestA2ASurfaceIsReadOnlyand a new ADR. - The agent pod needs a Postgres DSN and nothing else; it can run when Kafka is down. Its answers inherit the event-fed local copies' lag (ADR 0003): a pick face level can trail the inventory ledger by a few seconds.
- Not in this change: the
warehouse-infraflip (helm-values/pick-face-replenishment.yamla2ablock withenabled, the route path and the platformparentRefs), the image publication to the cluster, and any client in another context that calls this agent.