diff --git a/_posts/2025-09-18-quarkus-a2a-java-0-3-0-beta-release.adoc b/_posts/2025-09-18-quarkus-a2a-java-0-3-0-beta-release.adoc new file mode 100644 index 0000000000..9b3c52b018 --- /dev/null +++ b/_posts/2025-09-18-quarkus-a2a-java-0-3-0-beta-release.adoc @@ -0,0 +1,110 @@ +--- +layout: post +title: 'A2A Java SDK: Support for the REST Transport is Now Here' +date: 2025-09-18 +tags: ai a2a +synopsis: 'Today, we released A2A Java SDK 0.3.0.Beta1 which adds support for the HTTP+JSON/REST transport.' +author: fjuma +--- + +Today, we've released A2A Java SDK 0.3.0.Beta1 which introduces support for the HTTP+JSON/REST transport. + +Our last https://quarkus.io/blog/quarkus-a2a-java-0-3-0-alpha-release/[blog post] covered what's new in the 0.3.0 version of the A2A Java SDK. In this post, we'll focus on how to make use of the new HTTP+JSON/REST transport for both A2A server agents and clients. + +== Configuring an A2A Server Agent to Support the REST Transport + +To enable your A2A server agent to support communication using HTTP+JSON/REST, add the following dependency: + +[NOTE] +==== +The `io.github.a2asdk` `groupId` is temporary and will likely change for future releases. Keep an eye on the `a2a-java` https://github.com/a2aproject/a2a-java/blob/main/README.md[README] for up-to-date documentation. +==== + +[source,xml] +---- + + io.github.a2asdk + a2a-java-sdk-reference-rest <1> + +---- + +<1> `a2a-java-sdk-reference-rest` provides access to the core classes that make up the A2A specification and provides the HTTP endpoints that implement the A2A protocol using the HTTP+JSON/REST transport. + +After adding this dependency, simply update your agent card to declare support for this new transport: + +[source,java] +---- +@Produces +@PublicAgentCard +public AgentCard agentCard() { + return new AgentCard.Builder() + .url(YOUR_HTTP_JSON_URL) <1> + .preferredTransport(TransportProtocol.HTTP_JSON.asString()) <2> + .additionalInterfaces(List.of( + new AgentInterface(TransportProtocol.HTTP_JSON.asString(), + YOUR_HTTP_JSON_URL) + ... <3> + )) + ... + .build(); +} +---- + +<1> This is the primary URL for your A2A server agent. This should be the URL for your preferred transport (e.g., `http://localhost:8080`). +<2> Your A2A server agent's preferred transport, HTTP+JSON/REST in this example. +<3> The `additionalInterfaces` can optionally contain an entry for the preferred transport. Any other transports you'd like to support (e.g., `TransportProtocol.JSONRPC.asString()` or `TransportProtocol.GRPC.asString()`) can be specified here too. + +For more details on configuring your A2A server agent to support multiple transports, refer to our previous https://quarkus.io/blog/quarkus-a2a-java-0-3-0-alpha-release/[blog post]. + +== Configuring an A2A Client to Support the REST Transport + +To get your A2A client to communicate using the HTTP+JSON/REST transport, you'll need to add a couple +dependencies. + +First, add the `a2a-java-sdk-client` dependency to your project. This will provide access to a `Builder` that you can use to create your A2A `Client`. + +[source,xml] +---- + + io.github.a2asdk + a2a-java-sdk-client <1> + +---- + +Next, add the specific dependency for the HTTP+JSON/REST transport: + +[source,xml] +---- + + io.github.a2asdk + a2a-java-sdk-client-transport-rest + +---- + +You can now use `Client.builder()` to create a `Client` that supports the HTTP+JSON/REST transport using the `withTransport` method as shown below: + +[source,java] +---- +// Create the client using the builder +Client client = Client + .builder(agentCard) + .withTransport(RestTransport.class, new RestTransportConfig()) <1> + .... + .build(); +---- +<1> This specifies that our client can support the HTTP+JSON/REST transport. At least one transport must be configured using the `withTransport` method. + +For a deep dive into creating clients with the `Client.Builder`, check out this https://quarkus.io/blog/quarkus-a2a-java-0-3-0-alpha-release/[post]. + +== Conclusion + +With the release of A2A Java SDK 0.3.0.Beta1, building flexible, interoperable multi-agent systems just got easier with the new support for the HTTP+JSON/REST transport. + +=== Further Reading + +* https://quarkus.io/blog/quarkus-a2a-java-0-3-0-alpha-release/[Getting Started with Quarkus and A2A Java SDK 0.3.0] +* https://github.com/a2aproject/a2a-samples/tree/main/samples/java/agents[A2A Java SDK Samples] +* https://github.com/a2aproject/a2a-java/blob/main/README.md[A2A Java SDK Documentation] +* https://a2a-protocol.org/latest/specification/[A2A Specification] + +