AgentCard Producer generates wrong Agent Card Json
i have created a Quarkus app with 2 AgentCardProducer classes.
To reproduce this issue, download the app folder
cd <folder>//agentcard-reproducer
./mvnw quarkus:dev
go to
http://localhost:8080/binance/.well-known/agent-card.json
http://localhost:8080/github/.well-known/agent-card.json
going through the output, this bit looks not right
"securitySchemes": {
"oidc": {
"openIdConnectUrl": "https://keycloak.tst/realms/wanaku/.well-known/openid-configuration",
"description": "OIDC authentication"
}
},
it should be
"securitySchemes": {
"oidc": {
"openIdConnectSecurityScheme": {
"openIdConnectUrl": "https://keycloak.tst/realms/wanaku/.well-known/openid-configuration",
"description": "OIDC authentication"
}
}
Also this bit
"supportedInterfaces": [
{
"protocolBinding": "JSONRPC",
"url": "http://localhost:11001",
"tenant": null,
"protocolVersion": "1.0"
}
],
"signatures": null,
"url": null,
"preferredTransport": "JSONRPC",
"additionalInterfaces": null
}
should be
"supportedInterfaces": [
{
"protocolBinding": "JSONRPC",
"url": "http://localhost:11001",
"protocolVersion": "1.0"
}
],
"preferredTransport": "JSONRPC"
}
this is a correct AgentCard that i have tested successfully
{
"name": "Test Agent",
"description": "Function calling to Wanaku MCP toolbox. it can call currency conversion API to convert currencies.",
"version": "1.0.0",
"documentationUrl": "http://example.com/docs",
"capabilities": {
"streaming": true,
"pushNotifications": false,
"extendedAgentCard": false
},
"defaultInputModes": [
"text"
],
"defaultOutputModes": [
"text"
],
"skills": [
{
"id": "currency_converter",
"name": "Currency Converter",
"description": "Converts currencies using the Wanaku MCP toolbox",
"tags": [
"currency",
"conversion",
"finance",
"from",
"to",
"amount"
],
"examples": [
"Convert 100 USD to EUR",
"What is 2500 JPY in GBP?"
]
}
],
"securitySchemes": {
"oidc": {
"openIdConnectSecurityScheme": {
"openIdConnectUrl": "https://keycloak.tst/realms/wanaku/.well-known/openid-configuration",
"description": "OIDC authentication"
}
}
},
"securityRequirements": [
{
"schemes": {
"oidc": {
"list": [
"openid",
"profile",
"email",
"binance-server"
]
}
}
}
],
"supportedInterfaces": [
{
"protocolBinding": "JSONRPC",
"url": "http://localhost:11001",
"protocolVersion": "1.0"
}
],
"preferredTransport": "JSONRPC"
}
Hi @mescaja,
I pointed Claude towards your report, and here is what it found:
I investigated the reproducer and the issue is with how the AgentCard is being serialized to JSON. In WebAppResource.java, the AgentCard object is returned directly from a JAX-RS endpoint:
@GET
@Path("/binance/.well-known/agent-card.json")
@Produces(MediaType.APPLICATION_JSON)
public AgentCard getBinancePublicAgentCardUrl() {
return binancePublicAgentCard;
}
Since the project uses quarkus-rest-jackson, Quarkus serializes the AgentCard using Jackson. However, the A2A Java SDK uses Gson with custom type adapters for proper A2A protocol serialization — in particular, SecurityScheme requires a discriminator wrapper (the oneof field from the protobuf definition), and nullable fields should be omitted. Jackson doesn't know about these conventions, which is why:
- securitySchemes values are flattened (missing the openIdConnectSecurityScheme wrapper key)
- Null fields like "tenant": null, "signatures": null etc. appear in the output
The SDK's built-in endpoints handle this correctly using JsonUtil.toJson(). If you want to serve the agent card from your own custom JAX-RS endpoint, you can serialize it explicitly:
@GET
@Path("/binance/.well-known/agent-card.json")
@Produces(MediaType.APPLICATION_JSON)
public String getBinancePublicAgentCardUrl() {
return JsonUtil.toJson(binancePublicAgentCard);
}
Alternatively, you could use the SDK's reference server modules (e.g., a2a-java-sdk-reference-rest or a2a-java-sdk-reference-jsonrpc) which handle the agent card endpoint and serialization for you.
Hopefully that fixes the problem for you?
thanks @kabir, i implemented what you suggested but it did not work.
i have ended up taking a different approach , added static .json files under the resource folder in my A2A server agent quarkus app. I tried a couple of agent cards.
- placed agentcard-binance.json and agentcard-github.json files under src/main/resources
- added these 2 Web Resources
@GET
@Path("/binance/.well-known/agent-card.json")
@Produces(MediaType.APPLICATION_JSON)
public Response getBinancePublicAgentCardUrl() {
InputStream jsonStream = Thread.currentThread()
.getContextClassLoader()
.getResourceAsStream("agentcard-binance.json");
if (jsonStream == null) {
return Response.status(Response.Status.NOT_FOUND)
.entity("{\"error\": \"Resource file not found on classpath\"}")
.build();
}
return Response.ok(jsonStream).build();
}
@GET
@Path("/github/.well-known/agent-card.json")
@Produces(MediaType.APPLICATION_JSON)
public Response getGithubPublicAgentCardUrl() {
InputStream jsonStream = Thread.currentThread()
.getContextClassLoader()
.getResourceAsStream("agentcard-github.json");
if (jsonStream == null) {
return Response.status(Response.Status.NOT_FOUND)
.entity("{\"error\": \"Resource file not found on classpath\"}")
.build();
}
return Response.ok(jsonStream).build();
}
- make the agent cards endpoints public
quarkus.http.auth.permission.public.paths=/favicon.ico,/hello,/.well-known/agent-card.json,/q/*,/binance/.well-known/agent-card.json,/github/.well-known/agent-card.json
-
deploy the image to kubernetes
-
test the agent cards
https://server-agent.prt/binance/.well-known/agent-card.json https://server-agent.prt//github/.well-known/agent-card.json
i have a A2A client agent to test those 2 agent cards, it successfully fetch both agent cards and able to push and receive A2A Messages through fine.
The aim was to scale A2A Server Agents without having to deploy a separate image per agent in Kubenetes (that'd be too much overhead in my view). With this approach i can now deploy just one A2A Server agent with let's say 40 Agent Cards for client A2A Agents to consume
The final tweak i will implement to the above is to move the agent cards json file into kubernetes ConfigMaps. This way i can adjust Agent Skills without touching the server agent code.