Installation

Requirements

  • Rust 1.94+ (stable; CI tests the MSRV and current stable)
  • A working internet connection for downloading crates
  • protoc (Protocol Buffers compiler) — bundled automatically: the grpc/proto build scripts use a vendored protoc (protoc-bin-vendored), so a clean cargo build -p a2a-protocol-sdk --features grpc works with no system install. Set the PROTOC environment variable only to override with your own binary (or on a platform the vendored binaries don't cover).

Adding to Your Project

The easiest way to use a2a-rust is through the umbrella SDK crate, which re-exports everything you need:

[dependencies]
a2a-protocol-sdk = "0.16"
tokio = { version = "1", features = ["full"] }

The SDK crate re-exports a2a-protocol-types, a2a-protocol-client, and a2a-protocol-server so you only need one dependency.

Individual Crates

If you prefer fine-grained control, depend on individual crates:

# Types only (no I/O, no async runtime)
a2a-protocol-types = "0.16"

# Client only
a2a-protocol-client = "0.16"

# Server only
a2a-protocol-server = "0.16"

This is useful when:

  • You're building a client only and don't need server types
  • You're building a server only and don't need client types
  • You want to minimize compile times and dependency trees

Feature Flags

Features are off by default to minimize compile times and dependency trees, with these exceptions. tls-rustls is on by default for a2a-protocol-client, a2a-protocol-server and a2a-protocol-sdk, because the A2A spec serves agents over HTTPS and the client, the bundled push sender and the server's JWKS, OIDC and model-endpoint fetches must reach them out of the box. tracing and otel are on by default for a2a-protocol-client, a2a-protocol-server and a2a-protocol-sdk, so a default build logs through, and records OpenTelemetry spans and metrics with, whatever tracing subscriber and provider the application installs. webhook is on by default for the client and the SDK. otlp (Telemetry and OTLP export) is on by default in a2a-protocol-sdk only. default-features = false removes a crate's defaults — on the SDK too, which takes the client and server without theirs: an SDK built that way has no rustls, no logging, no OpenTelemetry and no webhook receiver.

Some features turn on others. The arrows below are the [features] tables of the four crates' Cargo.toml, as the SDK forwards them. websocket, sqlite, postgres, axum, tool-loop, auth-jwt and encryption turn on no other feature, and are left out. skills turns on tool-loop and is not drawn:

Feature implications: otel-prometheus and otlp-json each turn on otlp, otlp turns on otel, otel turns on tracing; grpc-tls turns on grpc and tls-rustls, grpc turns on the types crate's proto; audit turns on the types crate's signing. The SDK's defaults, boxed, are otlp, otel, tracing, tls-rustls and webhook.
Which feature turns on which. The box holds the SDK's default set.

a2a-protocol-types

FeatureDescription
signingJWS agent card signing, ES256 or EdDSA (Ed25519), with RFC 8785 canonicalization
auditAudit record schema, hash chains, ES256/Ed25519-signed checkpoints and chain verification (audit::verify_chain); implies signing
protoCanonical protobuf message types and the JSON⇄proto conversions (turned on by grpc)

a2a-protocol-client

FeatureDescription
tls-rustlsHTTPS via rustls (no OpenSSL required); on by default
signingForwards a2a-protocol-types/signing, and lets card discovery verify signatures: pass the keys you trust to CardFetchOptions::with_signature_keys and a _with_options fetch verifies the card, refusing an unsigned one unless with_require_signature(false); fetch_jwks fetches a key set. Nothing is verified by default, and the client never signs. verify_agent_card checks a card you already hold
tracingStructured logging via the tracing crate, and a CLIENT span per call; on by default
otelEach call's traceparent names the call's own span when a tracing-opentelemetry layer records it (implies tracing); on by default
websocketWebSocket transport via tokio-tungstenite
grpcgRPC transport via tonic (plaintext)
grpc-tlsgRPC over TLS — grpc + tonic's rustls connector (independent of tls-rustls); needed for https:// gRPC endpoints and for the default dialling of a bare non-loopback host:port target
testingA scripted hostile peer (testing::ScriptedPeer) that stalls, cuts off, mis-frames or refuses on each binding, for testing code that calls agents
webhookThe push-notification webhook receiver (webhook::WebhookReceiver): token and Authorization checks, task-id check, duplicate suppression, optional rate limit (spec §4.3.3, §13.2); on by default

a2a-protocol-server

FeatureDescription
signingForwards a2a-protocol-types/signing; adds RequestHandlerBuilder::with_content_signer, which signs every artifact, status message and direct reply the server sends, not a task's history (ADR 0027). The server never signs or verifies the card it serves: sign it with sign_card_es256 before handing it to the builder
tracingStructured logging via the tracing crate (on by default)
tls-rustlsHTTPS delivery for the bundled push-notification sender; HTTPS on the server's own listener (Server::with_tls, Server::with_tls_pem); MutualTlsAuthInterceptor, which names a caller from its client certificate (also available with grpc-tls); on by default since 0.16.0
sqliteSQLite-backed task and push config stores via sqlx
postgresPostgreSQL-backed task and push config stores via sqlx
websocketWebSocket transport via tokio-tungstenite
grpcgRPC transport via tonic
grpc-tlsTLS on the gRPC listener (GrpcDispatcher::with_tls); implies grpc
otelOtelMetrics and the spans' OpenTelemetry bridge, through the API only (on by default)
otlpTelemetry: OTLP export of traces, metrics and logs, gRPC or HTTP/protobuf, with a Langfuse preset (implies otel)
otlp-jsonOTLP/HTTP with JSON bodies (OtlpProtocol::HttpJson); off by default because it would also make JSON the default of an application's own opentelemetry-otlp exporters (implies otlp)
otel-prometheusOTEL_METRICS_EXPORTER=prometheus: serve the metrics at /metrics for a Prometheus that scrapes, with no collector in between; off by default because it adds opentelemetry-prometheus and a listener (implies otlp)
conformanceA harness that grades an AgentExecutor against the protocol's invariants
axumAxum framework integration (RestRouter)
tool-loopTool calling inside a task: tool_loop::ToolLoop, ToolLoopExecutor and the chat-completions client OpenAiChatModel
skillsAgent Skills in the tool loop, scripts never run: skills::SkillCatalog and ToolLoopExecutor::with_skills (ADR 0035; implies tool-loop)
auth-jwtJWT bearer-token authentication (JwtAuthInterceptor)
encryptionEncryption at rest for task content (EncryptedTaskStore)
auditTamper-evident audit trail (RequestHandlerBuilder::with_audit, ADR 0015): calls, runs, task events and cancel requests in a SHA-256 hash chain per tenant, signed checkpoints, legal holds, a six-month retention floor; SQLite/PostgreSQL audit stores with those features

a2a-protocol-sdk (umbrella)

FeatureDescription
signingEnables signing across types, client, and server
tracingEnables tracing across client and server (on by default)
tls-rustlsEnables HTTPS in the client, TLS push delivery in the server, and Server::with_tls on the server's own listener (on by default)
grpcEnables gRPC across client and server
grpc-tlsEnables gRPC over TLS in the client and on the server's gRPC listener
websocketEnables WebSocket across client and server
sqliteEnables SQLite stores in the server
postgresEnables PostgreSQL stores in the server
otelEnables otel in the server and the client (on by default)
otlpEnables the server's otlp: Telemetry and OTLP export (on by default)
otlp-jsonEnables the server's otlp-json: OTLP/HTTP with JSON bodies (off by default)
otel-prometheusEnables the server's otel-prometheus: OTEL_METRICS_EXPORTER=prometheus serves /metrics (off by default; implies otlp)
axumEnables Axum integration in the server
tool-loopEnables tool-loop in the server (server::tool_loop)
skillsEnables skills in the server (server::skills; implies tool-loop)
auth-jwtEnables JWT bearer-token authentication in the server
encryptionEnables encryption at rest for task content in the server
auditEnables the audit trail in the server and its record types in a2a-protocol-types
webhookEnables the webhook receiver in the client (on by default)

Enable features in your Cargo.toml:

[dependencies]
a2a-protocol-sdk = { version = "0.16", features = ["signing", "sqlite"] }

# Or with individual crates:
a2a-protocol-server = { version = "0.16", features = ["sqlite", "axum"] }
a2a-protocol-client = { version = "0.16", features = ["websocket"] }

Verifying the Installation

Create a simple main.rs to verify everything compiles:

use a2a_protocol_sdk::prelude::*;

fn main() {
    // Create a task status
    let status = TaskStatus::new(TaskState::Submitted);
    println!("Task state: {:?}", status.state);

    // Create a message with a text part
    let part = Part::text("Hello, A2A!");
    println!("Part: {:?}", part);

    // Verify agent capabilities builder
    let caps = AgentCapabilities::none()
        .with_streaming(true)
        .with_push_notifications(false);
    println!("Capabilities: {:?}", caps);
}

Run it:

cargo run

If this compiles and runs, you're ready to go.

Next Steps