use crate::agent::Agent;
use crate::error::Result;
use crate::tools::Tool;
pub trait AgentBuilder: Sized {
type Agent: Agent;
fn model(self, model: impl Into<String>) -> Self;
fn system_prompt(self, prompt: impl Into<String>) -> Self;
fn name(self, name: impl Into<String>) -> Self;
fn max_iterations(self, max: usize) -> Self;
fn token_limit(self, limit: usize) -> Self;
fn tool(self, tool: Box<dyn Tool>) -> Self;
fn tools(self, tools: Vec<Box<dyn Tool>>) -> Self {
tools.into_iter().fold(self, |b, t| b.tool(t))
}
fn build(self) -> Result<Self::Agent>;
fn build_boxed(self) -> Result<Box<dyn Agent>>
where
Self::Agent: 'static,
{
self.build().map(|a| Box::new(a) as Box<dyn Agent>)
}
}