Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions client/base/src/main/java/org/a2aproject/sdk/A2A.java
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,14 @@ public static AgentCard getAgentCard(String agentUrl, String relativeCardPath, M
* @throws org.a2aproject.sdk.spec.A2AClientJSONError if the response body cannot be decoded as JSON or validated against the AgentCard schema
*/
public static AgentCard getAgentCard(A2AHttpClient httpClient, String agentUrl, String relativeCardPath, Map<String, String> authHeaders) throws A2AClientError, A2AClientJSONError {
A2ACardResolver resolver = new A2ACardResolver(httpClient, agentUrl, "", relativeCardPath, authHeaders);
return resolver.getAgentCard();
A2ACardResolver resolver = A2ACardResolver.builder()
.httpClient(httpClient)
.baseUrl(agentUrl)
.agentCardPath(relativeCardPath)
.authHeaders(authHeaders)
.build();
return (relativeCardPath == null || relativeCardPath.isBlank())
? resolver.getWellKnownAgentCard()
: resolver.getConfiguredAgentCard();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public class HelloWorldClient {
public static void main(String[] args) {
OpenTelemetrySdk openTelemetrySdk = null;
try {
AgentCard publicAgentCard = new A2ACardResolver(SERVER_URL).getAgentCard();
AgentCard publicAgentCard = A2ACardResolver.builder().baseUrl(SERVER_URL).build().getWellKnownAgentCard();
System.out.println("Successfully fetched public agent card:");
System.out.println(JsonUtil.toJson(publicAgentCard));
System.out.println("Using public agent card for client initialization (default).");
Expand Down
Loading