Skip to content

Commit ac6c127

Browse files
authored
Merge branch 'main' into spring-inte
2 parents 1bc3228 + abe92d8 commit ac6c127

File tree

147 files changed

+828
-563
lines changed

Some content is hidden

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

147 files changed

+828
-563
lines changed

.github/workflows/build-and-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ jobs:
2121
java-version: '17'
2222
distribution: 'temurin'
2323
cache: maven
24-
- name: Build with Maven
24+
- name: Build with Maven and run tests
2525
run: mvn -B package --file pom.xml -fae

.github/workflows/run-tck.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: Run TCK
2+
3+
on:
4+
# Handle all branches for now
5+
push:
6+
branches:
7+
- main
8+
pull_request:
9+
branches:
10+
- main
11+
12+
env:
13+
# Tag of the TCK
14+
TCK_VERSION: 0.2.3
15+
# Tells uv to not need a venv, and instead use system
16+
UV_SYSTEM_PYTHON: 1
17+
18+
# Only run the latest job
19+
concurrency:
20+
group: '${{ github.workflow }} @ ${{ github.head_ref || github.ref }}'
21+
cancel-in-progress: true
22+
23+
jobs:
24+
tck-test:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Checkout a2a-java
28+
uses: actions/checkout@v4
29+
- name: Checkout a2a-tck
30+
uses: actions/checkout@v4
31+
with:
32+
repository: maeste/a2a-tck
33+
path: tck/a2a-tck
34+
ref: ${{ env.TCK_VERSION }}
35+
- name: Set up JDK 17
36+
uses: actions/setup-java@v4
37+
with:
38+
java-version: '17'
39+
distribution: 'temurin'
40+
cache: maven
41+
- name: check java_home
42+
run: echo $JAVA_HOME
43+
- name: Set up Python
44+
uses: actions/setup-python@v5
45+
with:
46+
python-version-file: "tck/a2a-tck/pyproject.toml"
47+
- name: Install uv and Python dependencies
48+
run: |
49+
pip install uv
50+
uv pip install -e .
51+
working-directory: tck/a2a-tck
52+
- name: Build with Maven, skipping tests
53+
run: mvn -B install -DskipTests
54+
- name: Start SUT
55+
run: mvn -B quarkus:dev &
56+
working-directory: tck
57+
- name: Wait for SUT to start
58+
run: |
59+
URL="http://localhost:9999/.well-known/agent.json"
60+
EXPECTED_STATUS=200
61+
TIMEOUT=120
62+
RETRY_INTERVAL=2
63+
START_TIME=$(date +%s)
64+
65+
while true; do
66+
# Calculate elapsed time
67+
CURRENT_TIME=$(date +%s)
68+
ELAPSED_TIME=$((CURRENT_TIME - START_TIME))
69+
70+
# Check for timeout
71+
if [ "$ELAPSED_TIME" -ge "$TIMEOUT" ]; then
72+
echo "❌ Timeout: Server did not respond with status $EXPECTED_STATUS within $TIMEOUT seconds."
73+
exit 1
74+
fi
75+
76+
# Get HTTP status code. || true is to reporting a failure to connect as an error
77+
HTTP_STATUS=$(curl --output /dev/null --silent --write-out "%{http_code}" "$URL") || true
78+
echo "STATUS: ${HTTP_STATUS}"
79+
80+
# Check if we got the correct status code
81+
if [ "$HTTP_STATUS" -eq "$EXPECTED_STATUS" ]; then
82+
echo "✅ Server is up! Received status $HTTP_STATUS after $ELAPSED_TIME seconds."
83+
break;
84+
fi
85+
86+
# Wait before retrying
87+
echo "⏳ Server not ready (status: $HTTP_STATUS). Retrying in $RETRY_INTERVAL seconds..."
88+
sleep "$RETRY_INTERVAL"
89+
done
90+
91+
- name: Run TCK
92+
run: |
93+
./run_tck.py --sut-url http://localhost:9999 --category all --compliance-report report.json
94+
working-directory: tck/a2a-tck

README.md

Lines changed: 34 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,38 @@ More examples will be added soon.
2929

