Skip to content

Commit aef135b

Browse files
committed
feat!: update a2a.proto 0572953
based on commit a2aproject/A2A@0572953 spec-grpc module has been regenerated from the updated a2a.proto Key changes: * Agent card * extendedAgentCard is not specified by capabilities (instead of `supportsExtendedAgentCard` field) * protocolVersions is a list (instead of a single `protocolVersion`) * SendMessage * `msg` field is now named `message` * ListTask * timestamp is now named statusTimestampAfter instead of `lastUpdatedAfter` * OAuthFlows * `deviceCode` has been added, `implicit` & `password` have been removed * AuthorizationCodeOAuthFlow * new `pkce_required` boolean field Signed-off-by: Jeff Mesnil <jmesnil@ibm.com>
1 parent 7059c12 commit aef135b

64 files changed

Lines changed: 2240 additions & 4039 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎client/base/src/main/java/io/a2a/client/Client.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ public void resubscribe(@NonNull TaskIdParams request,
612612
*/
613613
@Override
614614
public AgentCard getAgentCard(@Nullable ClientCallContext context) throws A2AClientException {
615-
agentCard = clientTransport.getAgentCard(context);
615+
agentCard = clientTransport.getExtendedAgentCard(context);
616616
return agentCard;
617617
}
618618

‎client/transport/grpc/src/main/java/io/a2a/client/transport/grpc/EventStreamObserver.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ public EventStreamObserver(Consumer<StreamingEventKind> eventHandler, Consumer<T
2525
public void onNext(StreamResponse response) {
2626
StreamingEventKind event;
2727
switch (response.getPayloadCase()) {
28-
case MSG:
29-
event = FromProto.message(response.getMsg());
28+
case MESSAGE:
29+
event = FromProto.message(response.getMessage());
3030
break;
3131
case TASK:
3232
event = FromProto.task(response.getTask());

‎client/transport/grpc/src/main/java/io/a2a/client/transport/grpc/GrpcTransport.java‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ public EventKind sendMessage(MessageSendParams request, @Nullable ClientCallCont
104104
try {
105105
A2AServiceBlockingV2Stub stubWithMetadata = createBlockingStubWithMetadata(context, payloadAndHeaders);
106106
io.a2a.grpc.SendMessageResponse response = stubWithMetadata.sendMessage(sendMessageRequest);
107-
if (response.hasMsg()) {
108-
return FromProto.message(response.getMsg());
107+
if (response.hasMessage()) {
108+
return FromProto.message(response.getMessage());
109109
} else if (response.hasTask()) {
110110
return FromProto.task(response.getTask());
111111
} else {
@@ -195,8 +195,12 @@ public ListTasksResult listTasks(ListTasksParams request, @Nullable ClientCallCo
195195
if (request.historyLength() != null) {
196196
requestBuilder.setHistoryLength(request.historyLength());
197197
}
198-
if (request.lastUpdatedAfter() != null) {
199-
requestBuilder.setLastUpdatedAfter(request.lastUpdatedAfter().toEpochMilli());
198+
if (request.statusTimestampAfter() != null) {
199+
requestBuilder.setStatusTimestampAfter(
200+
com.google.protobuf.Timestamp.newBuilder()
201+
.setSeconds(request.statusTimestampAfter().getEpochSecond())
202+
.setNanos(request.statusTimestampAfter().getNano())
203+
.build());
200204
}
201205
if (request.includeArtifacts() != null) {
202206
requestBuilder.setIncludeArtifacts(request.includeArtifacts());
@@ -344,7 +348,7 @@ private MessageSendParams createRequestWithTenant(MessageSendParams request) {
344348
}
345349

346350
@Override
347-
public AgentCard getAgentCard(@Nullable ClientCallContext context) throws A2AClientException {
351+
public AgentCard getExtendedAgentCard(@Nullable ClientCallContext context) throws A2AClientException {
348352
// TODO: Determine how to handle retrieving the authenticated extended agent card
349353
return agentCard;
350354
}

‎client/transport/jsonrpc/src/main/java/io/a2a/client/transport/jsonrpc/JSONRPCTransport.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public JSONRPCTransport(@Nullable A2AHttpClient httpClient, @Nullable AgentCard
8888
this.agentCard = agentCard;
8989
this.agentInterface = agentInterface;
9090
this.interceptors = interceptors;
91-
this.needsExtendedCard = agentCard == null || agentCard.supportsExtendedAgentCard();
91+
this.needsExtendedCard = agentCard == null || agentCard.capabilities().extendedAgentCard();
9292
}
9393

9494
@Override
@@ -288,13 +288,13 @@ public void resubscribe(TaskIdParams request, Consumer<StreamingEventKind> event
288288
}
289289

290290
@Override
291-
public AgentCard getAgentCard(@Nullable ClientCallContext context) throws A2AClientException {
291+
public AgentCard getExtendedAgentCard(@Nullable ClientCallContext context) throws A2AClientException {
292292
A2ACardResolver resolver;
293293
try {
294294
if (agentCard == null) {
295295
resolver = new A2ACardResolver(httpClient, agentInterface.url(), agentInterface.tenant(), null, getHttpHeaders(context));
296296
agentCard = resolver.getAgentCard();
297-
needsExtendedCard = agentCard.supportsExtendedAgentCard();
297+
needsExtendedCard = agentCard.capabilities().extendedAgentCard();
298298
}
299299
if (!needsExtendedCard) {
300300
return agentCard;

‎client/transport/jsonrpc/src/test/java/io/a2a/client/transport/jsonrpc/JSONRPCTransportTest.java‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ public void testA2AClientGetAgentCard() throws Exception {
368368
);
369369

370370
JSONRPCTransport client = new JSONRPCTransport("http://localhost:4001");
371-
AgentCard agentCard = client.getAgentCard(null);
371+
AgentCard agentCard = client.getExtendedAgentCard(null);
372372
assertEquals("GeoSpatial Route Planner Agent", agentCard.name());
373373
assertEquals("Provides advanced route planning, traffic analysis, and custom map generation services. This agent can calculate optimal routes, estimate travel times considering real-time traffic, and create personalized maps with points of interest.", agentCard.description());
374374
assertEquals("https://georoute-agent.example.com/a2a/v1", Utils.getFavoriteInterface(agentCard).url());
@@ -379,6 +379,7 @@ public void testA2AClientGetAgentCard() throws Exception {
379379
assertTrue(agentCard.capabilities().streaming());
380380
assertTrue(agentCard.capabilities().pushNotifications());
381381
assertFalse(agentCard.capabilities().stateTransitionHistory());
382+
assertFalse(agentCard.capabilities().extendedAgentCard());
382383
Map<String, SecurityScheme> securitySchemes = agentCard.securitySchemes();
383384
assertNotNull(securitySchemes);
384385
OpenIdConnectSecurityScheme google = (OpenIdConnectSecurityScheme) securitySchemes.get("google");
@@ -417,9 +418,8 @@ public void testA2AClientGetAgentCard() throws Exception {
417418
assertEquals(inputModes, skills.get(1).inputModes());
418419
outputModes = List.of("image/png", "image/jpeg", "application/json", "text/html");
419420
assertEquals(outputModes, skills.get(1).outputModes());
420-
assertFalse(agentCard.supportsExtendedAgentCard());
421421
assertEquals("https://georoute-agent.example.com/icon.png", agentCard.iconUrl());
422-
assertEquals(CURRENT_PROTOCOL_VERSION, agentCard.protocolVersion());
422+
assertEquals(CURRENT_PROTOCOL_VERSION, agentCard.protocolVersions().get(0));
423423
assertEquals("JSONRPC", agentCard.supportedInterfaces().get(0).protocolBinding());
424424
List<AgentInterface> additionalInterfaces = agentCard.supportedInterfaces();
425425
assertEquals(3, additionalInterfaces.size());
@@ -456,7 +456,7 @@ public void testA2AClientGetAuthenticatedExtendedAgentCard() throws Exception {
456456
);
457457

458458
JSONRPCTransport client = new JSONRPCTransport("http://localhost:4001");
459-
AgentCard agentCard = client.getAgentCard(null);
459+
AgentCard agentCard = client.getExtendedAgentCard(null);
460460
assertEquals("GeoSpatial Route Planner Agent Extended", agentCard.name());
461461
assertEquals("Extended description", agentCard.description());
462462
assertEquals("https://georoute-agent.example.com/a2a/v1", Utils.getFavoriteInterface(agentCard).url());
@@ -467,6 +467,7 @@ public void testA2AClientGetAuthenticatedExtendedAgentCard() throws Exception {
467467
assertTrue(agentCard.capabilities().streaming());
468468
assertTrue(agentCard.capabilities().pushNotifications());
469469
assertFalse(agentCard.capabilities().stateTransitionHistory());
470+
assertTrue(agentCard.capabilities().extendedAgentCard());
470471
Map<String, SecurityScheme> securitySchemes = agentCard.securitySchemes();
471472
assertNotNull(securitySchemes);
472473
OpenIdConnectSecurityScheme google = (OpenIdConnectSecurityScheme) securitySchemes.get("google");
@@ -509,9 +510,8 @@ public void testA2AClientGetAuthenticatedExtendedAgentCard() throws Exception {
509510
assertEquals("Extended Skill", skills.get(2).name());
510511
assertEquals("This is an extended skill.", skills.get(2).description());
511512
assertEquals(List.of("extended"), skills.get(2).tags());
512-
assertTrue(agentCard.supportsExtendedAgentCard());
513513
assertEquals("https://georoute-agent.example.com/icon.png", agentCard.iconUrl());
514-
assertEquals(CURRENT_PROTOCOL_VERSION, agentCard.protocolVersion());
514+
assertEquals(CURRENT_PROTOCOL_VERSION, agentCard.protocolVersions().get(0));
515515
}
516516

517517
@Test

‎client/transport/jsonrpc/src/test/java/io/a2a/client/transport/jsonrpc/JsonMessages.java‎

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public class JsonMessages {
1010

1111
static final String AGENT_CARD = String.format("""
1212
{
13-
"protocolVersion": "%s",
13+
"protocolVersions": ["%s"],
1414
"name": "GeoSpatial Route Planner Agent",
1515
"description": "Provides advanced route planning, traffic analysis, and custom map generation services. This agent can calculate optimal routes, estimate travel times considering real-time traffic, and create personalized maps with points of interest.",
1616
"supportedInterfaces" : [
@@ -28,7 +28,8 @@ public class JsonMessages {
2828
"capabilities": {
2929
"streaming": true,
3030
"pushNotifications": true,
31-
"stateTransitionHistory": false
31+
"stateTransitionHistory": false,
32+
"extendedAgentCard": false
3233
},
3334
"securitySchemes": {
3435
"google": {
@@ -75,7 +76,6 @@ public class JsonMessages {
7576
]
7677
}
7778
],
78-
"supportsExtendedAgentCard": false,
7979
"signatures": [
8080
{
8181
"protected": "eyJhbGciOiJFUzI1NiIsInR5cCI6IkpPU0UiLCJraWQiOiJrZXktMSIsImprdSI6Imh0dHBzOi8vZXhhbXBsZS5jb20vYWdlbnQvandrcy5qc29uIn0",
@@ -609,8 +609,10 @@ public class JsonMessages {
609609
"documentationUrl": "https://docs.examplegeoservices.com/georoute-agent/api",
610610
"capabilities": {
611611
"streaming": true,
612+
"extendedAgentCard": true,
612613
"pushNotifications": true,
613-
"stateTransitionHistory": false
614+
"stateTransitionHistory": false,
615+
"extendedAgentCard": true
614616
},
615617
"securitySchemes": {
616618
"google": {
@@ -663,8 +665,7 @@ public class JsonMessages {
663665
"tags": ["extended"]
664666
}
665667
],
666-
"supportsExtendedAgentCard": true,
667-
"protocolVersion": "%s",
668+
"protocolVersions": ["%s"],
668669
"signatures": [
669670
{
670671
"protected": "eyJhbGciOiJFUzI1NiIsInR5cCI6IkpPU0UiLCJraWQiOiJrZXktMSIsImprdUI6Imh0dHBzOi8vZXhhbXBsZS5jb20vYWdlbnQvandrcy5qc29uIn0",
@@ -691,7 +692,8 @@ public class JsonMessages {
691692
"capabilities": {
692693
"streaming": true,
693694
"pushNotifications": true,
694-
"stateTransitionHistory": false
695+
"stateTransitionHistory": false,
696+
"extendedAgentCard": true
695697
},
696698
"securitySchemes": {
697699
"google": {
@@ -738,7 +740,6 @@ public class JsonMessages {
738740
]
739741
}
740742
],
741-
"supportsExtendedAgentCard": true,
742-
"protocolVersion": "%s"
743+
"protocolVersions": ["%s"]
743744
}""", CURRENT_PROTOCOL_VERSION);
744745
}

‎client/transport/rest/src/main/java/io/a2a/client/transport/rest/RestTransport.java‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ public EventKind sendMessage(MessageSendParams messageSendParams, @Nullable Clie
8989
String httpResponseBody = sendPostRequest(Utils.buildBaseUrl(agentInterface, messageSendParams.tenant()) + "/message:send", payloadAndHeaders);
9090
io.a2a.grpc.SendMessageResponse.Builder responseBuilder = io.a2a.grpc.SendMessageResponse.newBuilder();
9191
JsonFormat.parser().merge(httpResponseBody, responseBuilder);
92-
if (responseBuilder.hasMsg()) {
93-
return ProtoUtils.FromProto.message(responseBuilder.getMsg());
92+
if (responseBuilder.hasMessage()) {
93+
return ProtoUtils.FromProto.message(responseBuilder.getMessage());
9494
}
9595
if (responseBuilder.hasTask()) {
9696
return ProtoUtils.FromProto.task(responseBuilder.getTask());
@@ -416,14 +416,10 @@ public void resubscribe(TaskIdParams request, Consumer<StreamingEventKind> event
416416
}
417417

418418
@Override
419-
public AgentCard getAgentCard(@Nullable ClientCallContext context) throws A2AClientException {
419+
public AgentCard getExtendedAgentCard(@Nullable ClientCallContext context) throws A2AClientException {
420420
A2ACardResolver resolver;
421421
try {
422-
if (agentCard == null) {
423-
resolver = new A2ACardResolver(httpClient, agentInterface.url(), agentInterface.tenant(), null, getHttpHeaders(context));
424-
agentCard = resolver.getAgentCard();
425-
needsExtendedCard = agentCard.supportsExtendedAgentCard();
426-
}
422+
// FIXME
427423
if (!needsExtendedCard) {
428424
return agentCard;
429425
}

‎client/transport/rest/src/main/java/io/a2a/client/transport/rest/sse/RestSSEEventListener.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ public void onError(Throwable throwable, @Nullable Future<Void> future) {
4747
private void handleMessage(StreamResponse response) {
4848
StreamingEventKind event;
4949
switch (response.getPayloadCase()) {
50-
case MSG ->
51-
event = ProtoUtils.FromProto.message(response.getMsg());
50+
case MESSAGE ->
51+
event = ProtoUtils.FromProto.message(response.getMessage());
5252
case TASK ->
5353
event = ProtoUtils.FromProto.task(response.getTask());
5454
case STATUS_UPDATE ->

‎client/transport/spi/src/main/java/io/a2a/client/transport/spi/ClientTransport.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,13 @@ void resubscribe(TaskIdParams request, Consumer<StreamingEventKind> eventConsume
137137
Consumer<Throwable> errorConsumer, @Nullable ClientCallContext context) throws A2AClientException;
138138

139139
/**
140-
* Retrieve the AgentCard.
140+
* Retrieve the extended AgentCard.
141141
*
142142
* @param context optional client call context for the request (may be {@code null})
143-
* @return the AgentCard
143+
* @return the extended agent card
144144
* @throws A2AClientException if retrieving the agent card fails for any reason
145145
*/
146-
AgentCard getAgentCard(@Nullable ClientCallContext context) throws A2AClientException;
146+
AgentCard getExtendedAgentCard(@Nullable ClientCallContext context) throws A2AClientException;
147147

148148
/**
149149
* Close the transport and release any associated resources.

‎examples/helloworld/client/src/main/java/io/a2a/examples/helloworld/HelloWorldClient.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public static void main(String[] args) {
4040
System.out.println("Using public agent card for client initialization (default).");
4141
finalAgentCard = publicAgentCard;
4242

43-
if (publicAgentCard.supportsExtendedAgentCard()) {
43+
if (publicAgentCard.capabilities().extendedAgentCard()) {
4444
System.out.println("Public card supports authenticated extended card. Attempting to fetch from: " + SERVER_URL + "/agent/authenticatedExtendedCard");
4545
Map<String, String> authHeaders = new HashMap<>();
4646
authHeaders.put("Authorization", "Bearer dummy-token-for-extended-card");

0 commit comments

Comments
 (0)