|
1 | | -# a2a-rs |
| 1 | +# a2a-rs |
| 2 | + |
| 3 | +`a2a-rs` is a Rust workspace for the A2A v1 protocol. It includes core protocol |
| 4 | +types, async client and server libraries, protobuf definitions, and gRPC |
| 5 | +bindings for building interoperable A2A agents and clients. |
| 6 | + |
| 7 | +The workspace supports: |
| 8 | + |
| 9 | +- JSON-RPC 2.0 over HTTP |
| 10 | +- REST / HTTP+JSON |
| 11 | +- gRPC via `tonic` |
| 12 | +- Server-Sent Events for streaming responses |
| 13 | +- Protobuf-based interop with other SDKs and runtimes |
| 14 | + |
| 15 | +## Workspace |
| 16 | + |
| 17 | +| Crate | Purpose | |
| 18 | +| --- | --- | |
| 19 | +| `a2a` | Core A2A types, errors, events, JSON-RPC types, and wire-compatible serde behavior | |
| 20 | +| `a2a-client` | Async A2A client with transport abstraction and protocol negotiation from agent cards | |
| 21 | +| `a2a-server` | Async server framework with REST and JSON-RPC bindings built on `axum` | |
| 22 | +| `a2a-pb` | Protobuf schema, generated types, and native <-> protobuf conversion helpers | |
| 23 | +| `a2a-grpc` | gRPC client and server bindings built on `tonic` | |
| 24 | +| `examples/helloworld` | Minimal runnable example agent | |
| 25 | + |
| 26 | +## Supported Bindings |
| 27 | + |
| 28 | +| Binding | Client | Server | |
| 29 | +| --- | --- | --- | |
| 30 | +| JSON-RPC | `a2a-client` | `a2a-server` | |
| 31 | +| HTTP+JSON / REST | `a2a-client` | `a2a-server` | |
| 32 | +| gRPC | `a2a-grpc` | `a2a-grpc` | |
| 33 | + |
| 34 | +The gRPC support uses the schema in `a2a-pb/proto/a2a.proto`. The REST and |
| 35 | +JSON-RPC bindings are intended to stay wire-compatible with other A2A SDKs, |
| 36 | +including Go and C# implementations. |
| 37 | + |
| 38 | +## Requirements |
| 39 | + |
| 40 | +- Rust 1.85 or newer |
| 41 | +- A stable `rustup` toolchain is recommended |
| 42 | +- `just` is optional but useful for common development commands |
| 43 | +- `cargo-llvm-cov` is optional if you want HTML coverage reports |
| 44 | + |
| 45 | +## Build And Test |
| 46 | + |
| 47 | +```sh |
| 48 | +cargo build --workspace |
| 49 | +cargo test --workspace |
| 50 | +``` |
| 51 | + |
| 52 | +Common project commands are also available through `just`: |
| 53 | + |
| 54 | +```sh |
| 55 | +just build |
| 56 | +just test |
| 57 | +just lint |
| 58 | +just fmt-check |
| 59 | +just ci |
| 60 | +``` |
| 61 | + |
| 62 | +## Coverage |
| 63 | + |
| 64 | +Install `cargo-llvm-cov` once: |
| 65 | + |
| 66 | +```sh |
| 67 | +cargo install cargo-llvm-cov |
| 68 | +``` |
| 69 | + |
| 70 | +Then run: |
| 71 | + |
| 72 | +```sh |
| 73 | +just coverage |
| 74 | +``` |
| 75 | + |
| 76 | +This writes the HTML report to `target/llvm-cov/html/index.html`. |
| 77 | + |
| 78 | +## Running The Example Agent |
| 79 | + |
| 80 | +The hello world example exposes an echo-style agent over REST and JSON-RPC. |
| 81 | + |
| 82 | +```sh |
| 83 | +cargo run -p helloworld |
| 84 | +``` |
| 85 | + |
| 86 | +When the example starts, the following endpoints are available: |
| 87 | + |
| 88 | +- Agent card: `http://localhost:3000/.well-known/agent-card.json` |
| 89 | +- JSON-RPC endpoint: `http://localhost:3000/jsonrpc` |
| 90 | +- REST endpoint: `http://localhost:3000/rest` |
| 91 | + |
| 92 | +The example does not start a gRPC server, but the `a2a-grpc` crate provides the |
| 93 | +client and server bindings needed to add one. |
| 94 | + |
| 95 | +## Depending On The Workspace |
| 96 | + |
| 97 | +Until the crates are published, depend on them directly from Git: |
| 98 | + |
| 99 | +```toml |
| 100 | +[dependencies] |
| 101 | +a2a = { git = "https://github.com/agntcy/a2a-rs.git" } |
| 102 | +a2a-client = { git = "https://github.com/agntcy/a2a-rs.git" } |
| 103 | +a2a-server = { git = "https://github.com/agntcy/a2a-rs.git" } |
| 104 | +a2a-pb = { git = "https://github.com/agntcy/a2a-rs.git" } |
| 105 | +a2a-grpc = { git = "https://github.com/agntcy/a2a-rs.git" } |
| 106 | +``` |
| 107 | + |
| 108 | +Typical usage is: |
| 109 | + |
| 110 | +- `a2a` for protocol types and serde models |
| 111 | +- `a2a-client` for clients that negotiate REST or JSON-RPC from an agent card |
| 112 | +- `a2a-server` for agent implementations on `axum` |
| 113 | +- `a2a-grpc` when you need gRPC transport support |
| 114 | +- `a2a-pb` when you need direct access to protobuf messages or conversion helpers |
| 115 | + |
| 116 | +## Repository Layout |
| 117 | + |
| 118 | +- `a2a/`: core protocol crate |
| 119 | +- `a2a-client/`: client transports and factory |
| 120 | +- `a2a-server/`: request handler, routers, streaming, and stores |
| 121 | +- `a2a-pb/`: protobuf schema and conversion layer |
| 122 | +- `a2a-grpc/`: tonic-based bindings |
| 123 | +- `examples/helloworld/`: runnable sample agent |
| 124 | + |
| 125 | +## Contributing |
| 126 | + |
| 127 | +See `CONTRIBUTING.md` for contribution guidelines, `SECURITY.md` for security |
| 128 | +reporting, and `CODE_OF_CONDUCT.md` for community expectations. |
| 129 | + |
| 130 | +## License |
| 131 | + |
| 132 | +Apache-2.0. See `LICENSE` and `LICENSE.md`. |
0 commit comments