Record Class AgentCard

java.lang.Object
java.lang.Record
org.a2aproject.sdk.spec.AgentCard
Record Components:
name - the human-readable name of the agent (required)
description - a brief description of the agent's purpose and functionality (required)
provider - information about the organization or entity providing the agent (optional)
version - the version of the agent implementation (required)
documentationUrl - URL to human-readable documentation for the agent (optional)
capabilities - the capabilities supported by this agent (required)
defaultInputModes - list of supported input modes, e.g., "text", "audio" (required)
defaultOutputModes - list of supported output modes, e.g., "text", "audio" (required)
skills - list of skills that this agent can perform (required)
securitySchemes - map of security scheme names to their definitions (optional)
securityRequirements - list of security requirements for accessing the agent (optional)
iconUrl - URL to an icon representing the agent (optional)
supportedInterfaces - ordered list of protocol+URL interface combinations; first entry is preferred (required)
signatures - digital signatures verifying the authenticity of the agent card (optional)

public record AgentCard(String name, String description, @Nullable AgentProvider provider, String version, @Nullable String documentationUrl, AgentCapabilities capabilities, List<String> defaultInputModes, List<String> defaultOutputModes, List<AgentSkill> skills, @Nullable Map<String,SecurityScheme> securitySchemes, @Nullable List<SecurityRequirement> securityRequirements, @Nullable String iconUrl, List<AgentInterface> supportedInterfaces, @Nullable List<AgentCardSignature> signatures, @Nullable String url, @Nullable String preferredTransport, @Nullable List<Legacy_0_3_AgentInterface> additionalInterfaces) extends Record
The AgentCard is a self-describing manifest for an agent in the A2A Protocol.

An AgentCard provides essential metadata about an agent, including its identity, capabilities, supported skills, communication methods, and security requirements. It serves as the primary discovery mechanism for clients to understand what an agent can do and how to interact with it.

The AgentCard corresponds to the AgentCard type in the A2A Protocol specification, defining the contract between clients and agents for capability advertisement.

This class is immutable and uses the Builder pattern for construction to handle the mix of required and optional fields defined by the specification.

Important: The supportedInterfaces() field specifies how clients can communicate with the agent. Each entry combines a protocol binding (e.g., "JSONRPC", "GRPC") with a URL endpoint. The first entry in the list is the preferred interface.

See Also:
  • Constructor Details

    • AgentCard

      public AgentCard(String name, String description, @Nullable AgentProvider provider, String version, @Nullable String documentationUrl, AgentCapabilities capabilities, List<String> defaultInputModes, List<String> defaultOutputModes, List<AgentSkill> skills, @Nullable Map<String,SecurityScheme> securitySchemes, @Nullable List<SecurityRequirement> securityRequirements, @Nullable String iconUrl, List<AgentInterface> supportedInterfaces, @Nullable List<AgentCardSignature> signatures, @Nullable String url, @Nullable String preferredTransport, @Nullable List<Legacy_0_3_AgentInterface> additionalInterfaces)
      Compact constructor that validates required fields.
      Parameters:
      name - the name parameter (see class-level JavaDoc)
      description - the description parameter (see class-level JavaDoc)
      provider - the provider parameter (see class-level JavaDoc)
      version - the version parameter (see class-level JavaDoc)
      documentationUrl - the documentationUrl parameter (see class-level JavaDoc)
      capabilities - the capabilities parameter (see class-level JavaDoc)
      defaultInputModes - the defaultInputModes parameter (see class-level JavaDoc)
      defaultOutputModes - the defaultOutputModes parameter (see class-level JavaDoc)
      skills - the skills parameter (see class-level JavaDoc)
      securitySchemes - the securitySchemes parameter (see class-level JavaDoc)
      securityRequirements - the security parameter (see class-level JavaDoc)
      iconUrl - the iconUrl parameter (see class-level JavaDoc)
      supportedInterfaces - the supportedInterfaces parameter (see class-level JavaDoc)
      signatures - the signatures parameter (see class-level JavaDoc)
      Throws:
      IllegalArgumentException - if any required field is null
  • Method Details

    • builder

      public static AgentCard.Builder builder()
      Create a new Builder
      Returns:
      the builder
    • builder

      public static AgentCard.Builder builder(AgentCard card)
      Create a new Builder initialized with values from an existing AgentCard.

      This builder creates defensive copies of mutable collections to ensure that modifications to the builder do not affect the original AgentCard.

      Parameters:
      card - the AgentCard to copy values from
      Returns:
      the builder
    • 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.
    • name

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • description

      public String description()
      Returns the value of the description record component.
      Returns:
      the value of the description record component
    • provider

      public @Nullable AgentProvider provider()
      Returns the value of the provider record component.
      Returns:
      the value of the provider record component
    • version

      public String version()
      Returns the value of the version record component.
      Returns:
      the value of the version record component
    • documentationUrl

      public @Nullable String documentationUrl()
      Returns the value of the documentationUrl record component.
      Returns:
      the value of the documentationUrl record component
    • capabilities

      public AgentCapabilities capabilities()
      Returns the value of the capabilities record component.
      Returns:
      the value of the capabilities record component
    • defaultInputModes

      public List<String> defaultInputModes()
      Returns the value of the defaultInputModes record component.
      Returns:
      the value of the defaultInputModes record component
    • defaultOutputModes

      public List<String> defaultOutputModes()
      Returns the value of the defaultOutputModes record component.
      Returns:
      the value of the defaultOutputModes record component
    • skills

      public List<AgentSkill> skills()
      Returns the value of the skills record component.
      Returns:
      the value of the skills record component
    • securitySchemes

      public @Nullable Map<String,SecurityScheme> securitySchemes()
      Returns the value of the securitySchemes record component.
      Returns:
      the value of the securitySchemes record component
    • securityRequirements

      public @Nullable List<SecurityRequirement> securityRequirements()
      Returns the value of the securityRequirements record component.
      Returns:
      the value of the securityRequirements record component
    • iconUrl

      public @Nullable String iconUrl()
      Returns the value of the iconUrl record component.
      Returns:
      the value of the iconUrl record component
    • supportedInterfaces

      public List<AgentInterface> supportedInterfaces()
      Returns the value of the supportedInterfaces record component.
      Returns:
      the value of the supportedInterfaces record component
    • signatures

      public @Nullable List<AgentCardSignature> signatures()
      Returns the value of the signatures record component.
      Returns:
      the value of the signatures record component
    • url

      public @Nullable String url()
      Returns the value of the url record component.
      Returns:
      the value of the url record component
    • preferredTransport

      public @Nullable String preferredTransport()
      Returns the value of the preferredTransport record component.
      Returns:
      the value of the preferredTransport record component
    • additionalInterfaces

      public @Nullable List<Legacy_0_3_AgentInterface> additionalInterfaces()
      Returns the value of the additionalInterfaces record component.
      Returns:
      the value of the additionalInterfaces record component