tower_a2a/
lib.rs

1//! # Tower A2A
2//!
3//! A Tower-based implementation of the Agent2Agent (A2A) protocol.
4//!
5//! This library provides a composable, transport-agnostic implementation of the A2A protocol
6//! using Tower's Service and Layer abstractions. It supports multiple transport protocols
7//! (HTTP, gRPC, WebSocket) through a unified interface.
8//!
9//! ## Features
10//!
11//! - **Transport Agnostic**: Works with HTTP, gRPC, WebSocket, or custom transports
12//! - **Composable Middleware**: Auth, retry, timeout, validation as Tower layers
13//! - **Type Safe**: Compile-time guarantees for protocol operations
14//! - **Async**: Built on tokio for high performance
15//!
16//! ## Example
17//!
18//! ```rust,no_run
19//! use tower_a2a::prelude::*;
20//! use std::time::Duration;
21//!
22//! #[tokio::main]
23//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
24//!     let url = "https://agent.example.com".parse().unwrap();
25//!     let mut client = A2AClientBuilder::new(url)
26//!         .with_http()
27//!         .with_bearer_auth("token123".to_string())
28//!         .with_timeout(Duration::from_secs(30))
29//!         .build()?;
30//!
31//!     let agent_card = client.discover().await?;
32//!     println!("Connected to: {}", agent_card.name);
33//!
34//!     Ok(())
35//! }
36//! ```
37
38pub mod client;
39pub mod codec;
40pub mod layer;
41pub mod protocol;
42pub mod service;
43pub mod transport;
44
45/// Prelude module for convenient imports
46pub mod prelude {
47    pub use crate::{
48        client::{A2AClientBuilder, AgentClient},
49        protocol::error::A2AError,
50        protocol::{A2AOperation, AgentCard, Message, MessagePart, Role, Task, TaskStatus},
51    };
52}