ADR 0013: A2A inbound adapter (read-only, unauthenticated, additive)
Status
Accepted (2026-10-29). Follows ADR 0005 (the read-only MCP adapter this one is modelled on and whose charter it inherits), ADR 0004 (CloudEvents on every Kafka message) and ADR 0011 (Postgres and Kafka are the only runtime). Mirrors the fleet's reference rollouts (workforce-management ADR 0039, wes-work-planning ADR 0046), minus the write skill: this context's agent surface is read-only.
Context
The fleet is adopting the Agent2Agent protocol so that a bounded context can delegate a goal to another context's agent. slotting-optimization already exposes its use cases over REST and, read-only, over MCP (ADR 0005). 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 (here: four reads) |
| A2A | delegation of a goal to another context's agent; never data sync |
The two goals a delegating agent has for this context are the two things the ADR 0005 reads exist for: where is each SKU slotted right now? and what does this plan change, and how far has it been executed?
Decision
-
Add
internal/adapters/inbound/a2a, a third driving adapter over the same read use cases (GetPlan,ListPlans,ListForwardSlots) as the REST and MCP adapters, built on the officiala2aproject/a2a-go/v2SDK (pinned v2.7.0) and served by a newcmd/a2abinary: JSON-RPC 2.0 over HTTP, port 8093, the Agent Card at/.well-known/agent-card.json, the endpoint mounted at/and/a2a,GET /healthz.A2A_AGENT_URL(the absolute http(s) URL the card advertises) is mandatory: a missing or relative value is refused at boot before telemetry, any connection and the listener. -
The agent is READ-ONLY, because the MCP charter is. ADR 0005 point 3 keeps generating, approving and rejecting a plan REST-only: those are the operations whose events other contexts consume, whose idempotency is keyed by
Idempotency-Key, whose version guard isIf-Matchand whose approval is the human decision of ADR 0002. An agent-initiated write would be a second front door to the outbox and a way for software to approve its own proposal. The A2A surface therefore offers no write skill, andinternal/adapters/inbound/a2a/governance_test.gofails the build ifDepsgains a use case beyond the three reads, if the adapter imports any package beyond the read use cases' package, the repository error sentinels and the plan value errors, or if a skill id carries a write verb (generate,approve,reject,create,update,delete,set,assign). Widening it is a reviewed act: an amendment of this ADR and of ADR 0005. -
Two curated, goal-shaped skills, derived from the MCP tools (not one skill per endpoint):
Skill Kind Composed from What it does forward_slot_mapread get_forward_slotsthe assignments ( sku,slot,abcClass,pickUnit,casesCapacity) of the site's Approved plan, with itsplanIdandapprovedAt; a site without an Approved plan yields an empty map and noplanId, not a problem.siteIddefaults to the service's default site.slot_plan_reviewread get_slot_plan,list_slot_plansone plan in full: state, policy, window, decision instants, assignments, moves, unassigned SKUs and execution progress (ADR 0010). With planIdthat plan; without it the NEWEST plan matching the optionalsiteIdandstate(the two MCP reads composed, so the caller need not page).planIdcannot be combined with the filters.get_sku_velocity(demand the planner works from, not a goal a peer delegates) is deliberately not offered. -
Message-only, answered in-band. Both skills are transactional request/response reads, so the agent has no Task lifecycle. Domain rejections and malformed requests are answered as RFC 7807-shaped
problems inside the message envelope ({skill, data | problem}in a data part plus a one-line text part), never raised as JSON-RPC errors, with the same classification and slugs as the REST adapter (problemCatalogue, shared problem base URI):400invalid-plan-id,invalid-site-id(also when no site is given and no default is configured),invalid-state,404plan-not-found(an unknown plan id, or no plan matching the filters ofslot_plan_review) and500internal-errorwith a generic detail so no infrastructure text (DSNs, SQL) reaches the caller. REST's409entries (plan-not-draft,approved-plan-conflict,concurrent-modification) are write-only and unreachable here, and there is no503because no skill calls a dependency. Adapter-owned400s cover the request shape:unknown-skill,malformed-skill-request,invalid-argument. -
Strict input. Requests are decoded with
DisallowUnknownFieldsand trailing data is refused, so a misspelled optional argument (statforstate) can never silently widen the question and answer for a different plan. Go'sencoding/jsonmatches names case-insensitively, so only genuinely unknown names are refused. Arguments are camelCase like the REST contract and carry only the canonical keys (siteId,planId,state): no shared domain error text names a deprecated alias, so no answer-rewriting was needed. -
cmd/a2ais a read-only composition root cloned fromcmd/mcpby a script of asserted exact replacements. Likecmd/mcpit wires no write use case, so it can never insert into the outbox; it therefore starts no outbox relay, runs no local-copy consumer and never dials Kafka (noEVENT_PUBLISHER, noKAFKA_BROKERS, no consumer group). This differs from the reference rollouts whose A2A binary shares an outbox publisher for its write skill: here a delegated read leaves no fact, and nothing else needs to leave. Postgres is the only runtime (ADR 0011):DATABASE_URLis mandatory, there is no in-memory path (TestRuntimeBinaryHasNoInMemoryAdaptersscanscmd/a2atoo), and the idempotent embedded migrations run on boot (throughMIGRATIONS_DATABASE_URLwhen set) exactly as incmd/mcp. -
Unauthenticated, like REST and MCP (fleet-wide revert 2026-09-11). The card declares no security schemes and
TestNoAuthMiddlewareReintroducedscans the adapter (internal/adapters/inbound/**);cmd/a2aships no middleware beyond tracing and metrics. Access control is the in-clusterClusterIPboundary. -
Layering.
TestA2AAdapterDependencyRulekeeps the adapter additive: it depends only on the application and domain layers and nothing else imports it. Each skill run opens an OTel spana2a.skill <id>(attributea2a.skill), mirroringmcp.tool <name>. -
Packaging. The image already builds every
cmd/*binary, so/app/a2aships next to/app/mcp. The chart renders ana2aDeployment + ClusterIP Service (componenta2a,<release>-a2a, command/app/a2a) and an optional KongHTTPRouteonly whena2a.enabled=true(default false).A2A_AGENT_URLdefaults tohttp://<release>-a2a.<ns>.svc.cluster.local:8093/and is overridable witha2a.agentUrl; the route/api/a2a/slotting-optimizationis rewritten to/, so the card stays reachable through the gateway. Port 8093 is the fleet's A2A port (8090 is mcp, 8091 the projector admin port, 8092 the reports API). Like mcp there is no HPA: the agent is a single replica until a load reason appears.
Consequences
- An agent can delegate "where is SKU-1 slotted?" and "what did the pending plan change?" to this context without a REST or MCP client, and can never generate, approve or reject a plan, or emit an event, by doing so.
- The same two questions are answerable over MCP; A2A adds goal-shaped composition (the latest-plan form) and an in-band problem vocabulary, not new data. Keeping the contracts apart avoids a third place where a read model can drift: all three adapters call the same use cases.
- A write skill (for example delegating plan generation) would need its own
ADR: the
Idempotency-KeyandIf-Matchguards would have to be carried in the message, the human approval of ADR 0002 stays outside any agent surface, andcmd/a2awould then need the outbox publisher andKAFKA_BROKERSthat the reference rollouts wire. slot_plan_reviewwithout aplanIdreads the newest plan bygenerated_at; two plans generated in the same instant order by id, as the list endpoint does.- Three binaries now read the slotting tables; the a2a one holds no write
credentials beyond what the shared
DATABASE_URLgrants (a read-only database role is possible later without code changes, as for mcp).
Alternatives considered and rejected
- A write skill (
generate_slot_plan,approve_slot_plan): rejected; see point 2. It would widen what the context exposes beyond ADR 0005. - One skill per MCP tool (four skills): rejected; the fleet curates at most
two goal-shaped skills per agent, and plan listing is only ever asked to find
the plan that
slot_plan_reviewthen reads. - Serve A2A from
cmd/mcporcmd/api: couples scaling and failure domains of surfaces the fleet deploys independently. - Wire the outbox publisher "just in case": a binary without a write use case needs no Kafka; omitting it keeps the pod's blast radius and its env (and the chart test that proves it) minimal.