Skip to content

Commit 7dc938a

Browse files
committed
feat: Set current protocol version to 1.0
Update usage of protocol version to use a constant rather than hard coding
1 parent a2499fb commit 7dc938a

File tree

17 files changed

+107
-83
lines changed

17 files changed

+107
-83
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public class WeatherAgentCardProducer {
132132
.tags(Collections.singletonList("weather"))
133133
.examples(List.of("weather in LA, CA"))
134134
.build()))
135-
.protocolVersion("0.3.0")
135+
.protocolVersion(io.a2a.spec.AgentCard.CURRENT_PROTOCOL_VERSION)
136136
.build();
137137
}
138138
}

client/base/src/test/java/io/a2a/client/AuthenticationAuthorizationTest.java

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
package io.a2a.client;
22

3+
import static io.a2a.spec.AgentCard.CURRENT_PROTOCOL_VERSION;
4+
import static org.junit.jupiter.api.Assertions.assertThrows;
5+
import static org.junit.jupiter.api.Assertions.assertTrue;
6+
import static org.mockserver.model.HttpRequest.request;
7+
import static org.mockserver.model.HttpResponse.response;
8+
9+
import java.io.IOException;
10+
import java.util.Collections;
11+
import java.util.concurrent.CountDownLatch;
12+
import java.util.concurrent.TimeUnit;
13+
import java.util.concurrent.atomic.AtomicReference;
14+
import java.util.function.Consumer;
15+
316
import io.a2a.client.config.ClientConfig;
417
import io.a2a.client.transport.grpc.GrpcTransport;
518
import io.a2a.client.transport.grpc.GrpcTransportConfigBuilder;
@@ -30,18 +43,6 @@
3043
import org.junit.jupiter.api.Test;
3144
import org.mockserver.integration.ClientAndServer;
3245

33-
import java.io.IOException;
34-
import java.util.Collections;
35-
import java.util.concurrent.CountDownLatch;
36-
import java.util.concurrent.TimeUnit;
37-
import java.util.concurrent.atomic.AtomicReference;
38-
import java.util.function.Consumer;
39-
40-
import static org.junit.jupiter.api.Assertions.assertThrows;
41-
import static org.junit.jupiter.api.Assertions.assertTrue;
42-
import static org.mockserver.model.HttpRequest.request;
43-
import static org.mockserver.model.HttpResponse.response;
44-
4546
/**
4647
* Tests for handling HTTP 401 (Unauthorized) and 403 (Forbidden) responses
4748
* when the client sends streaming and non-streaming messages.
@@ -89,7 +90,7 @@ public void setUp() {
8990
.description("Test skill")
9091
.tags(Collections.singletonList("test"))
9192
.build()))
92-
.protocolVersion("0.3.0")
93+
.protocolVersion(CURRENT_PROTOCOL_VERSION)
9394
.supportedInterfaces(java.util.Arrays.asList(
9495
new AgentInterface(TransportProtocol.JSONRPC.asString(), AGENT_URL),
9596
new AgentInterface(TransportProtocol.HTTP_JSON.asString(), AGENT_URL),

client/base/src/test/java/io/a2a/client/ClientBuilderTest.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
package io.a2a.client;
22

3+
import static io.a2a.spec.AgentCard.CURRENT_PROTOCOL_VERSION;
4+
5+
import java.util.Collections;
6+
import java.util.List;
7+
38
import io.a2a.client.config.ClientConfig;
49
import io.a2a.client.http.JdkA2AHttpClient;
510
import io.a2a.client.transport.grpc.GrpcTransport;
@@ -16,9 +21,6 @@
1621
import org.junit.jupiter.api.Assertions;
1722
import org.junit.jupiter.api.Test;
1823

19-
import java.util.Collections;
20-
import java.util.List;
21-
2224
public class ClientBuilderTest {
2325

2426
private AgentCard card = AgentCard.builder()
@@ -40,7 +42,7 @@ public class ClientBuilderTest {
4042
.tags(Collections.singletonList("hello world"))
4143
.examples(List.of("hi", "hello world"))
4244
.build()))
43-
.protocolVersion("0.3.0")
45+
.protocolVersion(CURRENT_PROTOCOL_VERSION)
4446
.supportedInterfaces(List.of(
4547
new AgentInterface(TransportProtocol.JSONRPC.asString(), "http://localhost:9999")))
4648
.build();

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import static io.a2a.client.transport.jsonrpc.JsonMessages.SEND_MESSAGE_WITH_MIXED_PARTS_TEST_RESPONSE;
2525
import static io.a2a.client.transport.jsonrpc.JsonMessages.SET_TASK_PUSH_NOTIFICATION_CONFIG_TEST_REQUEST;
2626
import static io.a2a.client.transport.jsonrpc.JsonMessages.SET_TASK_PUSH_NOTIFICATION_CONFIG_TEST_RESPONSE;
27+
import static io.a2a.spec.AgentCard.CURRENT_PROTOCOL_VERSION;
2728
import static org.junit.jupiter.api.Assertions.assertEquals;
2829
import static org.junit.jupiter.api.Assertions.assertFalse;
2930
import static org.junit.jupiter.api.Assertions.assertInstanceOf;
@@ -43,6 +44,7 @@
4344
import io.a2a.spec.AgentInterface;
4445
import io.a2a.spec.AgentSkill;
4546
import io.a2a.spec.Artifact;
47+
import io.a2a.spec.AuthenticationInfo;
4648
import io.a2a.spec.DataPart;
4749
import io.a2a.spec.EventKind;
4850
import io.a2a.spec.FileContent;
@@ -55,7 +57,6 @@
5557
import io.a2a.spec.MessageSendParams;
5658
import io.a2a.spec.OpenIdConnectSecurityScheme;
5759
import io.a2a.spec.Part;
58-
import io.a2a.spec.AuthenticationInfo;
5960
import io.a2a.spec.PushNotificationConfig;
6061
import io.a2a.spec.SecurityScheme;
6162
import io.a2a.spec.Task;
@@ -66,7 +67,6 @@
6667
import io.a2a.spec.TextPart;
6768
import io.a2a.spec.TransportProtocol;
6869
import io.a2a.util.Utils;
69-
7070
import org.junit.jupiter.api.AfterEach;
7171
import org.junit.jupiter.api.BeforeEach;
7272
import org.junit.jupiter.api.Test;
@@ -420,7 +420,7 @@ public void testA2AClientGetAgentCard() throws Exception {
420420
assertEquals(outputModes, skills.get(1).outputModes());
421421
assertFalse(agentCard.supportsAuthenticatedExtendedCard());
422422
assertEquals("https://georoute-agent.example.com/icon.png", agentCard.iconUrl());
423-
assertEquals("0.2.9", agentCard.protocolVersion());
423+
assertEquals(CURRENT_PROTOCOL_VERSION, agentCard.protocolVersion());
424424
assertEquals("JSONRPC", agentCard.supportedInterfaces().get(0).protocolBinding());
425425
List<AgentInterface> additionalInterfaces = agentCard.supportedInterfaces();
426426
assertEquals(3, additionalInterfaces.size());
@@ -513,7 +513,7 @@ public void testA2AClientGetAuthenticatedExtendedAgentCard() throws Exception {
513513
assertEquals(List.of("extended"), skills.get(2).tags());
514514
assertTrue(agentCard.supportsAuthenticatedExtendedCard());
515515
assertEquals("https://georoute-agent.example.com/icon.png", agentCard.iconUrl());
516-
assertEquals("0.2.5", agentCard.protocolVersion());
516+
assertEquals(CURRENT_PROTOCOL_VERSION, agentCard.protocolVersion());
517517
}
518518

519519
@Test

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

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
package io.a2a.client.transport.jsonrpc;
22

3+
import static io.a2a.spec.AgentCard.CURRENT_PROTOCOL_VERSION;
4+
5+
import io.a2a.spec.AgentCard;
6+
37
/**
48
* Request and response messages used by the tests. These have been created following examples from
59
* the <a href="https://google.github.io/A2A/specification/sample-messages">A2A sample messages</a>.
610
*/
711
public class JsonMessages {
812

9-
static final String AGENT_CARD = """
13+
static final String AGENT_CARD = String.format("""
1014
{
11-
"protocolVersion": "0.2.9",
15+
"protocolVersion": "%s",
1216
"name": "GeoSpatial Route Planner Agent",
1317
"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.",
1418
"supportedInterfaces" : [
@@ -80,7 +84,7 @@ public class JsonMessages {
8084
"signature": "QFdkNLNszlGj3z3u0YQGt_T9LixY3qtdQpZmsTdDHDe3fXV9y9-B3m2-XgCpzuhiLt8E0tV6HXoZKHv4GtHgKQ"
8185
}
8286
]
83-
}""";
87+
}""", CURRENT_PROTOCOL_VERSION);
8488

