ADR 0009: A2A inbound adapter
Status
Accepted (2026-10-30).
Context
The fleet separates three transports with no overlap: Kafka with CloudEvents carries facts (ADR 0004), MCP carries one agent's tools (ADR 0006), and A2A (Agent2Agent) carries the delegation of a goal between agents. seller-inbound already has REST and a read-only MCP server over the same use cases. A delegating agent that wants "how compliant is this seller" or "where does this inbound stand" should be able to ask this context directly, in goal terms.
Decision
- A third driving adapter, a separate binary.
internal/adapters/inbound/a2ais built on the official A2A Go SDK (github.com/a2aproject/a2a-go/v2, pinned v2.7.0) and served bycmd/a2aover JSON-RPC 2.0 on HTTP, mounted at both/and/a2a, with the Agent Card at/.well-known/agent-card.jsonand an openGET /healthz. It is a message-only agent: both skills are transactional request/response reads, so there is no Task lifecycle. - READ-ONLY, because the MCP charter is read-only (ADR 0006). An A2A skill
may change state only if the context's MCP surface already offers that write.
It offers none, so the agent never writes and never widens what this context
exposes. Onboarding, suspending and reinstating sellers, the plan lifecycle,
packing cartons, labelling and shipping stay REST-only, with the
Idempotency-Keymiddleware and the transactional outbox. - Two curated, goal-shaped skills, derived from the MCP tools.
seller_compliance(sellerId, window?)answers the rolling-window compliance scorecard (fromget_seller_scorecard);inbound_status(planId | shipmentId)answers the state of one inbound plan or one inbound shipment (fromget_inbound_planandget_inbound_shipment).get_shipment_labelsis not offered: label data is a tool for an agent working on a shipment, not a delegation goal. The skills are not one per endpoint. - Input contract. The first message part is a Data part (or a Text part with
the same JSON)
{"skill": "<id>", "arguments": {...}}. It is decoded strictly (DisallowUnknownFields, trailing data refused), so a misspelled argument is refused instead of silently dropped (a typo ofwindowmust not fall back to 30d). - Rejections are answered in-band. Domain rejections and bad requests come
back as an RFC 7807-shaped
probleminside the message envelope ({"skill", "problem": {type, title, detail, status}}), never as JSON-RPC errors. The classification is the REST adapter's for the errors a read can raise: unknown seller, plan or shipment is 404not-found, a window other than 7d or 30d is 400invalid-window, other value validation is 422validation-failedand anything else is 500internal-error(the internal error is logged, never sent). Request-shape problems (unknown skill, missing or unknown argument, malformed part) are 400. REST's 409 classes belong to writes this agent does not offer, and its 503 is the readiness probe's. Detail texts are adapter-owned. - Answer shape. One agent Message carrying a Data part (the envelope with
DTOs in the REST/MCP lowerCamelCase shapes; a rate with a zero denominator is
omitted) and a Text part (a one-line summary), bound to the caller's
contextId. One OTel span per skill,
a2a.skill <id>with the attributea2a.skill, mirroringmcp.tool. - Read-only is structural. The adapter holds
Reads, an interface of three read use cases, and nothing that can write.cmd/a2ais composed likecmd/mcp: only the read repositories, no unit of work, outbox, inbox or SSCC issuer, no outbox relay, no Kafka (noKAFKA_BROKERS,EVENT_PUBLISHERor consumer groups).internal/architecture/a2a_fitness_test.gopins the dependency rule (application and domain only, nothing depends on the adapter), the absence of an outbound A2A client and of write use cases. - No auth, no sibling calls. The Agent Card declares no security schemes: A2A is unauthenticated like REST and MCP (the fleet-wide revert of 2026-09-11), and access control is the in-cluster ClusterIP boundary. The agent reads this context's own tables only and makes no REST, MCP or A2A call to a sibling context.
- Boot and deployment.
DATABASE_URLandA2A_AGENT_URLare mandatory (a boot error naming the variable; the URL must be an absolute http(s) URL, since the card advertises it).A2A_ADDRdefaults to:8093. The binary runs the idempotent embedded migrations on start, likecmd/mcp. The chart gets an a2a Deployment, Service and optional HTTPRoute (/api/a2a/seller-inbound, rewritten to/) behinda2a.enabled(default off);A2A_AGENT_URLdefaults to the in-cluster Service DNS name and is overridden bya2a.agentUrl.
Consequences
- A delegating agent can discover this context from its Agent Card and ask the two goal questions without REST or MCP glue, and sees the same problem slugs and status classes a REST caller would.
- A2A never becomes a data-sync channel: facts still leave only as CloudEvents through the transactional outbox, and this agent adds no outbox row.
- Adding a skill, and above all a write skill, is a reviewed act: the MCP surface must offer the same write first, and this ADR is amended.
- One more Deployment per environment when
a2a.enabledis on.