Skip to main content

Module grpc

Module grpc 

Source
Available on crate feature grpc only.
Expand description

gRPC dispatcher for the A2A server.

GrpcDispatcher serves the canonical lf.a2a.v1.A2AService — the protobuf-native A2A v1.0 binding, wire-compatible with the official Go, Python, and Java A2A SDKs. Request and response messages are the prost-generated types from a2a_protocol_types::proto, converted to the same domain types the JSON-RPC and REST bindings use before being routed to the underlying crate::RequestHandler.

Releases before 0.7 tunneled JSON inside a protobuf bytes envelope on a non-standard service (a2a.v1.A2aService), served alongside the canonical one behind the off-by-default grpc-legacy-json feature. That feature and its service were removed in 0.8; the canonical binding is the only gRPC surface. A 0.6 client must upgrade rather than be tunneled for.

§Configuration

Use GrpcConfig to control message size limits and concurrency.

§Example

use std::sync::Arc;
use a2a_protocol_server::dispatch::grpc::{GrpcDispatcher, GrpcConfig};
use a2a_protocol_server::serve::{ServeConfig, shutdown_signal};
use a2a_protocol_server::RequestHandlerBuilder;
let handler = Arc::new(
    RequestHandlerBuilder::new(MyExec).with_agent_card(card()).build().unwrap()
);
let config = GrpcConfig::default();
let listener = tokio::net::TcpListener::bind("127.0.0.1:50051").await?;
let report = GrpcDispatcher::new(handler, config)
    .with_serve_config(ServeConfig::new().with_max_connections(1024))
    .serve_with_shutdown(listener, shutdown_signal())
    .await?;
assert_eq!(report.refused, None);

Structs§

A2aServiceImpl
The tonic service implementation for the canonical A2A binding.
A2aServiceServer
Provides operations for interacting with agents using the A2A protocol.
Certificate
Represents a X509 certificate.
GrpcConfig
Configuration for the gRPC dispatcher.
GrpcDispatcher
gRPC dispatcher that routes A2A requests to a RequestHandler.
Identity
Represents a private key and X509 certificate.
ServerTlsConfig
Configures TLS settings for servers.

Constants§

DEFAULT_GRPC_KEEPALIVE_INTERVAL
How often GrpcDispatcher sends an HTTP/2 PING on a connection that has carried nothing, by default: 60 s (ADR 0042).
DEFAULT_GRPC_KEEPALIVE_TIMEOUT
How long GrpcDispatcher waits for a PING to be answered before it closes the connection, by default: 20 s (ADR 0042).