a2a-rs
A Rust implementation of the Agent-to-Agent (A2A) Protocol, providing a type-safe, idiomatic way to build agent communication systems.
Features
- 🚀 Complete A2A Protocol Implementation - Full support for the A2A specification
- 🔄 Multiple Transport Options - HTTP and WebSocket support
- 📡 Streaming Updates - Real-time task and artifact updates
- 🔐 Authentication & Security - JWT, OAuth2, OpenID Connect support
- 💾 Persistent Storage - SQLx integration for task persistence
- 🎯 Async-First Design - Built on Tokio with async/await throughout
- 🧩 Modular Architecture - Use only the features you need
- ✅ Type Safety - Leverages Rust's type system for protocol compliance
Quick Start
Add to your Cargo.toml
:
[]
= "0.1.0"
# For HTTP client
= { = "0.1.0", = ["http-client"] }
# For HTTP server
= { = "0.1.0", = ["http-server"] }
# Full feature set
= { = "0.1.0", = ["full"] }
Client Example
use ;
async
Server Example
use ;
use ;
;
async
Architecture
This library follows a hexagonal architecture pattern:
- Domain: Core business logic and types
- Ports: Trait definitions for external dependencies
- Adapters: Concrete implementations for different transports and storage
Feature Flags
client
- Client-side functionalityserver
- Server-side functionalityhttp-client
- HTTP client implementationhttp-server
- HTTP server implementationws-client
- WebSocket client implementationws-server
- WebSocket server implementationauth
- Authentication support (JWT, OAuth2, OpenID Connect)sqlx-storage
- SQLx-based persistent storagesqlite
- SQLite database supportpostgres
- PostgreSQL database supportmysql
- MySQL database supporttracing
- Structured logging and tracingfull
- All features enabled
Examples
See the examples directory for complete working examples:
Documentation
Full API documentation is available on docs.rs.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.