use std::time::Duration;
use aither_core::llm::model::Parameters;
use crate::compression::ContextStrategy;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum AgentKind {
#[default]
Coding,
Chatbot,
}
#[derive(Debug, Clone)]
pub struct ContextAssemblerConfig {
pub static_budget_fraction: f32,
pub handoff_threshold: f32,
pub idle_reassemble_after: Duration,
pub handoff_instruction: String,
}
impl Default for ContextAssemblerConfig {
fn default() -> Self {
Self {
static_budget_fraction: 0.2,
handoff_threshold: 0.9,
idle_reassemble_after: Duration::from_secs(300),
handoff_instruction: "Your context window is nearly exhausted. Generate a concise handoff summary now, preserving current goals, constraints, file paths, pending tasks, and immediate next actions.".to_string(),
}
}
}
#[derive(Debug, Clone)]
pub struct AgentConfig {
pub max_iterations: usize,
pub context: ContextStrategy,
pub system_prompt: Option<String>,
pub persona_prompt: Option<String>,
pub agent_kind: AgentKind,
pub transcript_path: Option<String>,
pub context_assembler: ContextAssemblerConfig,
pub request_parameters: Parameters,
}
impl Default for AgentConfig {
fn default() -> Self {
Self {
max_iterations: 10_000,
context: ContextStrategy::default(),
system_prompt: None,
persona_prompt: None,
agent_kind: AgentKind::default(),
transcript_path: None,
context_assembler: ContextAssemblerConfig::default(),
request_parameters: Parameters::default(),
}
}
}
impl AgentConfig {
#[must_use]
pub fn new() -> Self {
Self::default()
}
#[must_use]
pub const fn with_max_iterations(mut self, limit: usize) -> Self {
self.max_iterations = limit;
self
}
#[must_use]
pub const fn with_context(mut self, strategy: ContextStrategy) -> Self {
self.context = strategy;
self
}
#[must_use]
pub fn with_system_prompt(mut self, prompt: impl Into<String>) -> Self {
self.system_prompt = Some(prompt.into());
self
}
#[must_use]
pub fn with_persona_prompt(mut self, prompt: impl Into<String>) -> Self {
self.persona_prompt = Some(prompt.into());
self
}
#[must_use]
pub const fn with_agent_kind(mut self, kind: AgentKind) -> Self {
self.agent_kind = kind;
self
}
#[must_use]
pub fn with_transcript_path(mut self, path: impl Into<String>) -> Self {
self.transcript_path = Some(path.into());
self
}
#[must_use]
pub const fn with_idle_reassemble_after(mut self, idle_reassemble_after: Duration) -> Self {
self.context_assembler.idle_reassemble_after = idle_reassemble_after;
self
}
#[must_use]
pub fn with_request_parameters(mut self, parameters: Parameters) -> Self {
self.request_parameters = parameters;
self
}
}