Configuration Reference

Complete reference of all configuration options across a2a-rust crates.

Server Configuration

RequestHandlerBuilder

OptionTypeDefaultDescription
with_agent_cardAgentCardNoneDiscovery card for /.well-known/agent.json
with_task_storeimpl TaskStoreInMemoryTaskStoreCustom task storage backend
with_task_store_configTaskStoreConfigNo limitsTTL and capacity for default store
with_push_config_storeimpl PushConfigStoreInMemoryPushConfigStoreCustom push config storage
with_push_senderimpl PushSenderNoneWebhook delivery implementation
with_interceptorimpl ServerInterceptorEmpty chainServer middleware
with_executor_timeoutDurationNoneMax time for executor completion
with_event_queue_capacityusize64Bounded channel size per stream
with_max_event_sizeusize16 MiBMax serialized SSE event size
with_max_concurrent_streamsusizeUnboundedLimit concurrent SSE connections
with_event_queue_write_timeoutDuration5sWrite timeout for event queue sends
with_metricsimpl MetricsNoopMetricsMetrics observer for handler activity
with_handler_limitsHandlerLimitsSee belowConfigurable validation limits

HandlerLimits

FieldTypeDefaultDescription
max_id_lengthusize1,024Maximum task/context ID length
max_metadata_sizeusize1 MiBMaximum serialized metadata size
max_cancellation_tokensusize10,000Cleanup sweep threshold
max_token_ageDuration1 hourStale token eviction age
push_delivery_timeoutDuration5sPer-webhook delivery timeout

TaskStoreConfig

FieldTypeDefaultDescription
max_capacityOption<usize>10,000Maximum stored tasks; oldest terminal tasks evicted on overflow
task_ttlOption<Duration>1 hourTTL for completed/failed tasks
eviction_intervalu6464Writes between automatic eviction sweeps
max_page_sizeu321,000Maximum tasks per page in list queries

InMemoryPushConfigStore

ConstructorDefaultDescription
::new()100Default max push configs per task
::with_max_configs_per_task(N)Custom per-task push config limit

DispatchConfig

Shared configuration for both JSON-RPC and REST dispatchers. Pass to JsonRpcDispatcher::with_config() or RestDispatcher::with_config().

FieldTypeDefaultDescription
max_request_body_sizeusize4 MiBLarger bodies return 413
body_read_timeoutDuration30sSlow loris protection
max_query_string_lengthusize4,096REST only; longer queries return 414
sse_keep_alive_intervalDuration30sPeriodic keep-alive comment interval for SSE streams
sse_channel_capacityusize64SSE response body channel buffer size

GrpcConfig

Configuration for the gRPC dispatcher (requires grpc feature).

FieldTypeDefaultDescription
max_message_sizeusize4 MiBMaximum inbound/outbound message size
concurrency_limitusize256Max concurrent gRPC requests per connection
stream_channel_capacityusize64Bounded channel for streaming responses

PushRetryPolicy

Configurable retry policy for HttpPushSender. Pass via HttpPushSender::with_retry_policy().

FieldTypeDefaultDescription
max_attemptsusize3Maximum delivery attempts
backoffVec<Duration>[1s, 2s]Backoff durations between retries

RateLimitConfig

FieldTypeDefaultDescription
requests_per_windowu64100Max requests per caller per window
window_secsu6460Window duration in seconds

Internal Limits

LimitValueDescription
Event queue typebroadcastFan-out to multiple subscribers; slow readers skip missed events
Rate limiter cleanup interval256 checksStale buckets (from departed callers) evicted every 256 check() calls
Rate limiter window CASLock-freeWindow transitions use compare_exchange to avoid TOCTOU races
Credential store poisoningFail-fastInMemoryCredentialsStore panics on poisoned locks rather than returning None

Client Configuration

ClientBuilder

OptionTypeDefaultDescription
with_protocol_binding&strAuto-detectTransport: "JSONRPC", "REST", or "GRPC"
with_timeoutDuration30sPer-request timeout
with_connection_timeoutDuration10sTCP connection timeout
with_stream_connect_timeoutDuration30sSSE connect timeout
with_retry_policyRetryPolicyNoneRetry on transient errors
with_accepted_output_modesVec<String>["text/plain", "application/json"]MIME types accepted
with_history_lengthu32NoneMessages in responses
with_return_immediatelyboolfalseDon't wait for completion
with_interceptorimpl CallInterceptorEmpty chainClient middleware

GrpcTransportConfig

Configuration for the gRPC client transport (requires grpc feature).

FieldTypeDefaultDescription
timeoutDuration30sPer-request timeout
connect_timeoutDuration10sConnection timeout
max_message_sizeusize4 MiBMaximum message size
stream_channel_capacityusize64Streaming response buffer

RetryPolicy

FieldTypeDefaultDescription
max_retriesu323Maximum retry attempts
initial_backoffDuration500msBackoff before first retry
max_backoffDuration30sCaps exponential growth
backoff_multiplierf642.0Multiplier per retry

SSE Parser Limits

LimitValueDescription
Buffer cap16 MiBMax buffered SSE data (aligned with server)
Connect timeout30s (default)Initial connection timeout

HTTP Caching (Agent Card)

HeaderDefaultDescription
Cache-Controlpublic, max-age=60Configurable max-age
ETagAuto-computedContent hash
Last-ModifiedAuto-setTimestamp of last change

Feature Flags

a2a-protocol-server

FeatureDefaultDescription
signingOffAgent card signing
tracingOffStructured logging via tracing crate
sqliteOffSQLite-backed task and push config stores via sqlx
websocketOffWebSocket transport via tokio-tungstenite
grpcOffgRPC transport via tonic
otelOffOpenTelemetry metrics via opentelemetry-otlp

a2a-protocol-client

FeatureDefaultDescription
signingOffAgent card signing verification
tracingOffStructured logging via tracing crate
tls-rustlsOffHTTPS via rustls (no OpenSSL dependency)
websocketOffWebSocket transport via tokio-tungstenite
grpcOffgRPC transport via tonic

a2a-protocol-types

FeatureDefaultDescription
signingOffJWS/ES256 agent card signing (RFC 8785 canonicalization)

a2a-protocol-sdk (umbrella)

FeatureDefaultDescription
signingOffEnables signing in all sub-crates
tracingOffEnables tracing in client and server
tls-rustlsOffEnables tls-rustls in client
grpcOffEnables grpc in client and server
otelOffEnables otel in the server

Environment Variables

VariableDescription
RUST_LOGLog level filter (when tracing feature is enabled)

Examples:

RUST_LOG=info              # Info and above
RUST_LOG=debug             # Debug and above
RUST_LOG=a2a_protocol_server=debug  # Debug for server crate only
RUST_LOG=a2a_protocol_server=trace,a2a_protocol_client=debug  # Per-crate levels

Next Steps