Package org.a2aproject.sdk.server.grpc.quarkus


package org.a2aproject.sdk.server.grpc.quarkus
Quarkus gRPC reference implementation for the A2A protocol.

This package provides a production-ready gRPC server implementation built on Quarkus gRPC and Protocol Buffers, demonstrating best practices for A2A protocol integration with CDI, authentication, and interceptor support.

Architecture

 gRPC Request (Protocol Buffers)
     ↓
 A2AExtensionsInterceptor (metadata extraction)
     ↓
 QuarkusGrpcHandler (@GrpcService)
     ├─ Protobuf → Domain conversion
     ├─ Create ServerCallContext
     ├─ Route to GrpcHandler (transport layer)
     └─ Domain → Protobuf conversion
         ↓
 GrpcHandler (transport/grpc)
     ↓
 RequestHandler (server-common)
     ↓
 AgentExecutor (your implementation)
 

Core Components

gRPC Methods

Unary RPC (blocking):

  • SendMessage - Send message and wait for completion
  • GetTask - Get task by ID
  • ListTasks - List tasks with filtering
  • CancelTask - Cancel task execution
  • CreateTaskPushNotificationConfig - Configure push notifications
  • GetTaskPushNotificationConfig - Get push notification config
  • ListTaskPushNotificationConfigs - List push notification configs
  • DeleteTaskPushNotificationConfig - Delete push notification config
  • GetExtendedAgentCard - Get extended agent card

Server Streaming RPC:

  • SendStreamingMessage - Send message with streaming response
  • SubscribeToTask - Subscribe to task events

CDI Integration

Required CDI Beans:

Optional CDI Beans:

Usage

Add Dependency:


 <dependency>
   <groupId>org.a2aproject.sdk</groupId>
   <artifactId>a2a-java-sdk-reference-grpc</artifactId>
   <version>${a2a.version}</version>
 </dependency>
 

Provide Agent Card:


 @ApplicationScoped
 public class MyAgentCardProducer {
     @Produces @PublicAgentCard
     public AgentCard agentCard() {
         return new AgentCard.Builder()
             .name("My gRPC Agent")
             .description("Agent description")
             .url("http://localhost:9090")
             .capabilities(new AgentCapabilities.Builder()
                 .streaming(true)
                 .build())
             .build();
     }
 }
 

Provide Agent Executor:


 @ApplicationScoped
 public class MyAgentExecutorProducer {
     @Produces
     public AgentExecutor agentExecutor() {
         return new MyAgentExecutor();
     }
 }
 

Configuration

gRPC Server:

 quarkus.grpc.server.port=9090
 quarkus.grpc.server.host=0.0.0.0
 

Authentication:

 quarkus.security.users.embedded.enabled=true
 quarkus.security.users.embedded.plain-text=true
 quarkus.security.users.embedded.users.alice=password
 

Customization

Custom Context Creation:

Provide a CDI bean implementing CallContextFactory:


 @ApplicationScoped
 public class CustomCallContextFactory implements CallContextFactory {
     @Override
     public <V> ServerCallContext create(StreamObserver<V> responseObserver) {
         // Extract custom data from gRPC context
         Context grpcContext = Context.current();
         Metadata metadata = GrpcContextKeys.METADATA_KEY.get(grpcContext);
         String orgId = metadata.get(
             Metadata.Key.of("x-organization-id", Metadata.ASCII_STRING_MARSHALLER)
         );

         Map<String, Object> state = new HashMap<>();
         state.put("organization", orgId);
         state.put("grpc_response_observer", responseObserver);

         return new ServerCallContext(
             extractUser(),
             state,
             extractExtensions(grpcContext),
             extractVersion(grpcContext)
         );
     }
 }
 

Python Equivalence

This implementation provides equivalent functionality to Python's grpc.aio server:

See Also: