Interface A2AHttpClient

All Known Implementing Classes:
AndroidA2AHttpClient, JdkA2AHttpClient, VertxA2AHttpClient

public interface A2AHttpClient
HTTP client interface for making HTTP requests to A2A agents.

Provides a fluent builder API for constructing and executing HTTP requests with support for GET, POST, and DELETE methods. Includes support for both synchronous requests and asynchronous Server-Sent Events (SSE) streaming.

Usage Example


 A2AHttpClient client = A2AHttpClientFactory.create();

 // Synchronous GET request
 A2AHttpResponse response = client.createGet()
     .url("http://localhost:9999/api/endpoint")
     .addHeader("Authorization", "Bearer token")
     .get();

 // Synchronous POST request
 A2AHttpResponse response = client.createPost()
     .url("http://localhost:9999/message:send")
     .body("{\"message\": \"Hello\"}")
     .post();

 // Asynchronous SSE streaming
 CompletableFuture<Void> future = client.createPost()
     .url("http://localhost:9999/message:stream")
     .body(jsonBody)
     .postAsyncSSE(
         event -> System.out.println("Event: " + event.data()),
         error -> System.err.println("Error: " + error),
         () -> System.out.println("Stream complete")
     );
 
See Also: