a2a_client/
lib.rs

1//! # A2A Protocol Client
2//!
3//! This crate provides a client for calling remote A2A (Agent-to-Agent) protocol compliant agents.
4//! It supports both streaming and non-streaming interactions over HTTP/HTTPS.
5//!
6//! ## Features
7//!
8//! - Full A2A protocol support (JSON-RPC 2.0)
9//! - Non-streaming and streaming message support
10//! - Task retrieval and listing
11//! - Agent discovery via agent cards
12//! - Authentication support (Bearer tokens)
13//! - Error handling with detailed error types
14//!
15//! ## Example
16//!
17//! ```rust,no_run
18//! use a2a_client::A2AClient;
19//! use a2a_types::{Message, MessageRole, MessageSendParams, Part};
20//!
21//! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
22//! // Create client from agent card URL
23//! let client = A2AClient::from_card_url("https://agent.example.com")
24//!     .await?
25//!     .with_auth_token("your_api_key");
26//!
27//! // Create message
28//! let message = Message {
29//!     kind: "message".to_string(),
30//!     message_id: "msg_123".to_string(),
31//!     role: MessageRole::User,
32//!     parts: vec![Part::Text {
33//!         text: "Hello!".to_string(),
34//!         metadata: None,
35//!     }],
36//!     context_id: None,
37//!     task_id: None,
38//!     reference_task_ids: Vec::new(),
39//!     extensions: Vec::new(),
40//!     metadata: None,
41//! };
42//!
43//! // Send message
44//! let params = MessageSendParams {
45//!     message,
46//!     configuration: None,
47//!     metadata: None,
48//! };
49//!
50//! let result = client.send_message(params).await?;
51//! # Ok(())
52//! # }
53//! ```
54
55pub mod client;
56pub mod constants;
57pub mod error;
58
59pub use client::A2AClient;
60pub use error::{A2AError, A2AResult};