ADR 0010: A2A inbound adapter
Status
Accepted (2026-10-29).
Context
Agents of the fleet delegate goals to the agent that owns the data. The Agent2Agent (A2A) protocol is the fleet's channel for that delegation: one agent sends a goal-shaped request to another and gets an answer back. delivery-promise already has two driving adapters over its use cases, REST (checkout and the operator, ADR 0006) and a read-only MCP server (an agent's tools, ADR 0007). A third adapter makes this context reachable by other agents as an agent.
The three transports do not overlap. Kafka and CloudEvents carry facts (ADR 0004); MCP carries an agent's tools; A2A carries the delegation of a goal, never data sync. An A2A skill that changed state would do it through the same use case and the same transactional outbox as REST (ADR 0005), and the fact would still leave as a CloudEvent.
Decision
-
A third driving adapter, a separate binary.
internal/adapters/inbound/a2ais built on the A2A Go SDK (github.com/a2aproject/a2a-go/v2v2.7.0) and served as JSON-RPC 2.0 over HTTP bycmd/a2a, mounted at/and/a2a, with the Agent Card at/.well-known/agent-card.jsonand an open/healthz. It is a third deployable besidecmd/apiandcmd/mcp;cmd/a2ais composed likecmd/mcp(same migrations on boot, same Postgres repositories, sameusecases.Service, same observability middleware order of ADR 0009). The Helm chart gets an a2a Deployment and Service (default OFF) and an optional Kong HTTPRoute rewriting/api/a2a/delivery-promiseto/. -
Read-only, because MCP is. The write gate of the A2A rollout lets a skill change state only if the context's MCP surface already offers that write. ADR 0007 made MCP read-only on purpose (quote, make, confirm, cancel and publish stay on REST and on the event consumers, driven by checkout and the operator), so this agent is read-only too and does not widen what the context exposes. The adapter's
Depsholds oneReadsinterface with three query methods and nothing that can write. It imports nousecasespackage, no outbound adapter and no event machinery (TestA2AAdapterIsReadOnly), and nothing may depend on it (TestA2AAdapterDependencyRule).cmd/a2astarts no outbox relay, consumer or sweeper and never dials Kafka: noKAFKA_BROKERS, no consumer group, noEVENT_PUBLISHER. The integration test proves that serving the skills against a real Postgres adds no outbox row. -
Two curated, goal-shaped skills, derived from the MCP tools (not one per endpoint; both are reads):
promise_status-- "is the promise for this order intact?" Exactly one oforderId(every promise of the order, one per shipment group, thelist_promises_by_orderquery) orpromiseId(one promise, theget_promisequery). Each promise carries its state, terms, witness path, revisions and judgement, the veryviews.Promisethe REST adapter returns.book_capacity-- "how full is this node's pickup capacity on that day?"nodeIdanddate(YYYY-MM-DD, the node's time zone): the node's promise books with their share, provisional and confirmed holds (thelist_promise_booksquery).
get_delivery_offer(offers are short-lived scratch state) andget_current_policy(static configuration, already on REST and MCP) are deliberately not skills; adding one is an amendment of this ADR. -
Message-only, answered in-band. Both skills are request/response reads, so the agent answers every message with one agent Message (a Data part with the envelope
{skill, data | problem}and a Text part with a one-line summary) and has no Task lifecycle. The reply keeps the caller'scontextId. -
Strict input. The first message part is
{"skill": "<id>", "arguments": {...}}, as a Data part or a Text part holding that JSON. Unknown fields at either level are refused (DisallowUnknownFields) and so is trailing data, so a misspelled argument cannot silently become an empty one. -
Rejections are problems in the message, never JSON-RPC errors. A malformed request, an unknown skill or a bad argument is a 400 problem; a domain rejection has the same status classification as the REST adapter for the errors a read can raise (
internal/adapters/inbound/http/errors.go):not-foundis 404,validation-failedis 422 (an id that is not a valid id, a date that is not YYYY-MM-DD); anything else is a 500internal-errorwhose cause is logged and never returned (no DSN or SQL reaches the caller). ProblemtypeURIs share the REST namespace (https://retailnetwork.example/problems/<slug>); the adapter addsmalformed-request,unknown-skillandinvalid-argumentfor request-shape failures. A 409 or 503 cannot come out of the three queries, so the adapter has no branch for them; if a read ever grows one, the REST catalogue is the source to copy. -
One OTel span per skill run,
a2a.skill <id>with thea2a.skillattribute, like themcp.toolspans. -
No auth, no sibling calls. The Agent Card declares no security scheme, by the fleet-wide revert of 2026-09-11 (
TestNoAuthMiddlewareReintroducedalso scans this adapter); access control is the in-cluster ClusterIP boundary. The agent reads this context's own tables only and calls no other context over REST, MCP or A2A: no code outside tests may import the SDK's client (TestNoOutboundA2AClient). -
Boot.
DATABASE_URLandA2A_AGENT_URLare mandatory and checked before telemetry, the database or the listener open anything.A2A_AGENT_URLis the absolute http(s) URL the Agent Card advertises (in-clusterhttp://<release>-a2a.<namespace>.svc.cluster.local:8093/; the chart renders it,a2a.agentUrloverrides it);A2A_ADDR(default:8093;:8080is the api and:8090the mcp server),MIGRATIONS_DATABASE_URL,LOG_LEVEL,SERVICE_VERSION(also the card version),ENVIRONMENTand theOTEL_*variables complete the contract.
Consequences
- Another agent can ask "what became of the promise for order ord-1001, is it at risk, was it kept" and "how full is N-AUS3 on the 22nd" over a single goal-shaped call and get the REST views plus a one-line summary, without a bespoke REST client or an MCP session.
- The three surfaces cannot drift apart on what they may do: the A2A and MCP adapters share the read-only charter, and the REST adapter stays the only write path. A future write skill needs an MCP write first, an amendment of ADR 0007 and of this ADR, and would go through the use case and outbox like REST.
- A fourth Deployment per release (default OFF) on the cluster; the chart refuses
a2a.extraEnvthat brings back a*_MODE, the write side's Kafka/relay env or a variable the chart already renders. CLAUDE.md(the agent guide) must listcmd/a2a, theinternal/adapters/inbound/a2apackage and the chart'sa2acomponent; that edit is made by a human or a non-subagent session.