11package io .a2a .examples .helloworld ;
22
3-
4- import java .util .Collections ;
5- import java .util .List ;
6-
7- import jakarta .enterprise .context .ApplicationScoped ;
8- import jakarta .enterprise .inject .Produces ;
9-
103import io .a2a .server .PublicAgentCard ;
114import io .a2a .spec .AgentCapabilities ;
125import io .a2a .spec .AgentCard ;
136import io .a2a .spec .AgentInterface ;
147import io .a2a .spec .AgentSkill ;
8+ import io .a2a .spec .TransportProtocol ;
9+ import jakarta .enterprise .context .ApplicationScoped ;
10+ import jakarta .enterprise .inject .Produces ;
1511import org .eclipse .microprofile .config .inject .ConfigProperty ;
1612
13+ import java .util .Collections ;
14+ import java .util .List ;
15+
1716@ ApplicationScoped
1817public class AgentCardProducer {
1918
20- @ ConfigProperty (name = "quarkus.agentcard.protocol" , defaultValue = "JSONRPC" )
21- String protocol ;
19+ @ ConfigProperty (name = "quarkus.agentcard.protocol" , defaultValue = "JSONRPC" )
20+ TransportProtocol protocol ;
2221
2322 @ Produces
2423 @ PublicAgentCard
@@ -39,24 +38,20 @@ public AgentCard agentCard() {
3938 .defaultInputModes (Collections .singletonList ("text" ))
4039 .defaultOutputModes (Collections .singletonList ("text" ))
4140 .skills (Collections .singletonList (AgentSkill .builder ()
42- .id ("hello_world" )
43- .name ("Returns hello world" )
44- .description ("just returns hello world" )
45- .tags (Collections .singletonList ("hello world" ))
46- .examples (List .of ("hi" , "hello world" ))
47- .build ()))
41+ .id ("hello_world" )
42+ .name ("Returns hello world" )
43+ .description ("just returns hello world" )
44+ .tags (Collections .singletonList ("hello world" ))
45+ .examples (List .of ("hi" , "hello world" ))
46+ .build ()))
4847 .build ();
4948 }
5049
5150 private AgentInterface getAgentInterface () {
52- switch (protocol ) {
53- case "GRPC" :
54- return new AgentInterface ("GRPC" , "localhost:9000" );
55- case "HTTP+JSON" :
56- return new AgentInterface ("HTTP+JSON" , "http://localhost:9999" );
57- case "JSONRPC" :
58- default :
59- return new AgentInterface ("JSONRPC" , "http://localhost:9999" );
60- }
51+ String url = switch (protocol ) {
52+ case GRPC -> "localhost:9000" ;
53+ case JSONRPC , HTTP_JSON -> "http://localhost:9999" ;
54+ };
55+ return new AgentInterface (protocol .asString (), url );
6156 }
6257}
0 commit comments