Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/run-tck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:

env:
# Tag of the TCK
TCK_VERSION: v0.2.3
TCK_VERSION: v0.2.5
# Tells uv to not need a venv, and instead use system
UV_SYSTEM_PYTHON: 1

Expand Down
32 changes: 28 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ public class WeatherAgentCardProducer {
.tags(Collections.singletonList("weather"))
.examples(List.of("weather in LA, CA"))
.build()))
.protocolVersion("0.2.5")
.build();
}
}
Expand Down Expand Up @@ -255,18 +256,21 @@ Map<String, Object> metadata = ...
CancelTaskResponse response = client.cancelTask(new TaskIdParams("task-1234", metadata));
```

#### Get the push notification configuration for a task
#### Get a push notification configuration for a task

```java
// Get task push notification configuration
GetTaskPushNotificationConfigResponse response = client.getTaskPushNotificationConfig("task-1234");

// You can also specify additional properties using a map
// The push notification configuration ID can also be optionally specified
GetTaskPushNotificationConfigResponse response = client.getTaskPushNotificationConfig("task-1234", "config-4567");

// Additional properties can be specified using a map
Map<String, Object> metadata = ...
GetTaskPushNotificationConfigResponse response = client.getTaskPushNotificationConfig(new TaskIdParams("task-1234", metadata));
GetTaskPushNotificationConfigResponse response = client.getTaskPushNotificationConfig(new GetTaskPushNotificationConfigParams("task-1234", "config-1234", metadata));
```

#### Set the push notification configuration for a task
#### Set a push notification configuration for a task

```java
// Set task push notification configuration
Expand All @@ -277,6 +281,26 @@ PushNotificationConfig pushNotificationConfig = new PushNotificationConfig.Build
SetTaskPushNotificationResponse response = client.setTaskPushNotificationConfig("task-1234", pushNotificationConfig);
```

#### List the push notification configurations for a task

```java
ListTaskPushNotificationConfigResponse response = client.listTaskPushNotificationConfig("task-1234");

// Additional properties can be specified using a map
Map<String, Object> metadata = ...
ListTaskPushNotificationConfigResponse response = client.listTaskPushNotificationConfig(new ListTaskPushNotificationConfigParams("task-123", metadata));
```

#### Delete a push notification configuration for a task

```java
DeleteTaskPushNotificationConfigResponse response = client.deleteTaskPushNotificationConfig("task-1234", "config-4567");

// Additional properties can be specified using a map
Map<String, Object> metadata = ...
DeleteTaskPushNotificationConfigResponse response = client.deleteTaskPushNotificationConfig(new DeleteTaskPushNotificationConfigParams("task-1234", "config-4567", metadata));
```

#### Send a streaming message

```java
Expand Down
2 changes: 1 addition & 1 deletion client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>io.github.a2asdk</groupId>
<artifactId>a2a-java-sdk-parent</artifactId>
<version>0.2.3.Beta2-SNAPSHOT</version>
<version>0.2.5.Beta1-SNAPSHOT</version>
</parent>
<artifactId>a2a-java-sdk-client</artifactId>

Expand Down
189 changes: 170 additions & 19 deletions client/src/main/java/io/a2a/client/A2AClient.java

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion client/src/test/java/io/a2a/client/A2AClientTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import io.a2a.spec.FilePart;
import io.a2a.spec.FileWithBytes;
import io.a2a.spec.FileWithUri;
import io.a2a.spec.GetTaskPushNotificationConfigParams;
import io.a2a.spec.GetTaskPushNotificationConfigResponse;
import io.a2a.spec.GetTaskResponse;
import io.a2a.spec.Message;
Expand Down Expand Up @@ -328,7 +329,7 @@ public void testA2AClientGetTaskPushNotificationConfig() throws Exception {

A2AClient client = new A2AClient("http://localhost:4001");
GetTaskPushNotificationConfigResponse response = client.getTaskPushNotificationConfig("1",
new TaskIdParams("de38c76d-d54c-436c-8b9f-4c2703648d64", new HashMap<>()));
new GetTaskPushNotificationConfigParams("de38c76d-d54c-436c-8b9f-4c2703648d64", null, new HashMap<>()));
assertEquals("2.0", response.getJsonrpc());
assertEquals(1, response.getId());
assertInstanceOf(TaskPushNotificationConfig.class, response.getResult());
Expand Down Expand Up @@ -442,6 +443,7 @@ public void testA2AClientGetAgentCard() throws Exception {
assertEquals(outputModes, skills.get(1).outputModes());
assertTrue(agentCard.supportsAuthenticatedExtendedCard());
assertEquals("https://georoute-agent.example.com/icon.png", agentCard.iconUrl());
assertEquals("0.2.5", agentCard.protocolVersion());
}

