Class A2aProtocolClient
- All Implemented Interfaces:
com.xebialabs.xlrelease.osgi.api.a2a.A2aTransportExtension,com.xebialabs.xlrelease.osgi.api.spring.HostExtensionPoint
HttpClient, speaking A2A 1.0.
Implements A2aTransportExtension so the gateway treats it exactly like a
bundle-contributed transport — it is simply the fallback used when no transport bundle is
installed. Nothing above this class touches HTTP or the JSON-RPC envelope; nothing in this class
knows about policy — allowlisting and feature checks belong to the gateway.
1.0, not 0.3. The two differ in every shape this class touches — the card carries
supportedInterfaces instead of a top-level url, methods are SendMessage /
GetTask / CancelTask instead of message/send / tasks/get /
tasks/cancel, a SendMessage result is a task / message oneof
instead of an inlined task, roles are ROLE_USER / ROLE_AGENT, states are
TASK_STATE_*, and text parts have lost their kind discriminator. The version is
negotiated by the A2A-Version header, and a request that omits it is read as 0.3 — a
spec-compliant 1.0 agent then rejects the call before it reads the body, so that header is
mandatory rather than informational.
Strict out, lenient in. Requests are built as a2a-java-sdk-spec types and
written by the SDK's own mapper, because 1.0 discriminates its oneofs by member name and only
that mapper writes them properly — sending the wrong shape is the bug this class exists to stop
making. Responses are read as a JSON tree instead. The SDK's records validate in their compact
constructors, so a Task whose status.state this SDK revision does not recognise
fails to construct at all; reading leniently keeps the documented behaviour that an unknown state
degrades to A2aTaskState.UNKNOWN and the caller keeps polling, rather than a remote agent
on a newer spec revision breaking every task in Release. Only five fields are taken from a
response, so there is nothing to gain from typing that side and a robustness property to lose.
The full SDK (with vertx, gRPC and CDI behind it) belongs in a transport bundle, where
OSGi classloader isolation keeps its dependency stack off the host classpath — that is what
test-plugins/a2a-sdk-transport-plugin is for. Only the spec and JSON-RPC-envelope modules
are on this classpath: types and a Gson mapper, nothing else.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringWell-known Agent Card path per the A2A specification. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.xebialabs.xlrelease.a2a.api.views.A2aTaskViewcancelTask(String endpointUrl, String taskId, String bearerToken) com.xebialabs.xlrelease.a2a.api.views.A2aAgentIdentityfetchAgentCard(String agentCardUrl, String bearerToken) com.xebialabs.xlrelease.a2a.api.views.A2aTaskViewcom.xebialabs.xlrelease.a2a.api.views.A2aSendResultsendMessage(String endpointUrl, com.xebialabs.xlrelease.a2a.api.views.A2aSendRequest request) com.xebialabs.xlrelease.a2a.api.views.A2aSendResultsendMessage(String endpointUrl, com.xebialabs.xlrelease.a2a.api.views.A2aSendRequest request, com.xebialabs.xlrelease.a2a.api.views.A2aCallback callback)
-
Field Details
-
AGENT_CARD_PATH
Well-known Agent Card path per the A2A specification.- See Also:
-
-
Constructor Details
-
A2aProtocolClient
public A2aProtocolClient()
-
-
Method Details
-
fetchAgentCard
public com.xebialabs.xlrelease.a2a.api.views.A2aAgentIdentity fetchAgentCard(String agentCardUrl, String bearerToken) - Specified by:
fetchAgentCardin interfacecom.xebialabs.xlrelease.osgi.api.a2a.A2aTransportExtension
-
sendMessage
public com.xebialabs.xlrelease.a2a.api.views.A2aSendResult sendMessage(String endpointUrl, com.xebialabs.xlrelease.a2a.api.views.A2aSendRequest request) - Specified by:
sendMessagein interfacecom.xebialabs.xlrelease.osgi.api.a2a.A2aTransportExtension
-
sendMessage
public com.xebialabs.xlrelease.a2a.api.views.A2aSendResult sendMessage(String endpointUrl, com.xebialabs.xlrelease.a2a.api.views.A2aSendRequest request, com.xebialabs.xlrelease.a2a.api.views.A2aCallback callback) - Specified by:
sendMessagein interfacecom.xebialabs.xlrelease.osgi.api.a2a.A2aTransportExtension
-
getTask
public com.xebialabs.xlrelease.a2a.api.views.A2aTaskView getTask(String endpointUrl, String taskId, String bearerToken) - Specified by:
getTaskin interfacecom.xebialabs.xlrelease.osgi.api.a2a.A2aTransportExtension
-
cancelTask
public com.xebialabs.xlrelease.a2a.api.views.A2aTaskView cancelTask(String endpointUrl, String taskId, String bearerToken) - Specified by:
cancelTaskin interfacecom.xebialabs.xlrelease.osgi.api.a2a.A2aTransportExtension
-