# A2A Java SDK: Support for the REST Transport is Now Here

Today, we've released A2A Java SDK 0.3.0.Beta1 which introduces support for the HTTP+JSON/REST transport.

Our last [blog post](https://quarkus.io/blog/quarkus-a2a-java-0-3-0-alpha-release/) 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` [README](https://github.com/a2aproject/a2a-java/blob/main/README.md) for up-to-date documentation.

```xml
<dependency>
    <groupId>io.github.a2asdk</groupId>
    <artifactId>a2a-java-sdk-reference-rest</artifactId> <1>
</dependency>
```

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:

```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 [blog post](https://quarkus.io/blog/quarkus-a2a-java-0-3-0-alpha-release/).

## 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`.

```xml
<dependency>
    <groupId>io.github.a2asdk</groupId>
    <artifactId>a2a-java-sdk-client</artifactId>
</dependency>
```

Next, add the specific dependency for the HTTP+JSON/REST transport:

```xml
<dependency>
    <groupId>io.github.a2asdk</groupId>
    <artifactId>a2a-java-sdk-client-transport-rest</artifactId>
</dependency>
```

You can now use `Client.builder()` to create a `Client` that supports the HTTP+JSON/REST transport using the `withTransport` method as shown below:

```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 [post](https://quarkus.io/blog/quarkus-a2a-java-0-3-0-alpha-release/).

## 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

- [Getting Started with Quarkus and A2A Java SDK 0.3.0](https://quarkus.io/blog/quarkus-a2a-java-0-3-0-alpha-release/)
- [A2A Java SDK Samples](https://github.com/a2aproject/a2a-samples/tree/main/samples/java/agents)
- [A2A Java SDK Documentation](https://github.com/a2aproject/a2a-java/blob/main/README.md)
- [A2A Specification](https://a2a-protocol.org/latest/specification/)
