tower_a2a/client/
config.rs1use std::time::Duration;
4
5#[derive(Debug, Clone)]
7pub struct ClientConfig {
8 pub agent_url: String,
10
11 pub timeout: Duration,
13
14 pub max_retries: u32,
16
17 pub validate_responses: bool,
19}
20
21impl ClientConfig {
22 pub fn new(agent_url: impl Into<String>) -> Self {
24 Self {
25 agent_url: agent_url.into(),
26 timeout: Duration::from_secs(30),
27 max_retries: 3,
28 validate_responses: true,
29 }
30 }
31
32 pub fn with_timeout(mut self, timeout: Duration) -> Self {
34 self.timeout = timeout;
35 self
36 }
37
38 pub fn with_max_retries(mut self, max_retries: u32) -> Self {
40 self.max_retries = max_retries;
41 self
42 }
43
44 pub fn with_validation(mut self, enabled: bool) -> Self {
46 self.validate_responses = enabled;
47 self
48 }
49}
50
51impl Default for ClientConfig {
52 fn default() -> Self {
53 Self::new("")
54 }
55}