Package org.a2aproject.sdk.spec
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.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe default A2A Protocol version used when not explicitly specified. -
Constructor Summary
ConstructorsConstructorDescriptionAgentInterface(String protocolBinding, String url) Convenience constructor for creating an AgentInterface with default protocol version and no tenant.AgentInterface(String protocolBinding, String url, @Nullable String tenant, String protocolVersion) Compact constructor that validates required fields.AgentInterface(String protocolBinding, String url, String tenant) Convenience constructor for creating an AgentInterface with specified tenant and default protocol version. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of theprotocolBindingrecord component.Returns the value of theprotocolVersionrecord component.@Nullable Stringtenant()Returns the value of thetenantrecord component.final StringtoString()Returns a string representation of this record class.url()Returns the value of theurlrecord component.
-
Field Details
-
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
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
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
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. -
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. -
equals
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 withObjects::equals(Object,Object). -
protocolBinding
Returns the value of theprotocolBindingrecord component.- Returns:
- the value of the
protocolBindingrecord component
-
url
Returns the value of theurlrecord component.- Returns:
- the value of the
urlrecord component
-
tenant
Returns the value of thetenantrecord component.- Returns:
- the value of the
tenantrecord component
-
protocolVersion
Returns the value of theprotocolVersionrecord component.- Returns:
- the value of the
protocolVersionrecord component
-