Enum Class TransportProtocol

java.lang.Object
java.lang.Enum<TransportProtocol>
org.a2aproject.sdk.spec.TransportProtocol
All Implemented Interfaces:
Serializable, Comparable<TransportProtocol>, Constable

public enum TransportProtocol extends Enum<TransportProtocol>
Enumeration of supported transport protocols for A2A Protocol communication.

This enum defines the communication mechanisms that A2A agents and clients can use to exchange messages. Each transport protocol has different characteristics, advantages, and use cases.

Supported transport protocols:

  • JSONRPC - JSON-RPC 2.0 over HTTP (most common, human-readable)
  • GRPC - gRPC binary protocol (high performance, streaming)
  • HTTP_JSON - RESTful HTTP with JSON (REST-style endpoints)

Usage example:


 TransportProtocol protocol = TransportProtocol.JSONRPC;
 String protocolName = protocol.asString();  // "JSONRPC"
 TransportProtocol parsed = TransportProtocol.fromString("JSONRPC");
 
See Also:
  • Enum Constant Details

    • JSONRPC

      public static final TransportProtocol JSONRPC
      JSON-RPC 2.0 transport protocol over HTTP.

      This is the primary and most widely supported transport for the A2A Protocol. It uses JSON-RPC 2.0 request/response semantics with JSON encoding, making it human-readable and easy to debug. Supports both synchronous and streaming communication.

    • GRPC

      public static final TransportProtocol GRPC
      gRPC binary transport protocol.

      High-performance binary protocol using Protocol Buffers for serialization. Provides efficient streaming, strong typing, and cross-language support. Suitable for high-throughput scenarios and service-to-service communication.

    • HTTP_JSON

      public static final TransportProtocol HTTP_JSON
      HTTP+JSON RESTful transport protocol.

      REST-style HTTP endpoints with JSON payloads. Provides a more traditional web API approach compared to JSON-RPC, using HTTP methods (GET, POST, etc.) and resource-oriented URLs.

  • Method Details

    • values

      public static TransportProtocol[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static TransportProtocol valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • asString

      public String asString()
      Returns the string representation of this transport protocol.

      Used for JSON serialization.

      Returns:
      the transport protocol name as a string
    • fromString

      public static TransportProtocol fromString(String transport)
      Parses a string into a TransportProtocol enum constant.

      Used for JSON deserialization.

      Parameters:
      transport - the transport protocol string (e.g., "JSONRPC", "GRPC", "HTTP+JSON")
      Returns:
      the corresponding TransportProtocol enum constant
      Throws:
      IllegalArgumentException - if the transport string is not recognized