8589
static final String AUTHENTICATION_EXTENDED_AGENT_CARD = """
8690
{
@@ -668,7 +672,7 @@ public class JsonMessages {
668672
}
669673
""";
670674

671-
static final String GET_AUTHENTICATED_EXTENDED_AGENT_CARD_RESPONSE = """
675+
static final String GET_AUTHENTICATED_EXTENDED_AGENT_CARD_RESPONSE = String.format("""
672676
{
673677
"jsonrpc": "2.0",
674678
"id": "1",
@@ -742,17 +746,17 @@ public class JsonMessages {
742746
}
743747
],
744748
"supportsAuthenticatedExtendedCard": true,
745-
"protocolVersion": "0.2.5",
749+
"protocolVersion": "%s",
746750
"signatures": [
747751
{
748752
"protected": "eyJhbGciOiJFUzI1NiIsInR5cCI6IkpPU0UiLCJraWQiOiJrZXktMSIsImprdUI6Imh0dHBzOi8vZXhhbXBsZS5jb20vYWdlbnQvandrcy5qc29uIn0",
749753
"signature": "QFdkNLNszlGj3z3u0YQGt_T9LixY3qtdQpZmsTdDHDe3fXV9y9-B3m2-XgCpzuhiLt8E0tV6HXoZKHv4GtHgKQ"
750754
}
751755
]
752756
}
753-
}""";
757+
}""", CURRENT_PROTOCOL_VERSION);
754758

755-
static final String AGENT_CARD_SUPPORTS_EXTENDED = """
759+
static final String AGENT_CARD_SUPPORTS_EXTENDED = String.format("""
756760
{
757761
"name": "GeoSpatial Route Planner Agent",
758762
"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.",
@@ -817,6 +821,6 @@ public class JsonMessages {
817821
}
818822
],
819823
"supportsAuthenticatedExtendedCard": true,
820-
"protocolVersion": "1.0.0"
821-
}""";
824+
"protocolVersion": "%s"
825+
}""", CURRENT_PROTOCOL_VERSION);
822826
}

