Class AgentCardValidator

java.lang.Object
org.a2aproject.sdk.server.AgentCardValidator

public class AgentCardValidator extends Object
Validates AgentCard transport configuration against available transport endpoints.
  • Field Details

  • Constructor Details

    • AgentCardValidator

      public AgentCardValidator()
  • Method Details

    • resolveAndValidateOnce

      public static AgentCard resolveAndValidateOnce(jakarta.enterprise.inject.Instance<AgentCard> agentCardInstance, AtomicBoolean transportValidated)
      Resolves an AgentCard from the given Instance and validates its transport configuration exactly once using the default validateTransportConfiguration(org.a2aproject.sdk.spec.AgentCard) check. The transportValidated guard is reset on failure so validation can be retried on the next call.
      Parameters:
      agentCardInstance - the CDI instance holding the agent card
      transportValidated - atomic guard ensuring validation runs once
      Returns:
      the resolved agent card
    • resolveAndValidateOnce

      public static AgentCard resolveAndValidateOnce(Supplier<AgentCard> agentCardSupplier, AtomicBoolean transportValidated, Consumer<AgentCard> validator)
      Obtains an AgentCard from the given supplier and applies the provided validator exactly once. The transportValidated guard is reset on failure so validation can be retried on the next call.
      Parameters:
      agentCardSupplier - supplier that produces the agent card
      transportValidated - atomic guard ensuring validation runs once
      validator - validation logic to apply on first access
      Returns:
      the resolved agent card
    • validateTransportConfiguration

      public static void validateTransportConfiguration(AgentCard agentCard)
      Validates the transport configuration of an AgentCard against available transports found on the classpath. Logs warnings for missing transports and errors for unsupported transports.
      Parameters:
      agentCard - the agent card to validate