ADR 0011: A2A inbound adapter
Status
Accepted (2026-10-30).
Context
The fleet's contexts are reachable by agents through MCP (ADR 0008) and exchange facts as CloudEvents on Kafka. A third transport, Agent2Agent (A2A), carries the delegation of a goal from one agent to another: "which departures leave node n-a tomorrow and how full are they" is a goal a sibling agent can hand to this context without knowing its REST or MCP contract. The three transports do not overlap: Kafka + CloudEvents carries FACTS, MCP carries an agent's TOOLS, A2A carries DELEGATION only, never data sync.
This context's MCP charter is entirely read-only (ADR 0008: list_departures, get_departure; every write stays REST with
Idempotency-Key). An A2A skill may change state only if the same write is already offered over MCP, so the A2A agent is read-only too.
Delegation must never widen what the context exposes.
Decision
- A third driving adapter, a separate binary.
internal/adapters/inbound/a2ais built on the official A2A Go SDK (github.com/a2aproject/a2a-go/v2v2.7.0) and served bycmd/a2aas JSON-RPC over HTTP: the Agent Card at/.well-known/agent-card.json, the JSON-RPC endpoint at both/and/a2a, an openGET /healthz. It is a third deployable besidecmd/apiandcmd/mcp; the Helm chart gets ana2aDeployment, Service and an opt-in Kong HTTPRoute (/api/a2a/linehaul-transportationrewritten to/), all default-off (a2a.enabled). - Message-only agent, two curated read skills. The skills are the goal-shaped twins of the MCP tools, with the same ids and the same
use cases (
ListDepartures,GetDeparture):list_departures(origin?, destination?, from?, to?, limit?)andget_departure(departureId). A request is{"skill":"<id>","arguments":{...}}in a Data part (or a Text part holding the same JSON); the answer is one agent Message with a Data part ({skill, data | problem}) and a one-line Text summary. Nothing here is one skill per endpoint, and adding a skill is an amendment of this ADR. - Strict input, in-band problems. Arguments decode with
DisallowUnknownFieldsand trailing data is refused, so a misspelled name never silently falls back to a default. Domain rejections and bad requests are ANSWERED in the message envelope as RFC 7807-shapedproblems, never as JSON-RPC errors, with the REST adapter's classification andtypenamespace (https://retailnetwork.example/problems/): 404not-found, 422validation-failed(the REST class for a rejected query), 500internal-error; adapter problems are 400malformed-request,unknown-skillandinvalid-argument. The REST 409 classes belong to writes and are unreachable. Not-found and internal details are adapter-owned text, so neither the shared error wording nor infrastructure detail (DSNs, SQL) reaches a caller; the cause of a 500 is logged. One OpenTelemetry span per skill carries thea2a.skillattribute. - Read-only is structural. The adapter's
DepsholdsDepartureReader, a local interface with exactly the two REST reads;cmd/a2a'susecases.Depsliteral sets only the departure repository.internal/architecture/a2a_fitness_test.gopins the dependency rule (the adapter depends only on application and domain; nothing depends on it; no outbound A2A client; no sibling-context call) and the read-only allowlist ofusecasesidentifiers, with a self-test that the sensor bites (TestA2AAdapterDependencyRule,TestA2AAdapterIsReadOnly,TestA2AReadOnlySensorBites). - No auth, no workers, no Kafka. The endpoints are unauthenticated by the fleet-wide decision (2026-09-11); the card declares no security
schemes.
cmd/a2anever dials Kafka, runs no outbox relay, no horizon roll and no consumer, so it has noKAFKA_BROKERSorEVENT_PUBLISHER; a delegated write would have to go through the same use case and transactional outbox, but there is none. - Boot.
DATABASE_URLis mandatory (real Postgres only) and so isA2A_AGENT_URL, the absolute http(s) URL advertised on the card (the process refuses to boot otherwise: a card nobody can dial is worse than none).A2A_ADDRdefaults to:8093(8080 api, 8090 mcp). The chart defaultsA2A_AGENT_URLtohttp://<release>-a2a.<namespace>.svc.cluster.local:8093/, overridable witha2a.agentUrl. Likecmd/apiandcmd/mcpthe binary runs the idempotent embedded migrations on start (MIGRATIONS_DATABASE_URLfor a direct DSN).
Consequences
- A delegating agent can ask for the departure horizon or one departure's status without a REST or MCP client for this context.
- The chart tests (
render_test.sh,test_service_selectors.py) assert the a2a component: command/app/a2a, the mandatory env, no Kafka/relay/consumer env,component=a2aselectors, the route rewrite and its absence by default. - Scheduling lanes, cancelling or re-capacitating a departure and the load lifecycle stay REST operations; there is no outbound A2A client.
- No integration test with outbox rows is needed: the agent has no write skill.