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_http(url)
26//! .with_bearer_auth("token123".to_string())
27//! .with_timeout(Duration::from_secs(30))
28//! .build()?;
29//!
30//! let agent_card = client.discover().await?;
31//! println!("Connected to: {}", agent_card.name);
32//!
33//! Ok(())
34//! }
35//! ```
36
37pub mod client;
38pub mod codec;
39pub mod layer;
40pub mod protocol;
41pub mod service;
42pub mod transport;
43
44/// Prelude module for convenient imports
45pub mod prelude {
46 pub use crate::{
47 client::{A2AClientBuilder, AgentClient},
48 protocol::error::A2AError,
49 protocol::{
50 A2AOperation, AgentCard, Artifact, Message, MessagePart, Role, Task, TaskStatus,
51 },
52 };
53}