a2a-protocol-server 0.7.0

Agent2Agent (A2A) protocol v1.0 — server framework (hyper-backed)
Documentation
# SPDX-License-Identifier: Apache-2.0
# Copyright 2026 Tom F. <tomf@tomtomtech.net> (https://github.com/tomtom215)

[package]
name        = "a2a-protocol-server"
version     = "0.7.0"
description = "Agent2Agent (A2A) protocol v1.0 — server framework (hyper-backed)"
readme      = "README.md"

edition.workspace      = true
rust-version.workspace = true
license.workspace      = true
authors.workspace      = true
repository.workspace   = true
homepage.workspace     = true
documentation          = "https://docs.rs/a2a-protocol-server"
keywords               = ["a2a", "agent2agent", "agent", "protocol", "server"]
categories             = ["network-programming", "web-programming"]

[features]
## Enable agent card signing (JWS, RFC 8785 canonicalization).
signing = ["a2a-protocol-types/signing"]
## Enable structured logging via the `tracing` crate (zero cost when disabled).
tracing = ["dep:tracing"]
## Enable HTTPS delivery for the bundled push-notification sender via rustls
## (no OpenSSL system dependency). Without this feature the bundled
## `HttpPushSender` speaks plaintext HTTP only and fails fast on `https://`.
tls-rustls = ["dep:hyper-rustls", "dep:rustls", "dep:rustls-pki-types", "dep:webpki-roots"]
## Enable SQLite-backed task and push config stores via `sqlx`.
sqlite = ["dep:sqlx"]
## Enable PostgreSQL-backed task and push config stores via `sqlx` with PostgreSQL driver.
postgres = ["dep:sqlx", "sqlx/postgres", "sqlx/json"]
## Enable WebSocket transport via `tokio-tungstenite`.
websocket = ["dep:tokio-tungstenite", "dep:futures-util"]
## Enable gRPC transport via `tonic`. Serves the canonical `lf.a2a.v1.A2AService`
## (protobuf-native, wire-compatible with the official Go/Python/Java A2A SDKs).
grpc = ["dep:tonic", "dep:tonic-prost", "dep:prost", "dep:tokio-stream", "dep:tonic-types", "dep:tonic-prost-build", "dep:protoc-bin-vendored", "a2a-protocol-types/proto"]
## Additionally serve the deprecated pre-0.7 JSON-in-`bytes` tunnel service
## (`a2a.v1.A2aService`) alongside the canonical one, for compatibility with
## a2a-rust 0.6 gRPC clients during rolling upgrades. Will be removed in 0.8.
grpc-legacy-json = ["grpc"]
## Enable OpenTelemetry integration for native OTLP export of traces and metrics.
otel = ["dep:opentelemetry", "dep:opentelemetry_sdk", "dep:opentelemetry-otlp"]
## Enable Axum framework integration (Router, extractors, IntoResponse).
axum = ["dep:axum"]
## Enable JWT bearer-token authentication (HS256/RS256/ES256, static or remote
## JWKS with OIDC discovery) via `ring`. The header/token interceptors
## (`ApiKeyAuthInterceptor`, `BearerTokenAuthInterceptor`) need no feature.
auth-jwt = ["dep:ring", "dep:base64"]

[dependencies]
a2a-protocol-types      = { version = "0.7.0", path = "../a2a-protocol-types" }
serde           = { workspace = true }
serde_json     = { workspace = true }
hyper          = { workspace = true }
http-body-util = { workspace = true }
hyper-util     = { workspace = true, features = ["server", "server-auto"] }
tokio          = { workspace = true, features = ["signal"] }
uuid           = { workspace = true }
bytes          = "1"
tokio-util     = { version = ">=0.7, <0.8", features = ["rt"] }
tracing        = { workspace = true, optional = true }
hyper-rustls   = { version = ">=0.27, <0.28", optional = true, default-features = false, features = ["ring", "http1", "http2", "webpki-tokio"] }
rustls         = { version = ">=0.23, <0.24", optional = true, default-features = false, features = ["std", "tls12", "ring"] }
rustls-pki-types = { version = ">=1.7, <2", optional = true }
webpki-roots   = { version = ">=1.0, <2", optional = true }
# JWT verification (auth-jwt feature). `ring` is the same crypto backend the
# types crate's `signing` feature already uses; `base64` is tiny with no
# transitive deps.
ring           = { version = "0.17", optional = true }
base64         = { version = "0.22", optional = true }
sqlx           = { workspace = true, optional = true }
tokio-tungstenite = { version = ">=0.29, <0.30", optional = true }
futures-util      = { version = ">=0.3.30, <0.4", optional = true, default-features = false, features = ["sink"] }
tonic             = { workspace = true, optional = true }
tonic-prost       = { workspace = true, optional = true }
tonic-types       = { workspace = true, optional = true }
prost             = { workspace = true, optional = true }
tokio-stream      = { workspace = true, optional = true }
opentelemetry     = { version = "0.31", optional = true }
# `experimental_metrics_custom_reader` exposes `ManualReader` + the `MetricReader`
# trait for the unit tests in `src/otel/mod.rs` that verify instrument emission
# end-to-end. The feature only *adds* API surface — it does not change runtime
# behaviour — so its "experimental" status only matters to the test code.
opentelemetry_sdk = { version = "0.31", optional = true, features = ["rt-tokio", "metrics", "experimental_metrics_custom_reader"] }
opentelemetry-otlp = { version = "0.31", optional = true, default-features = false, features = ["grpc-tonic", "metrics"] }
axum = { version = "0.8", optional = true, default-features = false, features = ["json", "query", "tokio"] }

[build-dependencies]
tonic-prost-build   = { workspace = true, optional = true }
protoc-bin-vendored = { workspace = true, optional = true }

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]

[dev-dependencies]
tokio = { workspace = true, features = ["macros", "rt-multi-thread", "net", "time", "test-util"] }
hyper = { workspace = true }
hyper-util = { workspace = true, features = ["server", "server-auto"] }
http-body-util = { workspace = true }
bytes = "1"
serde_json = { workspace = true }
a2a-protocol-types = { version = "0.7.0", path = "../a2a-protocol-types" }
criterion = { workspace = true }
sqlx      = { workspace = true }
axum      = { version = "0.8", features = ["json", "query", "tokio"] }
# For the live-TLS end-to-end push-sender test (gated on `tls-rustls`): generate
# a throwaway CA + server cert and run a real rustls HTTPS server on loopback.
rcgen = "0.14"
tokio-rustls = { version = ">=0.26, <0.27", default-features = false, features = ["ring"] }

[[bench]]
name = "handler_bench"
harness = false