@Test
Expand Down Expand Up @@ -514,6 +516,7 @@ public void testA2AClientGetAuthenticatedExtendedAgentCard() throws Exception {
assertEquals(List.of("extended"), skills.get(2).tags());
assertTrue(agentCard.supportsAuthenticatedExtendedCard());
assertEquals("https://georoute-agent.example.com/icon.png", agentCard.iconUrl());
assertEquals("0.2.5", agentCard.protocolVersion());
}

@Test
Expand Down
6 changes: 4 additions & 2 deletions client/src/test/java/io/a2a/client/JsonMessages.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ public class JsonMessages {
]
}
],
"supportsAuthenticatedExtendedCard": true
"supportsAuthenticatedExtendedCard": true,
"protocolVersion": "0.2.5"
}""";

static final String AUTHENTICATION_EXTENDED_AGENT_CARD = """
Expand Down Expand Up @@ -137,7 +138,8 @@ public class JsonMessages {
"tags": ["extended"]
}
],
"supportsAuthenticatedExtendedCard": true
"supportsAuthenticatedExtendedCard": true,
"protocolVersion": "0.2.5"
}""";


Expand Down
2 changes: 1 addition & 1 deletion common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>io.github.a2asdk</groupId>
<artifactId>a2a-java-sdk-parent</artifactId>
<version>0.2.3.Beta2-SNAPSHOT</version>
<version>0.2.5.Beta1-SNAPSHOT</version>
</parent>
<artifactId>a2a-java-sdk-common</artifactId>

Expand Down
2 changes: 1 addition & 1 deletion examples/helloworld/client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>io.github.a2asdk</groupId>
<artifactId>a2a-java-sdk-examples-parent</artifactId>
<version>0.2.3.Beta2-SNAPSHOT</version>
<version>0.2.5.Beta1-SNAPSHOT</version>
</parent>

<artifactId>a2a-java-sdk-examples-client</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
///usr/bin/env jbang "$0" "$@" ; exit $?
//DEPS io.github.a2asdk:a2a-java-sdk-client:0.2.3.Beta2-SNAPSHOT
//DEPS io.github.a2asdk:a2a-java-sdk-client:0.2.5.Beta2-SNAPSHOT
//SOURCES HelloWorldClient.java

/**
Expand Down
2 changes: 1 addition & 1 deletion examples/helloworld/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>io.github.a2asdk</groupId>
<artifactId>a2a-java-sdk-parent</artifactId>
<version>0.2.3.Beta2-SNAPSHOT</version>
<version>0.2.5.Beta1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion examples/helloworld/server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>io.github.a2asdk</groupId>
<artifactId>a2a-java-sdk-examples-parent</artifactId>
<version>0.2.3.Beta2-SNAPSHOT</version>
<version>0.2.5.Beta1-SNAPSHOT</version>
</parent>

<artifactId>a2a-java-sdk-examples-server</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public AgentCard agentCard() {
.tags(Collections.singletonList("hello world"))
.examples(List.of("hi", "hello world"))
.build()))
.protocolVersion("0.2.5")
.build();
}
}
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>io.github.a2asdk</groupId>
<artifactId>a2a-java-sdk-parent</artifactId>
<version>0.2.3.Beta2-SNAPSHOT</version>
<version>0.2.5.Beta1-SNAPSHOT</version>

<packaging>pom</packaging>

Expand Down
2 changes: 1 addition & 1 deletion reference-impl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>io.github.a2asdk</groupId>
<artifactId>a2a-java-sdk-parent</artifactId>
<version>0.2.3.Beta2-SNAPSHOT</version>
<version>0.2.5.Beta1-SNAPSHOT</version>
</parent>
<artifactId>a2a-java-reference-server</artifactId>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import io.a2a.server.util.async.Internal;
import io.a2a.spec.AgentCard;
import io.a2a.spec.CancelTaskRequest;
import io.a2a.spec.DeleteTaskPushNotificationConfigRequest;
import io.a2a.spec.GetTaskPushNotificationConfigRequest;
import io.a2a.spec.GetTaskRequest;
import io.a2a.spec.IdJsonMappingException;
Expand All @@ -35,6 +36,7 @@
import io.a2a.spec.JSONRPCErrorResponse;
import io.a2a.spec.JSONRPCRequest;
import io.a2a.spec.JSONRPCResponse;
import io.a2a.spec.ListTaskPushNotificationConfigRequest;
import io.a2a.spec.MethodNotFoundError;
import io.a2a.spec.MethodNotFoundJsonMappingException;
import io.a2a.spec.NonStreamingJSONRPCRequest;
Expand Down Expand Up @@ -187,11 +189,15 @@ private JSONRPCResponse<?> processNonStreamingRequest(NonStreamingJSONRPCRequest
} else if (request instanceof CancelTaskRequest) {
return jsonRpcHandler.onCancelTask((CancelTaskRequest) request);
} else if (request instanceof SetTaskPushNotificationConfigRequest) {
return jsonRpcHandler.setPushNotification((SetTaskPushNotificationConfigRequest) request);
return jsonRpcHandler.setPushNotificationConfig((SetTaskPushNotificationConfigRequest) request);
} else if (request instanceof GetTaskPushNotificationConfigRequest) {
return jsonRpcHandler.getPushNotification((GetTaskPushNotificationConfigRequest) request);
return jsonRpcHandler.getPushNotificationConfig((GetTaskPushNotificationConfigRequest) request);
} else if (request instanceof SendMessageRequest) {
return jsonRpcHandler.onMessageSend((SendMessageRequest) request);
} else if (request instanceof ListTaskPushNotificationConfigRequest) {
return jsonRpcHandler.listPushNotificationConfig((ListTaskPushNotificationConfigRequest) request);
} else if (request instanceof DeleteTaskPushNotificationConfigRequest) {
return jsonRpcHandler.deletePushNotificationConfig((DeleteTaskPushNotificationConfigRequest) request);
} else {
return generateErrorResponse(request, new UnsupportedOperationError());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import jakarta.inject.Singleton;

import io.a2a.server.apps.common.TestUtilsBean;
import io.a2a.spec.PushNotificationConfig;
import io.a2a.spec.Task;
import io.a2a.spec.TaskArtifactUpdateEvent;
import io.a2a.spec.TaskStatusUpdateEvent;
Expand Down Expand Up @@ -138,6 +139,44 @@ public void getStreamingSubscribedCount(RoutingContext rc) {
.end(String.valueOf(streamingSubscribedCount.get()));
}

@Route(path = "/test/task/:taskId/config/:configId", methods = {Route.HttpMethod.DELETE}, type = Route.HandlerType.BLOCKING)
public void deleteTaskPushNotificationConfig(@Param String taskId, @Param String configId, RoutingContext rc) {
try {
Task task = testUtilsBean.getTask(taskId);
if (task == null) {
rc.response()
.setStatusCode(404)
.end();
return;
}
testUtilsBean.deleteTaskPushNotificationConfig(taskId, configId);
rc.response()
.setStatusCode(200)
.end();
} catch (Throwable t) {
errorResponse(t, rc);
}
}

@Route(path = "/test/task/:taskId", methods = {Route.HttpMethod.POST}, type = Route.HandlerType.BLOCKING)
public void saveTaskPushNotificationConfig(@Param String taskId, @Body String body, RoutingContext rc) {
try {
PushNotificationConfig notificationConfig = Utils.OBJECT_MAPPER.readValue(body, PushNotificationConfig.class);
if (notificationConfig == null) {
rc.response()
.setStatusCode(404)
.end();
return;
}
testUtilsBean.saveTaskPushNotificationConfig(taskId, notificationConfig);
rc.response()
.setStatusCode(200)
.end();
} catch (Throwable t) {
errorResponse(t, rc);
}
}

private void errorResponse(Throwable t, RoutingContext rc) {
t.printStackTrace();
rc.response()
Expand Down
2 changes: 1 addition & 1 deletion sdk-server-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>io.github.a2asdk</groupId>
<artifactId>a2a-java-sdk-parent</artifactId>
<version>0.2.3.Beta2-SNAPSHOT</version>
<version>0.2.5.Beta1-SNAPSHOT</version>
</parent>
<artifactId>a2a-java-sdk-server-common</artifactId>

Expand Down
Loading