Package org.a2aproject.sdk.server
Class AgentCardValidator
java.lang.Object
org.a2aproject.sdk.server.AgentCardValidator
Validates AgentCard transport configuration against available transport endpoints.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic AgentCardresolveAndValidateOnce(jakarta.enterprise.inject.Instance<AgentCard> agentCardInstance, AtomicBoolean transportValidated) Resolves anAgentCardfrom the givenInstanceand validates its transport configuration exactly once using the defaultvalidateTransportConfiguration(org.a2aproject.sdk.spec.AgentCard)check.static AgentCardresolveAndValidateOnce(Supplier<AgentCard> agentCardSupplier, AtomicBoolean transportValidated, Consumer<AgentCard> validator) Obtains anAgentCardfrom the given supplier and applies the provided validator exactly once.static voidvalidateTransportConfiguration(AgentCard agentCard) Validates the transport configuration of an AgentCard against available transports found on the classpath.
-
Field Details
-
SKIP_PROPERTY
- See Also:
-
SKIP_JSONRPC_PROPERTY
- See Also:
-
SKIP_GRPC_PROPERTY
- See Also:
-
SKIP_REST_PROPERTY
- See Also:
-
-
Constructor Details
-
AgentCardValidator
public AgentCardValidator()
-
-
Method Details
-
resolveAndValidateOnce
public static AgentCard resolveAndValidateOnce(jakarta.enterprise.inject.Instance<AgentCard> agentCardInstance, AtomicBoolean transportValidated) Resolves anAgentCardfrom the givenInstanceand validates its transport configuration exactly once using the defaultvalidateTransportConfiguration(org.a2aproject.sdk.spec.AgentCard)check. ThetransportValidatedguard is reset on failure so validation can be retried on the next call.- Parameters:
agentCardInstance- the CDI instance holding the agent cardtransportValidated- 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 anAgentCardfrom the given supplier and applies the provided validator exactly once. ThetransportValidatedguard is reset on failure so validation can be retried on the next call.- Parameters:
agentCardSupplier- supplier that produces the agent cardtransportValidated- atomic guard ensuring validation runs oncevalidator- validation logic to apply on first access- Returns:
- the resolved agent card
-
validateTransportConfiguration
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
-