Skip to main content

aither_agent/
config.rs

1//! Agent configuration.
2
3use crate::context::ContextPolicy;
4
5/// Configuration for agent behavior.
6#[derive(Debug, Clone)]
7pub struct AgentConfig {
8    /// Maximum number of agent loop iterations.
9    pub max_iterations: usize,
10
11    /// Thresholds governing compaction, pausing and reassembly.
12    pub context_policy: ContextPolicy,
13}
14
15impl Default for AgentConfig {
16    fn default() -> Self {
17        Self {
18            max_iterations: 10_000,
19            context_policy: ContextPolicy::default(),
20        }
21    }
22}
23
24impl AgentConfig {
25    /// Creates a new configuration with default values.
26    #[must_use]
27    pub fn new() -> Self {
28        Self::default()
29    }
30
31    /// Sets the maximum number of iterations.
32    #[must_use]
33    pub const fn with_max_iterations(mut self, limit: usize) -> Self {
34        self.max_iterations = limit;
35        self
36    }
37
38    /// Sets the context management policy.
39    #[must_use]
40    pub const fn with_context_policy(mut self, policy: ContextPolicy) -> Self {
41        self.context_policy = policy;
42        self
43    }
44}