Skip to main content

ra2a

Comprehensive Rust SDK for the Agent2Agent (A2A) Protocol — client transport, server framework, streaming, gRPC, and multi-backend task storage.

What is ra2a?

ra2a implements the full A2A protocol specification (v0.3.0) with an idiomatic Rust API. It provides everything you need to build agents that discover each other, exchange tasks, and stream results.

Key Features

  • Axum server — full A2A server with JSON-RPC endpoints, SSE streaming, and task lifecycle management.
  • reqwest client — discover agents, send messages, and stream responses.
  • gRPC transport — optional tonic/prost-based gRPC transport.
  • Task storage — in-memory (default), PostgreSQL, MySQL, or SQLite.
  • Push notifications — HMAC-SHA256 verified webhook push notifications.

Quick Start

cargo add ra2a
use ra2a::client::{A2AClient, Client};

let client = A2AClient::new("https://agent.example.com")?;

// Discover agent capabilities
let card = client.get_agent_card().await?;
println!("Agent: {} — {}", card.name, card.description.unwrap_or_default());

// Send a message
let message = ra2a::types::Message::user_text("Hello!");
let mut stream = client.send_message(message).await?;

while let Some(event) = futures::StreamExt::next(&mut stream).await {
println!("{:?}", event?);
}

Feature Flags

FlagDefaultDescription
clientyesHTTP/JSON-RPC client, SSE streaming, card resolver
serveryesAxum HTTP server, event queue, task lifecycle
grpcgRPC transport via tonic/prost
telemetryOpenTelemetry tracing spans and metrics
postgresqlPostgreSQL task store via sqlx
mysqlMySQL task store via sqlx
sqliteSQLite task store via sqlx
sqlAll SQL backends
fullEverything
# Server with PostgreSQL and telemetry
ra2a = { version = "0.4", features = ["server", "postgresql", "telemetry"] }

# Client only
ra2a = { version = "0.4", default-features = false, features = ["client"] }

# Everything
ra2a = { version = "0.4", features = ["full"] }

Source Code