Record Class 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)
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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder for constructing immutableAgentCardinstances. -
Constructor Summary
ConstructorsConstructorDescriptionAgentCard(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. -
Method Summary
Modifier and TypeMethodDescription@Nullable List<Legacy_0_3_AgentInterface>Returns the value of theadditionalInterfacesrecord component.static AgentCard.Builderbuilder()Create a new Builderstatic AgentCard.BuilderCreate a new Builder initialized with values from an existing AgentCard.Returns the value of thecapabilitiesrecord component.Returns the value of thedefaultInputModesrecord component.Returns the value of thedefaultOutputModesrecord component.Returns the value of thedescriptionrecord component.@Nullable StringReturns the value of thedocumentationUrlrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.@Nullable StringiconUrl()Returns the value of theiconUrlrecord component.name()Returns the value of thenamerecord component.@Nullable StringReturns the value of thepreferredTransportrecord component.@Nullable AgentProviderprovider()Returns the value of theproviderrecord component.@Nullable List<SecurityRequirement>Returns the value of thesecurityRequirementsrecord component.@Nullable Map<String,SecurityScheme> Returns the value of thesecuritySchemesrecord component.@Nullable List<AgentCardSignature>Returns the value of thesignaturesrecord component.skills()Returns the value of theskillsrecord component.Returns the value of thesupportedInterfacesrecord component.final StringtoString()Returns a string representation of this record class.@Nullable Stringurl()Returns the value of theurlrecord component.version()Returns the value of theversionrecord component.
-
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
Create a new Builder- Returns:
- the builder
-
builder
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
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). -
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
description
Returns the value of thedescriptionrecord component.- Returns:
- the value of the
descriptionrecord component
-
provider
Returns the value of theproviderrecord component.- Returns:
- the value of the
providerrecord component
-
version
Returns the value of theversionrecord component.- Returns:
- the value of the
versionrecord component
-
documentationUrl
Returns the value of thedocumentationUrlrecord component.- Returns:
- the value of the
documentationUrlrecord component
-
capabilities
Returns the value of thecapabilitiesrecord component.- Returns:
- the value of the
capabilitiesrecord component
-
defaultInputModes
Returns the value of thedefaultInputModesrecord component.- Returns:
- the value of the
defaultInputModesrecord component
-
defaultOutputModes
Returns the value of thedefaultOutputModesrecord component.- Returns:
- the value of the
defaultOutputModesrecord component
-
skills
Returns the value of theskillsrecord component.- Returns:
- the value of the
skillsrecord component
-
securitySchemes
Returns the value of thesecuritySchemesrecord component.- Returns:
- the value of the
securitySchemesrecord component
-
securityRequirements
Returns the value of thesecurityRequirementsrecord component.- Returns:
- the value of the
securityRequirementsrecord component
-
iconUrl
Returns the value of theiconUrlrecord component.- Returns:
- the value of the
iconUrlrecord component
-
supportedInterfaces
Returns the value of thesupportedInterfacesrecord component.- Returns:
- the value of the
supportedInterfacesrecord component
-
signatures
Returns the value of thesignaturesrecord component.- Returns:
- the value of the
signaturesrecord component
-
url
Returns the value of theurlrecord component.- Returns:
- the value of the
urlrecord component
-
preferredTransport
Returns the value of thepreferredTransportrecord component.- Returns:
- the value of the
preferredTransportrecord component
-
additionalInterfaces
Returns the value of theadditionalInterfacesrecord component.- Returns:
- the value of the
additionalInterfacesrecord component
-