# A2A Rust SDK — Usage Guide (cleanroom) `a2a-rs` is a Rust workspace for the A2A v1 protocol. It provides core protocol types, async client and server libraries, protobuf definitions, and gRPC/SLIMRPC bindings for building interoperable A2A agents and clients. ## Supported transports - JSON-RPC 2.0 over HTTP - REST / HTTP+JSON - gRPC (tonic) - SLIMRPC (slim_bindings) - Server-Sent Events for streaming responses - Protobuf-based interop with other SDKs and runtimes Binding support matrix: | Binding | Client | Server | | --- | --- | --- | | JSON-RPC | `a2a-client` | `a2a-server` | | HTTP+JSON / REST | `a2a-client` | `a2a-server` | | gRPC | `a2a-grpc` | `a2a-grpc` | | SLIMRPC | `a2a-slimrpc` | `a2a-slimrpc` | ## Requirements - Rust 1.85 or newer (stable `rustup` toolchain recommended) - Optional: `just` for common project commands ## Build and run ```sh cargo build --workspace cargo test --workspace ``` With `just`: `just build`, `just test`, `just lint`, `just fmt-check`, `just ci`. ## Running the example agent ```sh cargo run -p helloworld ``` When the example starts, these endpoints are available: - Agent card: `http://localhost:3000/.well-known/agent-card.json` - JSON-RPC endpoint: `http://localhost:3000/jsonrpc` - REST endpoint: `http://localhost:3000/rest` The example serves an echo-style agent over REST and JSON-RPC; it does not start a gRPC server (the `a2a-grpc` crate provides those bindings). ## Installing the A2A CLI Pre-built binaries exist for macOS (arm64, x86_64), Linux (x86_64, aarch64), and Windows (x86_64). macOS (Homebrew): ```sh brew tap a2aproject/a2a-rs https://github.com/a2aproject/a2a-rs brew trust a2aproject/a2a-rs brew install a2acli ``` Linux (install script): ```sh curl -fsSL https://raw.githubusercontent.com/a2aproject/a2a-rs/main/install.sh | bash ``` Installs to `/usr/local/bin` as root or `~/.local/bin` otherwise; override the directory with `A2A_CLI_INSTALL_DIR`. Windows (WinGet): ```sh winget install a2aproject.a2acli ``` From source (crates.io): ```sh cargo install a2a-cli ``` ## Using the A2A CLI The CLI resolves the public agent card from a base URL, negotiates JSON-RPC or HTTP+JSON, prints responses as JSON, and manages task push notification configs. Subcommands: ```sh cargo run --bin a2acli -- card cargo run --bin a2acli -- send "hello from rust" cargo run --bin a2acli -- stream "hello from rust" cargo run --bin a2acli -- list-tasks cargo run --bin a2acli -- push-config list task-123 ``` Flags: - `--base-url https://host` — override the target server (default: `http://localhost:3000`, matching the bundled hello world server) - `--binding jsonrpc` or `--binding http-json` — pin transport selection - `--bearer-token ` — bearer authentication - `--header Name:Value` (repeatable) — extra request headers Output format: responses are printed as JSON. ## Depending on the crates Published on crates.io; to use the latest development version from Git: ```toml [dependencies] a2a = { package = "a2a-lf", git = "https://github.com/a2aproject/a2a-rs.git" } a2a-client = { package = "a2a-client-lf", git = "https://github.com/a2aproject/a2a-rs.git" } a2a-server = { package = "a2a-server-lf", git = "https://github.com/a2aproject/a2a-rs.git" } a2a-pb = { package = "a2a-pb", git = "https://github.com/a2aproject/a2a-rs.git" } a2a-grpc = { package = "a2a-grpc", git = "https://github.com/a2aproject/a2a-rs.git" } a2a-slimrpc = { package = "a2a-slimrpc", git = "https://github.com/a2aproject/a2a-rs.git" } ``` Typical usage: `a2a` for protocol types/serde models, `a2a-client` for clients that negotiate REST or JSON-RPC from an agent card, `a2a-server` for agent implementations on `axum`, `a2a-grpc` for gRPC transport, `a2a-slimrpc` for SLIMRPC transport, and `a2a-pb` for direct protobuf access or conversion helpers. ## License Apache-2.0.