client/transport/rest/src/test/java/io/a2a/client/transport/rest/RestTransportTest.java

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@
66
import static io.a2a.client.transport.rest.JsonRestMessages.GET_TASK_PUSH_NOTIFICATION_CONFIG_TEST_RESPONSE;
77
import static io.a2a.client.transport.rest.JsonRestMessages.GET_TASK_TEST_RESPONSE;
88
import static io.a2a.client.transport.rest.JsonRestMessages.LIST_TASK_PUSH_NOTIFICATION_CONFIG_TEST_RESPONSE;
9+
import static io.a2a.client.transport.rest.JsonRestMessages.SEND_MESSAGE_STREAMING_TEST_REQUEST;
910
import static io.a2a.client.transport.rest.JsonRestMessages.SEND_MESSAGE_STREAMING_TEST_RESPONSE;
1011
import static io.a2a.client.transport.rest.JsonRestMessages.SEND_MESSAGE_TEST_REQUEST;
1112
import static io.a2a.client.transport.rest.JsonRestMessages.SEND_MESSAGE_TEST_RESPONSE;
12-
import static io.a2a.client.transport.rest.JsonRestMessages.SEND_MESSAGE_STREAMING_TEST_REQUEST;
1313
import static io.a2a.client.transport.rest.JsonRestMessages.SET_TASK_PUSH_NOTIFICATION_CONFIG_TEST_REQUEST;
1414
import static io.a2a.client.transport.rest.JsonRestMessages.SET_TASK_PUSH_NOTIFICATION_CONFIG_TEST_RESPONSE;
1515
import static io.a2a.client.transport.rest.JsonRestMessages.TASK_RESUBSCRIPTION_REQUEST_TEST_RESPONSE;
16+
import static io.a2a.spec.AgentCard.CURRENT_PROTOCOL_VERSION;
1617
import static org.junit.jupiter.api.Assertions.assertEquals;
1718
import static org.junit.jupiter.api.Assertions.assertInstanceOf;
1819
import static org.junit.jupiter.api.Assertions.assertNotNull;
@@ -21,11 +22,22 @@
2122
import static org.mockserver.model.HttpRequest.request;
2223
import static org.mockserver.model.HttpResponse.response;
2324

25+
import java.io.IOException;
26+
import java.util.Collections;
27+
import java.util.HashMap;
28+
import java.util.List;
29+
import java.util.concurrent.CountDownLatch;
30+
import java.util.concurrent.TimeUnit;
31+
import java.util.concurrent.atomic.AtomicReference;
32+
import java.util.function.Consumer;
33+
import java.util.logging.Logger;
34+
2435
import io.a2a.client.transport.spi.interceptors.ClientCallContext;
2536
import io.a2a.spec.AgentCapabilities;
2637
import io.a2a.spec.AgentCard;
2738
import io.a2a.spec.AgentSkill;
2839
import io.a2a.spec.Artifact;
40+
import io.a2a.spec.AuthenticationInfo;
2941
import io.a2a.spec.DeleteTaskPushNotificationConfigParams;
3042
import io.a2a.spec.EventKind;
3143
import io.a2a.spec.FilePart;
@@ -38,7 +50,6 @@
3850
import io.a2a.spec.MessageSendParams;
3951
import io.a2a.spec.Part;
4052
import io.a2a.spec.Part.Kind;
41-
import io.a2a.spec.AuthenticationInfo;
4253
import io.a2a.spec.PushNotificationConfig;
4354
import io.a2a.spec.StreamingEventKind;
4455
import io.a2a.spec.Task;
@@ -47,15 +58,6 @@
4758
import io.a2a.spec.TaskQueryParams;
4859
import io.a2a.spec.TaskState;
4960
import io.a2a.spec.TextPart;
50-
import java.io.IOException;
51-
import java.util.Collections;
52-
import java.util.HashMap;
53-
import java.util.List;
54-
import java.util.concurrent.CountDownLatch;
55-
import java.util.concurrent.TimeUnit;
56-
import java.util.concurrent.atomic.AtomicReference;
57-
import java.util.function.Consumer;
58-
import java.util.logging.Logger;
5961
import org.junit.jupiter.api.AfterEach;
6062
import org.junit.jupiter.api.BeforeEach;
6163
import org.junit.jupiter.api.Test;
@@ -87,7 +89,7 @@ public class RestTransportTest {
8789
.tags(Collections.singletonList("hello world"))
8890
.examples(List.of("hi", "hello world"))
8991
.build()))
90-
.protocolVersion("0.3.0")
92+
.protocolVersion(CURRENT_PROTOCOL_VERSION)
9193
.build();
9294

9395
@BeforeEach

examples/cloud-deployment/server/src/main/java/io/a2a/examples/cloud/CloudAgentCardProducer.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
package io.a2a.examples.cloud;
22

3+
import static io.a2a.spec.AgentCard.CURRENT_PROTOCOL_VERSION;
4+
5+
import java.util.Collections;
6+
import java.util.List;
7+
8+
import jakarta.enterprise.context.ApplicationScoped;
9+
import jakarta.enterprise.inject.Produces;
10+
import jakarta.inject.Inject;
11+
312
import io.a2a.server.PublicAgentCard;
413
import io.a2a.spec.AgentCapabilities;
514
import io.a2a.spec.AgentCard;
615
import io.a2a.spec.AgentInterface;
716
import io.a2a.spec.AgentSkill;
8-
import jakarta.enterprise.context.ApplicationScoped;
9-
import jakarta.enterprise.inject.Produces;
10-
import jakarta.inject.Inject;
11-
1217
import org.eclipse.microprofile.config.inject.ConfigProperty;
1318

14-
import java.util.Collections;
15-
import java.util.List;
16-
1719
/**
1820
* Producer for the cloud deployment example agent card.
1921
*/
@@ -56,7 +58,7 @@ public AgentCard agentCard() {
5658
))
5759
.build()
5860
))
59-
.protocolVersion("0.3.0")
61+
.protocolVersion(CURRENT_PROTOCOL_VERSION)
6062
.build();
6163
}
6264
}

examples/helloworld/server/src/main/java/io/a2a/examples/helloworld/AgentCardProducer.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package io.a2a.examples.helloworld;
22

3+
import static io.a2a.spec.AgentCard.CURRENT_PROTOCOL_VERSION;
4+
35
import java.util.Collections;
46
import java.util.List;
57

@@ -41,7 +43,7 @@ public AgentCard agentCard() {
4143
.tags(Collections.singletonList("hello world"))
4244
.examples(List.of("hi", "hello world"))
4345
.build()))
44-
.protocolVersion("0.3.0")
46+
.protocolVersion(CURRENT_PROTOCOL_VERSION)
4547
.build();
4648
}
4749
}

extras/queue-manager-replicated/tests-multi-instance/quarkus-common/src/main/java/io/a2a/extras/queuemanager/replicated/tests/multiinstance/common/MultiInstanceReplicationAgentCards.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package io.a2a.extras.queuemanager.replicated.tests.multiinstance.common;
22

3+
import static io.a2a.spec.AgentCard.CURRENT_PROTOCOL_VERSION;
4+
35
import java.util.Collections;
46
import java.util.List;
57

@@ -46,7 +48,7 @@ public static AgentCard createAgentCard(int instanceNumber, int port) {
4648
.description("Fire-and-forget agent for testing replication")
4749
.tags(Collections.singletonList("test"))
4850
.build()))
49-
.protocolVersion("0.3.0")
51+
.protocolVersion(CURRENT_PROTOCOL_VERSION)
5052
.build();
5153
}
5254
}

extras/queue-manager-replicated/tests-single-instance/src/test/java/io/a2a/extras/queuemanager/replicated/tests/ReplicationTestAgentCardProducer.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
package io.a2a.extras.queuemanager.replicated.tests;
22

3+
import static io.a2a.spec.AgentCard.CURRENT_PROTOCOL_VERSION;
4+
35
import java.util.List;
46

57
import jakarta.enterprise.context.ApplicationScoped;
68
import jakarta.enterprise.inject.Produces;
79

810
import io.a2a.server.PublicAgentCard;
9-
import io.a2a.spec.AgentCard;
1011
import io.a2a.spec.AgentCapabilities;
12+
import io.a2a.spec.AgentCard;
1113
import io.a2a.spec.AgentInterface;
1214
import io.a2a.spec.TransportProtocol;
1315
import io.quarkus.arc.profile.IfBuildProfile;
@@ -37,7 +39,7 @@ public AgentCard agentCard() {
3739
.skills(List.of())
3840
.supportedInterfaces(List.of(
3941
new AgentInterface(TransportProtocol.JSONRPC.asString(), "http://localhost:8081")))
40-
.protocolVersion("0.2.5")
42+
.protocolVersion(CURRENT_PROTOCOL_VERSION)
4143
.build();
4244
}
4345
}

0 commit comments

Comments
 (0)