use crate::{
agent::{Agent, config::AgentConfig, tool::ToolSender},
model::Model,
};
use crabllm_core::{Provider, Tool};
pub struct AgentBuilder<P: Provider + 'static> {
config: AgentConfig,
model: Model<P>,
tools: Vec<Tool>,
tool_tx: Option<ToolSender>,
}
impl<P: Provider + 'static> AgentBuilder<P> {
pub fn new(model: Model<P>) -> Self {
Self {
config: AgentConfig::default(),
model,
tools: Vec::new(),
tool_tx: None,
}
}
pub fn config(mut self, config: AgentConfig) -> Self {
self.config = config;
self
}
pub fn tools(mut self, tools: Vec<Tool>) -> Self {
self.tools = tools;
self
}
pub fn tool_tx(mut self, tx: ToolSender) -> Self {
self.tool_tx = Some(tx);
self
}
pub fn build(self) -> Agent<P> {
Agent {
config: self.config,
model: self.model,
tools: self.tools,
tool_tx: self.tool_tx,
}
}
}