Record Class AgentInterface

java.lang.Object
java.lang.Record
org.a2aproject.sdk.spec.AgentInterface
Record Components:
protocolBinding - the protocol binding supported at this URL (e.g., "JSONRPC", "GRPC", "HTTP+JSON") (required)
url - the endpoint URL where this interface is available; must be a valid absolute HTTPS URL in production (required)
tenant - optional tenant to be set in the request when calling the agent.
protocolVersion - the version of the A2A protocol this interface exposes (e.g., "1.0", "0.3") (required)

public record AgentInterface(String protocolBinding, String url, @Nullable String tenant, String protocolVersion) extends Record
Declares a combination of a target URL and protocol binding for accessing an agent.

AgentInterface defines how clients can connect to and communicate with an agent using a specific protocol binding at a particular endpoint. The protocol binding is an open-form string that can be extended for other protocol bindings. Core officially supported bindings are JSONRPC, GRPC, and HTTP+JSON.

Agents may support multiple interfaces to allow flexibility in how clients communicate. The AgentCard.supportedInterfaces() field contains an ordered list of interfaces, with the first entry being the preferred method for accessing the agent.

This class is immutable.

See Also:
  • Field Details

    • CURRENT_PROTOCOL_VERSION

      public static final String CURRENT_PROTOCOL_VERSION
      The default A2A Protocol version used when not explicitly specified.
      See Also:
  • Constructor Details

    • AgentInterface

      public AgentInterface(String protocolBinding, String url, @Nullable String tenant, String protocolVersion)
      Compact constructor that validates required fields.
      Parameters:
      protocolBinding - the protocolBinding parameter (see class-level JavaDoc)
      url - the url parameter (see class-level JavaDoc)
      tenant - the tenant parameter (see class-level JavaDoc)
      protocolVersion - the protocolVersion parameter (see class-level JavaDoc)
      Throws:
      IllegalArgumentException - if protocolBinding, url, or protocolVersion is null
    • AgentInterface

      public AgentInterface(String protocolBinding, String url, String tenant)
      Convenience constructor for creating an AgentInterface with specified tenant and default protocol version.
      Parameters:
      protocolBinding - the protocol binding (see class-level JavaDoc)
      url - the endpoint URL (see class-level JavaDoc)
      tenant - the tenant (see class-level JavaDoc)
    • AgentInterface

      public AgentInterface(String protocolBinding, String url)
      Convenience constructor for creating an AgentInterface with default protocol version and no tenant.
      Parameters:
      protocolBinding - the protocol binding (see class-level JavaDoc)
      url - the endpoint URL (see class-level JavaDoc)
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • protocolBinding

      public String protocolBinding()
      Returns the value of the protocolBinding record component.
      Returns:
      the value of the protocolBinding record component
    • url

      public String url()
      Returns the value of the url record component.
      Returns:
      the value of the url record component
    • tenant

      public @Nullable String tenant()
      Returns the value of the tenant record component.
      Returns:
      the value of the tenant record component
    • protocolVersion

      public String protocolVersion()
      Returns the value of the protocolVersion record component.
      Returns:
      the value of the protocolVersion record component