Skip to content

Commit 5c29703

Browse files
authored
feat: Set current protocol version to 1.0 (#549)
Update usage of protocol version to use a constant rather than hard coding
1 parent 487cd46 commit 5c29703

File tree

17 files changed

+106
-82
lines changed

17 files changed

+106
-82
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;
@@ -417,7 +417,7 @@ public void testA2AClientGetAgentCard() throws Exception {
417417
assertEquals(outputModes, skills.get(1).outputModes());
418418
assertFalse(agentCard.supportsExtendedAgentCard());
419419
assertEquals("https://georoute-agent.example.com/icon.png", agentCard.iconUrl());
420-
assertEquals("0.2.9", agentCard.protocolVersion());
420+
assertEquals(CURRENT_PROTOCOL_VERSION, agentCard.protocolVersion());
421421
assertEquals("JSONRPC", agentCard.supportedInterfaces().get(0).protocolBinding());
422422
List<AgentInterface> additionalInterfaces = agentCard.supportedInterfaces();
423423
assertEquals(3, additionalInterfaces.size());
@@ -509,7 +509,7 @@ public void testA2AClientGetAuthenticatedExtendedAgentCard() throws Exception {
509509
assertEquals(List.of("extended"), skills.get(2).tags());
510510
assertTrue(agentCard.supportsExtendedAgentCard());
511511
assertEquals("https://georoute-agent.example.com/icon.png", agentCard.iconUrl());
512-
assertEquals("0.2.5", agentCard.protocolVersion());
512+
assertEquals(CURRENT_PROTOCOL_VERSION, agentCard.protocolVersion());
513513
}
514514

515515
@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 SEND_MESSAGE_TEST_REQUEST = """
8690
{
@@ -588,7 +592,7 @@ public class JsonMessages {
588592
}
589593
""";
590594

591-
static final String GET_AUTHENTICATED_EXTENDED_AGENT_CARD_RESPONSE = """
595+
static final String GET_AUTHENTICATED_EXTENDED_AGENT_CARD_RESPONSE = String.format("""
592596
{
593597
"jsonrpc": "2.0",
594598
"id": "1",
@@ -662,17 +666,17 @@ public class JsonMessages {
662666
}
663667
],
664668
"supportsExtendedAgentCard": true,
665-
"protocolVersion": "0.2.5",
669+
"protocolVersion": "%s",
666670
"signatures": [
667671
{
668672
"protected": "eyJhbGciOiJFUzI1NiIsInR5cCI6IkpPU0UiLCJraWQiOiJrZXktMSIsImprdUI6Imh0dHBzOi8vZXhhbXBsZS5jb20vYWdlbnQvandrcy5qc29uIn0",
669673
"signature": "QFdkNLNszlGj3z3u0YQGt_T9LixY3qtdQpZmsTdDHDe3fXV9y9-B3m2-XgCpzuhiLt8E0tV6HXoZKHv4GtHgKQ"
670674
}
671675
]
672676
}
673-
}""";
677+
}""", CURRENT_PROTOCOL_VERSION);
674678

675-
static final String AGENT_CARD_SUPPORTS_EXTENDED = """
679+
static final String AGENT_CARD_SUPPORTS_EXTENDED = String.format("""
676680
{
677681
"name": "GeoSpatial Route Planner Agent",
678682
"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.",
@@ -737,6 +741,6 @@ public class JsonMessages {
737741
}
738742
],
739743
"supportsExtendedAgentCard": true,
740-
"protocolVersion": "1.0.0"
741-
}""";
744+
"protocolVersion": "%s"
745+
}""", CURRENT_PROTOCOL_VERSION);
742746
}

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

Lines changed: 13 additions & 11 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,21 @@
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.List;
28+
import java.util.concurrent.CountDownLatch;
29+
import java.util.concurrent.TimeUnit;
30+
import java.util.concurrent.atomic.AtomicReference;
31+
import java.util.function.Consumer;
32+
import java.util.logging.Logger;
33+
2434
import io.a2a.client.transport.spi.interceptors.ClientCallContext;
2535
import io.a2a.spec.AgentCapabilities;
2636
import io.a2a.spec.AgentCard;
2737
import io.a2a.spec.AgentSkill;
2838
import io.a2a.spec.Artifact;
39+
import io.a2a.spec.AuthenticationInfo;
2940
import io.a2a.spec.DeleteTaskPushNotificationConfigParams;
3041
import io.a2a.spec.EventKind;
3142
import io.a2a.spec.FilePart;
@@ -38,7 +49,6 @@
3849
import io.a2a.spec.MessageSendParams;
3950
import io.a2a.spec.Part;
4051
import io.a2a.spec.Part.Kind;
41-
import io.a2a.spec.AuthenticationInfo;
4252
import io.a2a.spec.PushNotificationConfig;
4353
import io.a2a.spec.StreamingEventKind;
4454
import io.a2a.spec.Task;
@@ -47,14 +57,6 @@
4757
import io.a2a.spec.TaskQueryParams;
4858
import io.a2a.spec.TaskState;
4959
import io.a2a.spec.TextPart;
50-
import java.io.IOException;
51-
import java.util.Collections;
52-
import java.util.List;
53-
import java.util.concurrent.CountDownLatch;
54-
import java.util.concurrent.TimeUnit;
55-
import java.util.concurrent.atomic.AtomicReference;
56-
import java.util.function.Consumer;
57-
import java.util.logging.Logger;
5860
import org.junit.jupiter.api.AfterEach;
5961
import org.junit.jupiter.api.BeforeEach;
6062
import org.junit.jupiter.api.Test;
@@ -86,7 +88,7 @@ public class RestTransportTest {
8688
.tags(Collections.singletonList("hello world"))
8789
.examples(List.of("hi", "hello world"))
8890
.build()))
89-
.protocolVersion("0.3.0")
91+
.protocolVersion(CURRENT_PROTOCOL_VERSION)
9092
.build();
9193

9294
@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)