3030
The A2A Java SDK provides a Java server implementation of the [Agent2Agent (A2A) Protocol](https://google-a2a.github.io/A2A). To run your agentic Java application as an A2A server, simply follow the steps below.
3131

32-
- [Add the A2A Java SDK Core Maven dependency to your project](#1-add-the-a2a-java-sdk-core-maven-dependency-to-your-project)
32+
- [Add an A2A Java SDK Server Maven dependency to your project](#1-add-an-a2a-java-sdk-server-maven-dependency-to-your-project)
3333
- [Add a class that creates an A2A Agent Card](#2-add-a-class-that-creates-an-a2a-agent-card)
3434
- [Add a class that creates an A2A Agent Executor](#3-add-a-class-that-creates-an-a2a-agent-executor)
35-
- [Add an A2A Java SDK Server Maven dependency to your project](#4-add-an-a2a-java-sdk-server-maven-dependency-to-your-project)
3635

37-
### 1. Add the A2A Java SDK Core Maven dependency to your project
36+
### 1. Add an A2A Java SDK Server Maven dependency to your project
3837

39-
> **Note**: The A2A Java SDK isn't available yet in Maven Central but will be soon. For now, be
40-
> sure to check out the latest tag (you can see the tags [here](https://github.com/a2aproject/a2a-java/tags)), build from the tag, and reference that version below. For example, if the latest tag is `0.2.3`, you can use the following dependency.
38+
Adding a dependency on an A2A Java SDK Server will provide access to the core classes that make up the A2A specification
39+
and allow you to run your agentic Java application as an A2A server agent.
40+
41+
The A2A Java SDK provides two A2A server endpoint implementations, one based on Jakarta REST (`a2a-java-sdk-server-jakarta`) and one based on Quarkus Reactive Routes (`a2a-java-sdk-server-quarkus`). You can choose the one that best fits your application.
42+
43+
Add **one** of the following dependencies to your project:
44+
45+
> *⚠️ The `io.github.a2asdk` `groupId` below is temporary and will likely change for future releases.*
46+
47+
```xml
48+
<dependency>
49+
<groupId>io.github.a2asdk</groupId>
50+
<artifactId>a2a-java-sdk-server-jakarta</artifactId>
51+
<!-- Use a released version from https://github.com/a2aproject/a2a-java/releases -->
52+
<version>${io.a2a.sdk.version}</version>
53+
</dependency>
54+
```
55+
56+
OR
4157

4258
```xml
4359
<dependency>
44-
<groupId>io.a2a.sdk</groupId>
45-
<artifactId>a2a-java-sdk-core</artifactId>
46-
<version>0.2.3</version>
60+
<groupId>io.github.a2asdk</groupId>
61+
<artifactId>a2a-java-sdk-server-quarkus</artifactId>
62+
<!-- Use a released version from https://github.com/a2aproject/a2a-java/releases -->
63+
<version>${io.a2a.sdk.version}</version>
4764
</dependency>
4865
```
4966

@@ -180,39 +197,24 @@ public class WeatherAgentExecutorProducer {
180197
}
181198
```
182199

183-
### 4. Add an A2A Java SDK Server Maven dependency to your project
184-
185-
> **Note**: The A2A Java SDK isn't available yet in Maven Central but will be soon. For now, be
186-
> sure to check out the latest tag (you can see the tags [here](https://github.com/a2aproject/a2a-java/tags)), build from the tag, and reference that version below. For example, if the latest tag is `0.2.3`, you can use the following dependency.
187-
188-
Adding a dependency on an A2A Java SDK Server will allow you to run your agentic Java application as an A2A server.
189-
190-
The A2A Java SDK provides two A2A server endpoint implementations, one based on Jakarta REST (`a2a-java-sdk-server-jakarta`) and one based on Quarkus Reactive Routes (`a2a-java-sdk-server-quarkus`). You can choose the one that best fits your application.
191-
192-
Add **one** of the following dependencies to your project:
200+
## A2A Client
193201

194-
```xml
195-
<dependency>
196-
<groupId>io.a2a.sdk</groupId>
197-
<artifactId>a2a-java-sdk-server-jakarta</artifactId>
198-
<version>${io.a2a.sdk.version}</version>
199-
</dependency>
200-
```
202+
The A2A Java SDK provides a Java client implementation of the [Agent2Agent (A2A) Protocol](https://google-a2a.github.io/A2A), allowing communication with A2A servers.
203+
To make use of the Java `A2AClient`, simply add the following dependency:
201204

202-
OR
205+
----
206+
> *⚠️ The `io.github.a2asdk` `groupId` below is temporary and will likely change for future releases.*
207+
----
203208

204209
```xml
205210
<dependency>
206-
<groupId>io.a2a.sdk</groupId>
207-
<artifactId>a2a-java-sdk-server-quarkus</artifactId>
211+
<groupId>io.github.a2asdk</groupId>
212+
<artifactId>a2a-java-sdk-client</artifactId>
213+
<!-- Use a released version from https://github.com/a2aproject/a2a-java/releases -->
208214
<version>${io.a2a.sdk.version}</version>
209215
</dependency>
210216
```
211217

212-
## A2A Client
213-
214-
The A2A Java SDK provides a Java client implementation of the [Agent2Agent (A2A) Protocol](https://google-a2a.github.io/A2A), allowing communication with A2A servers.
215-
216218
### Sample Usage
217219

218220
#### Create an A2A client

client/pom.xml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?xml version="1.0"?>
2+
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"
3+
xmlns="http://maven.apache.org/POM/4.0.0"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<parent>
8+
<groupId>io.github.a2asdk</groupId>
9+
<artifactId>a2a-java-sdk-parent</artifactId>
10+
<version>0.2.3.Beta2-SNAPSHOT</version>
11+
</parent>
12+
<artifactId>a2a-java-sdk-client</artifactId>
13+
14+
<packaging>jar</packaging>
15+
16+
<name>Java SDK A2A Client</name>
17+
<description>Java SDK for the Agent2Agent Protocol (A2A) - Client</description>
18+
19+
<dependencies>
20+
<dependency>
21+
<groupId>${project.groupId}</groupId>
22+
<artifactId>a2a-java-sdk-common</artifactId>
23+
<version>${project.version}</version>
24+
</dependency>
25+
26+
<dependency>
27+
<groupId>${project.groupId}</groupId>
28+
<artifactId>a2a-java-sdk-spec</artifactId>
29+
<version>${project.version}</version>
30+
</dependency>
31+
32+
<dependency>
33+
<groupId>org.junit.jupiter</groupId>
34+
<artifactId>junit-jupiter-api</artifactId>
35+
<scope>test</scope>
36+
</dependency>
37+
38+
<dependency>
39+
<groupId>org.mock-server</groupId>
40+
<artifactId>mockserver-netty</artifactId>
41+
<scope>test</scope>
42+
</dependency>
43+
</dependencies>
44+
45+
</project>
Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,23 @@
1-
package io.a2a.spec;
1+
package io.a2a;
22

33
import java.util.Collections;
44
import java.util.Map;
55

66
import io.a2a.client.A2ACardResolver;
77
import io.a2a.http.A2AHttpClient;
88
import io.a2a.http.JdkA2AHttpClient;
9+
import io.a2a.spec.A2AClientError;
10+
import io.a2a.spec.A2AClientJSONError;
11+
import io.a2a.spec.AgentCard;
12+
import io.a2a.spec.Message;
13+
import io.a2a.spec.TextPart;
914

1015

1116
/**
1217
* Constants and utility methods related to the A2A protocol.
1318
*/
1419
public class A2A {
1520

16-
public static final String CANCEL_TASK_METHOD = "tasks/cancel";
17-
public static final String GET_TASK_PUSH_NOTIFICATION_CONFIG_METHOD = "tasks/pushNotificationConfig/get";
18-
public static final String GET_TASK_METHOD = "tasks/get";
19-
public static final String SET_TASK_PUSH_NOTIFICATION_CONFIG_METHOD = "tasks/pushNotificationConfig/set";
20-
public static final String SEND_TASK_RESUBSCRIPTION_METHOD = "tasks/resubscribe";
21-
public static final String SEND_STREAMING_MESSAGE_METHOD = "message/stream";
22-
public static final String SEND_MESSAGE_METHOD = "message/send";
23-
24-
public static final String JSONRPC_VERSION = "2.0";
25-
26-
2721
/**
2822
* Convert the given text to a user message.
2923
*
@@ -133,16 +127,4 @@ public static AgentCard getAgentCard(A2AHttpClient httpClient, String agentUrl,
133127
A2ACardResolver resolver = new A2ACardResolver(httpClient, agentUrl, relativeCardPath, authHeaders);
134128
return resolver.getAgentCard();
135129
}
136-
137-
protected static boolean isValidMethodName(String methodName) {
138-
return methodName != null && (methodName.equals(CANCEL_TASK_METHOD)
139-
|| methodName.equals(GET_TASK_METHOD)
140-
|| methodName.equals(GET_TASK_PUSH_NOTIFICATION_CONFIG_METHOD)
141-
|| methodName.equals(SET_TASK_PUSH_NOTIFICATION_CONFIG_METHOD)
142-
|| methodName.equals(SEND_TASK_RESUBSCRIPTION_METHOD)
143-
|| methodName.equals(SEND_MESSAGE_METHOD)
144-
|| methodName.equals(SEND_STREAMING_MESSAGE_METHOD));
145-
146-
}
147-
148130
}

core/src/main/java/io/a2a/client/A2ACardResolver.java renamed to client/src/main/java/io/a2a/client/A2ACardResolver.java

File renamed without changes.

0 commit comments

Comments
 (0)